GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
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/block.h>
27 #include <gnuradio/blocks/api.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,
70  float mean_ms,
71  float std_ms);
72 
73  /*!
74  * Reset the message being sent.
75  * \param msg The message to send as a PMT.
76  */
77  virtual void set_msg(pmt::pmt_t msg) = 0;
78 
79  /*!
80  * Get the value of the message being sent.
81  */
82  virtual pmt::pmt_t msg() const = 0;
83 
84  /*!
85  * \param dist new distribution.
86  */
87  virtual void set_dist(message_strobe_random_distribution_t dist) = 0;
88 
89  /*!
90  * get the current distribution.
91  */
92  virtual message_strobe_random_distribution_t dist() const = 0;
93 
94  /*!
95  * Reset the sending interval.
96  * \param mean delay in milliseconds.
97  */
98  virtual void set_mean(float mean) = 0;
99 
100  /*!
101  * Get the time interval of the strobe_random.
102  */
103  virtual float mean() const = 0;
104 
105  /*!
106  * Reset the sending interval.
107  * \param std delay in milliseconds.
108  */
109  virtual void set_std(float std) = 0;
110 
111  /*!
112  * Get the std of strobe_random.
113  */
114  virtual float std() const = 0;
115 };
116 
117 } /* namespace blocks */
118 } /* namespace gr */
119 
120 #endif /* INCLUDED_GR_MESSAGE_STROBE_H */
boost::shared_ptr< message_strobe_random > sptr
Definition: message_strobe_random.h:56
boost::shared_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:96
STL namespace.
Definition: message_strobe_random.h:37
Send message at defined interval.
Definition: message_strobe_random.h:52
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
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
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: block.h:71