GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
message_strobe_random.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012-2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_GR_MESSAGE_STROBE_RANDOM_H
24 #define INCLUDED_GR_MESSAGE_STROBE_RANDOM_H
25 
26 #include <gnuradio/blocks/api.h>
27 #include <gnuradio/block.h>
28 
29 namespace gr {
30  namespace blocks {
31 
32  /*
33  * strobing models
34  */
35  typedef enum {
40 
41  /*!
42  * \brief Send message at defined interval
43  * \ingroup message_tools_blk
44  *
45  * \details
46 
47  * Takes a PMT message and sends it out every at random
48  * intervals. The interval is basedon a random distribution, \p
49  * dist, with specified mean (\p mean_ms) and variance (\p
50  * std_ms). Useful for testing/debugging the message system.
51  */
52  class BLOCKS_API message_strobe_random : virtual public block
53  {
54  public:
55  // gr::blocks::message_strobe_random::sptr
56  typedef boost::shared_ptr<message_strobe_random> sptr;
57 
58  /*!
59  * Make a message stobe block to sends message \p msg at random
60  * intervals defined by the distribution \p dist with mean \p
61  * mean_ms and standard deviation \p std_ms.
62  *
63  * \param msg The message to send as a PMT.
64  * \param dist The random distribution from which to draw events.
65  * \param mean_ms The mean of the distribution.
66  * \param std_ms The standard deviation of the distribution.
67  */
68  static sptr make(pmt::pmt_t msg, message_strobe_random_distribution_t dist, float mean_ms, float std_ms);
69 
70  /*!
71  * Reset the message being sent.
72  * \param msg The message to send as a PMT.
73  */
74  virtual void set_msg(pmt::pmt_t msg) = 0;
75 
76  /*!
77  * Get the value of the message being sent.
78  */
79  virtual pmt::pmt_t msg() const = 0;
80 
81  /*!
82  * \param dist new distribution.
83  */
84  virtual void set_dist(message_strobe_random_distribution_t dist) = 0;
85 
86  /*!
87  * get the current distribution.
88  */
89  virtual message_strobe_random_distribution_t dist() const = 0;
90 
91  /*!
92  * Reset the sending interval.
93  * \param mean delay in milliseconds.
94  */
95  virtual void set_mean(float mean) = 0;
96 
97  /*!
98  * Get the time interval of the strobe_random.
99  */
100  virtual float mean() const = 0;
101 
102  /*!
103  * Reset the sending interval.
104  * \param std delay in milliseconds.
105  */
106  virtual void set_std(float std) = 0;
107 
108  /*!
109  * Get the std of strobe_random.
110  */
111  virtual float std() const = 0;
112 
113  };
114 
115  } /* namespace blocks */
116 } /* namespace gr */
117 
118 #endif /* INCLUDED_GR_MESSAGE_STROBE_H */
boost::shared_ptr< message_strobe_random > sptr
Definition: message_strobe_random.h:56
STL namespace.
Definition: message_strobe_random.h:37
Send message at defined interval.
Definition: message_strobe_random.h:52
Include this header to use the message passing features.
Definition: logger.h:131
Definition: message_strobe_random.h:38
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
message_strobe_random_distribution_t
Definition: message_strobe_random.h:35
Definition: message_strobe_random.h:36
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:56
The abstract base class for all 'terminal' processing blocks.A signal processing flow is constructed ...
Definition: block.h:60