GNU Radio Manual and C++ API Reference  3.7.14.0
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rpcregisterhelpers.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012,2014 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 RPCREGISTERHELPERS_H
24 #define RPCREGISTERHELPERS_H
25 
26 #include <gnuradio/rpcmanager.h>
30 #include <stdio.h>
31 #include <iostream>
32 #include <sstream>
33 
34 // Fixes circular dependency issue before including block_registry.h
35 class rpcbasic_base;
36 typedef boost::shared_ptr<rpcbasic_base> rpcbasic_sptr;
37 
39 
40 
41 /*********************************************************************
42  * RPC Extractor Base Classes
43  ********************************************************************/
44 
45 /*!
46  *\brief Base class for registering a ControlPort Extractor. Acts as
47  * a message acceptor.
48  */
49 template <typename T, typename Tto>
51 {
52 public:
53  rpcextractor_base(T* source, void (T::*func)(Tto)) : _source(source), _func(func)
54  {
55  ;
56  }
58 
59  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
60  {
61  throw std::runtime_error(
62  "rpcextractor_base: no post defined for this data type.\n");
63  }
64 
65 protected:
66  T* _source;
67  void (T::*_func)(Tto);
68 };
69 
70 template <typename T>
71 class rpcextractor_base<T, void> : public virtual gr::messages::msg_accepter
72 {
73 public:
74  rpcextractor_base(T* source, void (T::*func)()) : _source(source), _func(func) { ; }
76 
77  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
78  {
79  throw std::runtime_error(
80  "rpcextractor_base: no post defined for this data type.\n");
81  }
82 
83 protected:
84  T* _source;
85  void (T::*_func)();
86 };
87 
88 /*!
89  * \brief Templated parent class for registering a ControlPort Extractor.
90  */
91 template <typename T, typename Tto>
92 class rpcbasic_extractor : public virtual rpcextractor_base<T, Tto>
93 {
94 public:
95  rpcbasic_extractor(T* source, void (T::*func)(Tto))
96  : rpcextractor_base<T, Tto>(source, func)
97  {
98  ;
99  }
100 };
101 
102 
103 /*********************************************************************
104  * RPC Inserter Base Classes
105  ********************************************************************/
106 
107 /*!
108  * \brief Base class for registering a ControlPort Inserter. Produces a
109  * message.
110  */
111 template <typename T, typename Tfrom>
113 {
114 public:
115  rpcinserter_base(T* source, Tfrom (T::*func)()) : _source(source), _func(func) { ; }
117 
119  {
120  assert(0);
121  return pmt::pmt_t();
122  }
123 
124 protected:
126  Tfrom (T::*_func)();
127 };
128 
129 
130 /*!
131  * \brief Templated parent class for registering a ControlPort
132  * Inserter.
133  */
134 template <typename T, typename Tfrom>
135 class rpcbasic_inserter : public virtual rpcinserter_base<T, Tfrom>
136 {
137 public:
138  rpcbasic_inserter(T* source, Tfrom (T::*func)() const)
139  : rpcinserter_base<T, Tfrom>(source, func)
140  {
141  ;
142  }
143 
144  rpcbasic_inserter(T* source, Tfrom (T::*func)())
145  : rpcinserter_base<T, Tfrom>(source, func)
146  {
147  ;
148  }
149 
151  {
152  return pmt::mp(
154  }
155 };
156 
157 
158 /*********************************************************************
159  * RPC Handler Base Classes
160  ********************************************************************/
161 
162 /*!
163  *\brief Base class for registering a ControlPort Handler. Acts as
164  * a message acceptor.
165  */
166 template <typename T>
168 {
169 public:
170  rpchandler_base(T* source, const char* handler) : _source(source), _handler(handler)
171  {
172  ;
173  }
175 
176  void post(pmt::pmt_t which_port, pmt::pmt_t msg) { _source->post(which_port, msg); }
177 
178 protected:
180  const char* _handler;
181 };
182 
183 
184 /*!
185  * \brief Templated parent class for registering a ControlPort Extractor.
186  */
187 template <typename T>
188 class rpcbasic_handler : public virtual rpchandler_base<T>
189 {
190 public:
191  rpcbasic_handler(T* source, const char* handler) : rpchandler_base<T>(source, handler)
192  {
193  ;
194  }
195 };
196 
197 
198 /*********************************************************************
199  * RPC Specialized Extractors
200  ********************************************************************/
201 
202 /*!
203  * \brief Specialized extractor class to make calls to functions that
204  * do not take data (enable, reset, start, etc.).
205  */
206 template <typename T>
207 class rpcbasic_extractor<T, void> : public virtual rpcextractor_base<T, void>
208 {
209 public:
210  rpcbasic_extractor(T* source, void (T::*func)())
211  : rpcextractor_base<T, void>(source, func)
212  {
213  ;
214  }
215 
216  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
217  {
219  }
220 };
221 
222 /*!
223  * \brief Specialized extractor class for char data.
224  */
225 template <typename T>
226 class rpcbasic_extractor<T, char> : public virtual rpcextractor_base<T, char>
227 {
228 public:
229  rpcbasic_extractor(T* source, void (T::*func)(char))
230  : rpcextractor_base<T, char>(source, func)
231  {
232  ;
233  }
234 
235  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
236  {
238  static_cast<char>(pmt::to_long(msg)));
239  }
240 };
241 
242 /*!
243  * \brief Specialized extractor class for short data.
244  */
245 template <typename T>
246 class rpcbasic_extractor<T, short> : public virtual rpcextractor_base<T, short>
247 {
248 public:
249  rpcbasic_extractor(T* source, void (T::*func)(short))
250  : rpcextractor_base<T, short>(source, func)
251  {
252  ;
253  }
254 
255  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
256  {
258  static_cast<short>(pmt::to_long(msg)));
259  }
260 };
261 
262 /*!
263  * \brief Specialized extractor class for double data.
264  */
265 template <typename T>
266 class rpcbasic_extractor<T, double> : public virtual rpcextractor_base<T, double>
267 {
268 public:
269  rpcbasic_extractor(T* source, void (T::*func)(double))
270  : rpcextractor_base<T, double>(source, func)
271  {
272  ;
273  }
274 
275  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
276  {
278  pmt::to_double(msg));
279  }
280 };
281 
282 /*!
283  * \brief Specialized extractor class for float data.
284  */
285 template <typename T>
286 class rpcbasic_extractor<T, float> : public virtual rpcextractor_base<T, float>
287 {
288 public:
289  rpcbasic_extractor(T* source, void (T::*func)(float))
290  : rpcextractor_base<T, float>(source, func)
291  {
292  ;
293  }
294 
295  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
296  {
298  pmt::to_double(msg));
299  }
300 };
301 
302 /*!
303  * \brief Specialized extractor class for long data.
304  */
305 template <typename T>
306 class rpcbasic_extractor<T, long> : public virtual rpcextractor_base<T, long>
307 {
308 public:
309  rpcbasic_extractor(T* source, void (T::*func)(long))
310  : rpcextractor_base<T, long>(source, func)
311  {
312  ;
313  }
314 
315  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
316  {
318  pmt::to_long(msg));
319  }
320 };
321 
322 /*!
323  * \brief Specialized extractor class for int data.
324  */
325 template <typename T>
326 class rpcbasic_extractor<T, int> : public virtual rpcextractor_base<T, int>
327 {
328 public:
329  rpcbasic_extractor(T* source, void (T::*func)(int))
330  : rpcextractor_base<T, int>(source, func)
331  {
332  ;
333  }
334 
335  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
336  {
338  pmt::to_long(msg));
339  }
340 };
341 
342 /*!
343  * \brief Specialized extractor class for bool data.
344  */
345 template <typename T>
346 class rpcbasic_extractor<T, bool> : public virtual rpcextractor_base<T, bool>
347 {
348 public:
349  rpcbasic_extractor(T* source, void (T::*func)(bool))
350  : rpcextractor_base<T, bool>(source, func)
351  {
352  ;
353  }
354 
355  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
356  {
358  pmt::to_bool(msg));
359  }
360 };
361 
362 /*!
363  * \brief Specialized extractor class for complex (float) data.
364  */
365 template <typename T>
366 class rpcbasic_extractor<T, std::complex<float> >
367  : public virtual rpcextractor_base<T, std::complex<float> >
368 {
369 public:
370  rpcbasic_extractor(T* source, void (T::*func)(std::complex<float>))
371  : rpcextractor_base<T, std::complex<float> >(source, func)
372  {
373  ;
374  }
375 
376  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
377  {
378  std::complex<float> k = static_cast<std::complex<float> >(pmt::to_complex(msg));
381  }
382 };
383 
384 /*!
385  * \brief Specialized extractor class for complex (double) data.
386  */
387 template <typename T>
388 class rpcbasic_extractor<T, std::complex<double> >
389  : public virtual rpcextractor_base<T, std::complex<double> >
390 {
391 public:
392  rpcbasic_extractor(T* source, void (T::*func)(std::complex<double>))
393  : rpcextractor_base<T, std::complex<double> >(source, func)
394  {
395  ;
396  }
397 
398  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
399  {
402  }
403 };
404 
405 /*!
406  * \brief Specialized extractor class for string data.
407  */
408 template <typename T>
409 class rpcbasic_extractor<T, std::string>
410  : public virtual rpcextractor_base<T, std::string>
411 {
412 public:
413  rpcbasic_extractor(T* source, void (T::*func)(std::string))
414  : rpcextractor_base<T, std::string>(source, func)
415  {
416  ;
417  }
418 
419  void post(pmt::pmt_t which_port, pmt::pmt_t msg)
420  {
423  }
424 };
425 
426 
427 /*********************************************************************
428  * RPC Specialized Inserters
429  ********************************************************************/
430 
431 /*!
432  * \brief Specialized inserter class for uint64_t data.
433  */
434 template <typename T>
435 class rpcbasic_inserter<T, uint64_t> : public virtual rpcinserter_base<T, uint64_t>
436 {
437 public:
438  rpcbasic_inserter(T* source, uint64_t (T::*func)() const)
439  : rpcinserter_base<T, uint64_t>(source, func)
440  {
441  ;
442  }
443 
444  rpcbasic_inserter(T* source, uint64_t (T::*func)())
445  : rpcinserter_base<T, uint64_t>(source, func)
446  {
447  ;
448  }
449 
451  {
454  }
455 };
456 
457 /*!
458  * \brief Specialized inserter class for vectors of signed char data.
459  */
460 template <typename T>
461 class rpcbasic_inserter<T, std::vector<signed char> >
462  : public virtual rpcinserter_base<T, std::vector<signed char> >
463 {
464 public:
465  rpcbasic_inserter(T* source, std::vector<signed char> (T::*func)() const)
466  : rpcinserter_base<T, std::vector<signed char> >(source, func)
467  {
468  ;
469  }
470 
471  rpcbasic_inserter(T* source, std::vector<signed char> (T::*func)())
472  : rpcinserter_base<T, std::vector<signed char> >(source, func)
473  {
474  ;
475  }
476 
478  {
479  std::vector<signed char> vec(
480  (rpcinserter_base<T, std::vector<signed char> >::_source
481  ->*rpcinserter_base<T, std::vector<signed char> >::_func)());
482  return pmt::init_s8vector(vec.size(), &vec[0]);
483  }
484 };
485 
486 /*!
487  * \brief Specialized inserter class for vectors of short data.
488  */
489 template <typename T>
490 class rpcbasic_inserter<T, std::vector<short> >
491  : public virtual rpcinserter_base<T, std::vector<short> >
492 {
493 public:
494  rpcbasic_inserter(T* source, std::vector<short> (T::*func)() const)
495  : rpcinserter_base<T, std::vector<short> >(source, func)
496  {
497  ;
498  }
499 
500  rpcbasic_inserter(T* source, std::vector<short> (T::*func)())
501  : rpcinserter_base<T, std::vector<short> >(source, func)
502  {
503  ;
504  }
505 
507  {
508  std::vector<short> vec(
509  (rpcinserter_base<T, std::vector<short> >::_source
510  ->*rpcinserter_base<T, std::vector<short> >::_func)());
511  return pmt::init_s16vector(vec.size(), &vec[0]);
512  }
513 };
514 
515 /*!
516  * \brief Specialized inserter class for vectors of int data.
517  */
518 template <typename T>
519 class rpcbasic_inserter<T, std::vector<int> >
520  : public virtual rpcinserter_base<T, std::vector<int> >
521 {
522 public:
523  rpcbasic_inserter(T* source, std::vector<int> (T::*func)() const)
524  : rpcinserter_base<T, std::vector<int> >(source, func)
525  {
526  ;
527  }
528 
529  rpcbasic_inserter(T* source, std::vector<int> (T::*func)())
530  : rpcinserter_base<T, std::vector<int> >(source, func)
531  {
532  ;
533  }
534 
536  {
537  std::vector<int> vec((rpcinserter_base<T, std::vector<int> >::_source
538  ->*rpcinserter_base<T, std::vector<int> >::_func)());
539  return pmt::init_s32vector(vec.size(), &vec[0]);
540  }
541 };
542 
543 /*!
544  * \brief Specialized inserter class for vectors of int64_t data.
545  */
546 template <typename T>
547 class rpcbasic_inserter<T, std::vector<int64_t> >
548  : public virtual rpcinserter_base<T, std::vector<int64_t> >
549 {
550 public:
551  rpcbasic_inserter(T* source, std::vector<int64_t> (T::*func)() const)
552  : rpcinserter_base<T, std::vector<int64_t> >(source, func)
553  {
554  ;
555  }
556 
557  rpcbasic_inserter(T* source, std::vector<int64_t> (T::*func)())
558  : rpcinserter_base<T, std::vector<int64_t> >(source, func)
559  {
560  ;
561  }
562 
564  {
565  std::vector<int64_t> vec(
566  (rpcinserter_base<T, std::vector<int64_t> >::_source
567  ->*rpcinserter_base<T, std::vector<int64_t> >::_func)());
568  return pmt::init_s64vector(vec.size(), &vec[0]);
569  }
570 };
571 
572 /*!
573  * \brief Specialized inserter class for vectors of complex (float) data.
574  */
575 template <typename T>
576 class rpcbasic_inserter<T, std::vector<std::complex<float> > >
577  : public virtual rpcinserter_base<T, std::vector<std::complex<float> > >
578 {
579 public:
580  rpcbasic_inserter(T* source, std::vector<std::complex<float> > (T::*func)() const)
581  : rpcinserter_base<T, std::vector<std::complex<float> > >(source, func)
582  {
583  ;
584  }
585 
586  rpcbasic_inserter(T* source, std::vector<std::complex<float> > (T::*func)())
587  : rpcinserter_base<T, std::vector<std::complex<float> > >(source, func)
588  {
589  ;
590  }
591 
593  {
594  std::vector<std::complex<float> > vec(
595  (rpcinserter_base<T, std::vector<std::complex<float> > >::_source
596  ->*rpcinserter_base<T, std::vector<std::complex<float> > >::_func)());
597  return pmt::init_c32vector(vec.size(), &vec[0]);
598  }
599 };
600 
601 /*!
602  * \brief Specialized inserter class for vectors of float data.
603  */
604 template <typename T>
605 class rpcbasic_inserter<T, std::vector<float> >
606  : public virtual rpcinserter_base<T, std::vector<float> >
607 {
608 public:
609  rpcbasic_inserter(T* source, std::vector<float> (T::*func)() const)
610  : rpcinserter_base<T, std::vector<float> >(source, func)
611  {
612  ;
613  }
614 
615  rpcbasic_inserter(T* source, std::vector<float> (T::*func)())
616  : rpcinserter_base<T, std::vector<float> >(source, func)
617  {
618  ;
619  }
620 
622  {
623  std::vector<float> vec(
624  (rpcinserter_base<T, std::vector<float> >::_source
625  ->*rpcinserter_base<T, std::vector<float> >::_func)());
626  return pmt::init_f32vector(vec.size(), &vec[0]);
627  }
628 };
629 
630 /*!
631  * \brief Specialized inserter class for vectors of uint8_t data.
632  */
633 template <typename T>
634 class rpcbasic_inserter<T, std::vector<uint8_t> >
635  : public virtual rpcinserter_base<T, std::vector<uint8_t> >
636 {
637 public:
638  rpcbasic_inserter(T* source, std::vector<uint8_t> (T::*func)() const)
639  : rpcinserter_base<T, std::vector<uint8_t> >(source, func)
640  {
641  ;
642  }
643 
644  rpcbasic_inserter(T* source, std::vector<uint8_t> (T::*func)())
645  : rpcinserter_base<T, std::vector<uint8_t> >(source, func)
646  {
647  ;
648  }
649 
651  {
652  std::vector<uint8_t> vec(
653  (rpcinserter_base<T, std::vector<uint8_t> >::_source
654  ->*rpcinserter_base<T, std::vector<uint8_t> >::_func)());
655  return pmt::init_u8vector(vec.size(), &vec[0]);
656  }
657 };
658 
659 /*!
660  * \brief Specialized inserter class for complex (float) data.
661  */
662 template <typename T>
663 class rpcbasic_inserter<T, std::complex<float> >
664  : public virtual rpcinserter_base<T, std::complex<float> >
665 {
666 public:
667  rpcbasic_inserter(T* source, std::complex<float> (T::*func)() const)
668  : rpcinserter_base<T, std::complex<float> >(source, func)
669  {
670  ;
671  }
672 
673  rpcbasic_inserter(T* source, std::complex<float> (T::*func)())
674  : rpcinserter_base<T, std::complex<float> >(source, func)
675  {
676  ;
677  }
678 
680  {
681  std::complex<float> k(
682  (rpcinserter_base<T, std::complex<float> >::_source
683  ->*rpcinserter_base<T, std::complex<float> >::_func)());
684  return pmt::from_complex(k);
685  }
686 };
687 
688 /*!
689  * \brief Specialized inserter class for complex (double) data.
690  */
691 template <typename T>
692 class rpcbasic_inserter<T, std::complex<double> >
693  : public virtual rpcinserter_base<T, std::complex<double> >
694 {
695 public:
696  rpcbasic_inserter(T* source, std::complex<double> (T::*func)() const)
697  : rpcinserter_base<T, std::complex<double> >(source, func)
698  {
699  ;
700  }
701 
702  rpcbasic_inserter(T* source, std::complex<double> (T::*func)())
703  : rpcinserter_base<T, std::complex<double> >(source, func)
704  {
705  ;
706  }
707 
709  {
710  std::complex<double> k(
711  (rpcinserter_base<T, std::complex<double> >::_source
712  ->*rpcinserter_base<T, std::complex<double> >::_func)());
713  return pmt::from_complex(k);
714  }
715 };
716 
717 /*!
718  * \brief Base class for registering a ControlPort function.
719  */
720 template <typename T>
723 
724 protected:
725  static int count;
726 };
727 
728 /*!
729  * Base class to inherit from and create universal shared pointers.
730  */
732 {
733 public:
735  virtual ~rpcbasic_base(){};
736 };
737 
738 
739 /*********************************************************************
740  * RPC Register Set Classes
741  ********************************************************************/
742 
743 /*!
744  * \brief Registers a 'set' function to set a parameter over
745  * ControlPort.
746  *
747  * \details
748  *
749  * This class allows us to remotely set a value or parameter of the
750  * block over ControlPort. The set occurs by calling a setter accessor
751  * function of the class, usually set_[variable](), which is passed in
752  * as \p function.
753  *
754  * We can set the (expected) minimum (\p min), maximum (\p max), and
755  * default (\p def) of the variables being set. These values are not
756  * enforced, however, but can be useful for setting up graphs and
757  * other ways of bounding the data.
758  *
759  * This class also allows us to provide information to the user about
760  * the variable being set, such as an appropriate unit (\p units_) as
761  * well as a description (\p desc_) about what the variable does.
762  *
763  * The privilege (\p minpriv_) level is the minimum privilege level a
764  * remote must identify with to be able to call this function.
765  *
766  * We also provide display hints (\p display_), which can be used by
767  * the ControlPort client application to know how to best display or
768  * even print the data. This is a mask of options for variables set in
769  * rpccallbackregister_base.h. The mask is defined by one of the
770  * "DisplayType Plotting Types" and or'd with any of the "DisplayType
771  * Options" features. See "Display Options" in \ref page_ctrlport for
772  * details.
773  */
774 template <typename T, typename Tto>
776  /*!
777  * \brief Adds the ability to set the variable over ControlPort.
778  *
779  * \details
780  *
781  * This constructor is specifically for gr::block's to use to add
782  * settable variables to ControlPort. Generally meant to be used
783  * in gr::block::setup_rpc.
784  *
785  * Uses the block's alias to create the ControlPort interface. This
786  * alias is cross-referenced by the global_block_registry (static
787  * variable of type gr::block_registry) to get the pointer to the
788  * block.
789  *
790  * \param block_alias Block's alias; use alias() to get it from the block.
791  * \param functionbase The name of the function that we'll access over ControlPort
792  * \param function A function pointer to the real function accessed when called
793  * something like: &[block class]\::set_[variable]()
794  * \param min Expected minimum value the parameter can hold
795  * \param max Expected maximum value the parameter can hold
796  * \param def Expected default value the parameter can hold
797  * \param units_ A string to describe what units to represent the variable with
798  * \param desc_ A string to describing the variable.
799  * \param minpriv_ The required minimum privilege level
800  * \param display_ The display mask
801  */
802  rpcbasic_register_set(const std::string& block_alias,
803  const char* functionbase,
804  void (T::*function)(Tto),
805  const pmt::pmt_t& min,
806  const pmt::pmt_t& max,
807  const pmt::pmt_t& def,
808  const char* units_ = "",
809  const char* desc_ = "",
810  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
811  DisplayType display_ = DISPNULL)
812  {
813  d_min = min;
814  d_max = max;
815  d_def = def;
816  d_units = units_;
817  d_desc = desc_;
818  d_minpriv = minpriv_;
819  d_display = display_;
820  d_object = dynamic_cast<T*>(
821  global_block_registry.block_lookup(pmt::intern(block_alias)).get());
822 #ifdef GR_RPCSERVER_ENABLED
824  new rpcbasic_extractor<T, Tto>(d_object, function),
825  minpriv_,
826  std::string(units_),
827  display_,
828  std::string(desc_),
829  min,
830  max,
831  def);
832  std::ostringstream oss(std::ostringstream::out);
833  oss << block_alias << "::" << functionbase;
834  d_id = oss.str();
835  // std::cerr << "REGISTERING SET: " << d_id << " " << desc_ << std::endl;
836  rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor);
837 #endif
838  }
839 
840  /*!
841  * \brief Adds the ability to set the variable over ControlPort.
842  *
843  * \details
844  *
845  * Allows us to add non gr::block related objects to
846  * ControlPort. Instead of using the block's alias, we give it a \p
847  * name and the actual pointer to the object as \p obj. We just need
848  * to make sure that the pointer to this object is always valid.
849  *
850  * \param name Name of the object being set up for ControlPort access
851  * \param functionbase The name of the function that we'll access over ControlPort
852  * \param obj A pointer to the object itself
853  * \param function A function pointer to the real function accessed when called
854  * something like: &[block class]\::set_[variable]()
855  * \param min Expected minimum value the parameter can hold
856  * \param max Expected maximum value the parameter can hold
857  * \param def Expected default value the parameter can hold
858  * \param units_ A string to describe what units to represent the variable with
859  * \param desc_ A string to describing the variable.
860  * \param minpriv_ The required minimum privilege level
861  * \param display_ The display mask
862  */
863  rpcbasic_register_set(const std::string& name,
864  const char* functionbase,
865  T* obj,
866  void (T::*function)(Tto),
867  const pmt::pmt_t& min,
868  const pmt::pmt_t& max,
869  const pmt::pmt_t& def,
870  const char* units_ = "",
871  const char* desc_ = "",
872  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
873  DisplayType display_ = DISPNULL)
874  {
875  d_min = min;
876  d_max = max;
877  d_def = def;
878  d_units = units_;
879  d_desc = desc_;
880  d_minpriv = minpriv_;
881  d_display = display_;
882  d_object = obj;
883 #ifdef GR_RPCSERVER_ENABLED
885  new rpcbasic_extractor<T, Tto>(d_object, function),
886  minpriv_,
887  std::string(units_),
888  display_,
889  std::string(desc_),
890  min,
891  max,
892  def);
893  std::ostringstream oss(std::ostringstream::out);
894  oss << name << "::" << functionbase;
895  d_id = oss.str();
896  // std::cerr << "REGISTERING SET: " << d_id << " " << desc_ << std::endl;
897  rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor);
898 #endif
899  }
900 
902  {
903 #ifdef GR_RPCSERVER_ENABLED
905 #endif
906  }
907 
908 
909  pmt::pmt_t min() const { return d_min; }
910  pmt::pmt_t max() const { return d_max; }
911  pmt::pmt_t def() const { return d_def; }
912  std::string units() const { return d_units; }
913  std::string description() const { return d_desc; }
914  priv_lvl_t privilege_level() const { return d_minpriv; }
915  DisplayType default_display() const { return d_display; }
916 
917  void set_min(pmt::pmt_t p) { d_min = p; }
918  void set_max(pmt::pmt_t p) { d_max = p; }
919  void set_def(pmt::pmt_t p) { d_def = p; }
920  void units(std::string u) { d_units = u; }
921  void description(std::string d) { d_desc = d; }
922  void privilege_level(priv_lvl_t p) { d_minpriv = p; }
923  void default_display(DisplayType d) { d_display = d; }
924 
925 private:
926  std::string d_id;
927  pmt::pmt_t d_min, d_max, d_def;
928  std::string d_units, d_desc;
929  priv_lvl_t d_minpriv;
930  DisplayType d_display;
931  T* d_object;
932 };
933 
934 
935 /*********************************************************************
936  * RPC Register Trigger Classes
937  ********************************************************************/
938 
939 /*!
940  * \brief Registers a 'trigger' function to trigger an action over
941  * ControlPort.
942  *
943  * \details
944  *
945  * This class allows us to set up triggered events or function calls
946  * over ControlPort. When used from a ControlPort client, the \p
947  * function established here will be activated. Generally, this is
948  * meant to enable some kind of trigger or action that a block or
949  * object will perform, such as a reset, start, stop, etc.
950  *
951  * Simpler than the rpcbasic_register_set class, the constructor here
952  * only takes a few parameters, mostly because there is not actual
953  * variable associated with these function calls. It takes in the
954  * information to set up the pointer to the object that has the \p
955  * function, a ControlPort name (\p functionbase) for the triggered
956  * action, a description (\p desc_), and a privilege level (\p
957  * minpriv_).
958  */
959 template <typename T>
961  /*!
962  * \brief Adds the ability to trigger a function over ControlPort.
963  *
964  * \details
965  *
966  * This constructor is specifically for gr::block's to use to add
967  * trigger functions to ControlPort. Generally meant to be used
968  * in gr::block::setup_rpc.
969  *
970  * Uses the block's alias to create the ControlPort interface. This
971  * alias is cross-referenced by the global_block_registry (static
972  * variable of type gr::block_registry) to get the pointer to the
973  * block.
974  *
975  * \param block_alias Block's alias; use alias() to get it from the block.
976  * \param functionbase The name of the function that we'll access over ControlPort
977  * \param function A function pointer to the real function accessed when called
978  * something like: &[block class]\::set_[variable]
979  * \param desc_ A string to describing the variable.
980  * \param minpriv_ The required minimum privilege level
981  */
982  rpcbasic_register_trigger(const std::string& block_alias,
983  const char* functionbase,
984  void (T::*function)(),
985  const char* desc_ = "",
986  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN)
987  {
988  d_desc = desc_;
989  d_minpriv = minpriv_;
990  d_object = dynamic_cast<T*>(
991  global_block_registry.block_lookup(pmt::intern(block_alias)).get());
992 #ifdef GR_RPCSERVER_ENABLED
994  new rpcbasic_extractor<T, void>(d_object, function),
995  minpriv_,
996  std::string(desc_));
997  std::ostringstream oss(std::ostringstream::out);
998  oss << block_alias << "::" << functionbase;
999  d_id = oss.str();
1000  // std::cerr << "REGISTERING TRIGGER: " << d_id << " " << desc_ << std::endl;
1001  rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor);
1002 #endif
1003  }
1004 
1005  /*!
1006  * \brief Adds the ability to trigger a function over ControlPort.
1007  *
1008  * \details
1009  *
1010  * Allows us to add non gr::block related objects to
1011  * ControlPort. Instead of using the block's alias, we give it a \p
1012  * name and the actual pointer to the object as \p obj. We just need
1013  * to make sure that the pointer to this object is always valid.
1014  *
1015  * \param name Name of the object being set up for ControlPort access
1016  * \param functionbase The name of the function that we'll access over ControlPort
1017  * \param obj A pointer to the object itself
1018  * \param function A function pointer to the real function accessed when called
1019  * something like: &[block class]\::set_[variable]
1020  * \param desc_ A string to describing the variable.
1021  * \param minpriv_ The required minimum privilege level
1022  */
1023  rpcbasic_register_trigger(const std::string& name,
1024  const char* functionbase,
1025  T* obj,
1026  void (T::*function)(),
1027  const char* desc_ = "",
1028  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN)
1029  {
1030  d_desc = desc_;
1031  d_minpriv = minpriv_;
1032  d_object = obj;
1033 #ifdef GR_RPCSERVER_ENABLED
1035  new rpcbasic_extractor<T, void>(d_object, function),
1036  minpriv_,
1037  std::string(desc_));
1038  std::ostringstream oss(std::ostringstream::out);
1039  oss << name << "::" << functionbase;
1040  d_id = oss.str();
1041  // std::cerr << "REGISTERING TRIGGER: " << d_id << " " << desc_ << std::endl;
1042  rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor);
1043 #endif
1044  }
1045 
1047  {
1048 #ifdef GR_RPCSERVER_ENABLED
1050 #endif
1051  }
1052 
1053 
1054  std::string description() const { return d_desc; }
1055  priv_lvl_t privilege_level() const { return d_minpriv; }
1056 
1057  void description(std::string d) { d_desc = d; }
1058  void privilege_level(priv_lvl_t p) { d_minpriv = p; }
1059 
1060 private:
1061  std::string d_id;
1062  std::string d_desc;
1063  priv_lvl_t d_minpriv;
1064  T* d_object;
1065 };
1066 
1067 
1068 /*********************************************************************
1069  * RPC Register Get Classes
1070  ********************************************************************/
1071 
1072 /*!
1073  * \brief Registers a 'get' function to get a parameter over
1074  * ControlPort.
1075  *
1076  * \details
1077  *
1078  * This class allows us to remotely get a value or parameter of the
1079  * block over ControlPort. The get occurs by calling a getter accessor
1080  * function of the class, usually [variable](), which is passed in
1081  * as \p function.
1082  *
1083  * We can set the (expected) minimum (\p min), maximum (\p max), and
1084  * default (\p def) of the variables we will get. These values are not
1085  * enforced, however, but can be useful for setting up graphs and
1086  * other ways of bounding the data.
1087  *
1088  * This class also allows us to provide information to the user about
1089  * the variable, such as an appropriate unit (\p units_) as well as a
1090  * description (\p desc_) about what the variable does.
1091  *
1092  * The privilege (\p minpriv_) level is the minimum privilege level a
1093  * remote must identify with to be able to call this function.
1094  *
1095  * We also provide display hints (\p display_), which can be used by
1096  * the ControlPort client application to know how to best display or
1097  * even print the data. This is a mask of options for variables set in
1098  * rpccallbackregister_base.h. The mask is defined by one of the
1099  * "DisplayType Plotting Types" and or'd with any of the "DisplayType
1100  * Options" features. See "Display Options" in \ref page_ctrlport for
1101  * details.
1102  */
1103 template <typename T, typename Tfrom>
1105 {
1106 public:
1107  /*!
1108  * \brief Adds the ability to get the variable over ControlPort.
1109  *
1110  * \details
1111  *
1112  * This constructor is specifically for gr::block's to use to add
1113  * gettable variables to ControlPort. Generally meant to be used
1114  * in gr::block::setup_rpc.
1115  *
1116  * Uses the block's alias to create the ControlPort interface. This
1117  * alias is cross-referenced by the global_block_registry (static
1118  * variable of type gr::block_registry) to get the pointer to the
1119  * block.
1120  *
1121  * \param block_alias Block's alias; use alias() to get it from the block.
1122  * \param functionbase The name of the function that we'll access over ControlPort
1123  * \param function A function pointer to the real function accessed when called
1124  * something like: &[block class]\::[variable]()
1125  * \param min Expected minimum value the parameter can hold
1126  * \param max Expected maximum value the parameter can hold
1127  * \param def Expected default value the parameter can hold
1128  * \param units_ A string to describe what units to represent the variable with
1129  * \param desc_ A string to describing the variable.
1130  * \param minpriv_ The required minimum privilege level
1131  * \param display_ The display mask
1132  */
1133  rpcbasic_register_get(const std::string& block_alias,
1134  const char* functionbase,
1135  Tfrom (T::*function)(),
1136  const pmt::pmt_t& min,
1137  const pmt::pmt_t& max,
1138  const pmt::pmt_t& def,
1139  const char* units_ = "",
1140  const char* desc_ = "",
1141  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
1142  DisplayType display_ = DISPNULL)
1143  {
1144  d_min = min;
1145  d_max = max;
1146  d_def = def;
1147  d_units = units_;
1148  d_desc = desc_;
1149  d_minpriv = minpriv_;
1150  d_display = display_;
1151  d_object = dynamic_cast<T*>(
1152  global_block_registry.block_lookup(pmt::intern(block_alias)).get());
1153 #ifdef GR_RPCSERVER_ENABLED
1155  new rpcbasic_inserter<T, Tfrom>(d_object, function),
1156  minpriv_,
1157  std::string(units_),
1158  display_,
1159  std::string(desc_),
1160  min,
1161  max,
1162  def);
1163  std::ostringstream oss(std::ostringstream::out);
1164  oss << block_alias << "::" << functionbase;
1165  d_id = oss.str();
1166  // std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl;
1167  rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
1168 #endif
1169  }
1170 
1171 
1172  /*!
1173  * \brief Same as rpcbasic_register_get::rpcbasic_register_get that allows using
1174  * '[variable]() const' getter functions.
1175  */
1176  rpcbasic_register_get(const std::string& block_alias,
1177  const char* functionbase,
1178  Tfrom (T::*function)() const,
1179  const pmt::pmt_t& min,
1180  const pmt::pmt_t& max,
1181  const pmt::pmt_t& def,
1182  const char* units_ = "",
1183  const char* desc_ = "",
1184  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
1185  DisplayType display_ = DISPNULL)
1186  {
1187  d_min = min;
1188  d_max = max;
1189  d_def = def;
1190  d_units = units_;
1191  d_desc = desc_;
1192  d_minpriv = minpriv_;
1193  d_display = display_;
1194  d_object = dynamic_cast<T*>(
1195  global_block_registry.block_lookup(pmt::intern(block_alias)).get());
1196 #ifdef GR_RPCSERVER_ENABLED
1198  new rpcbasic_inserter<T, Tfrom>(d_object, (Tfrom(T::*)())function),
1199  minpriv_,
1200  std::string(units_),
1201  display_,
1202  std::string(desc_),
1203  min,
1204  max,
1205  def);
1206  std::ostringstream oss(std::ostringstream::out);
1207  oss << block_alias << "::" << functionbase;
1208  d_id = oss.str();
1209  // std::cerr << "REGISTERING GET CONST: " << d_id << " " << desc_ << " " <<
1210  // display_ << std::endl;
1211  rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
1212 #endif
1213  }
1214 
1215 
1216  /*!
1217  * \brief Adds the ability to get the variable over ControlPort.
1218  *
1219  * \details
1220  *
1221  * Allows us to add non gr::block related objects to
1222  * ControlPort. Instead of using the block's alias, we give it a \p
1223  * name and the actual pointer to the object as \p obj. We just need
1224  * to make sure that the pointer to this object is always valid.
1225  *
1226  * \param name Name of the object being set up for ControlPort access
1227  * \param functionbase The name of the function that we'll access over ControlPort
1228  * \param obj A pointer to the object itself
1229  * \param function A function pointer to the real function accessed when called
1230  * something like: &[block class]\::set_[variable]()
1231  * \param min Expected minimum value the parameter can hold
1232  * \param max Expected maximum value the parameter can hold
1233  * \param def Expected default value the parameter can hold
1234  * \param units_ A string to describe what units to represent the variable with
1235  * \param desc_ A string to describing the variable.
1236  * \param minpriv_ The required minimum privilege level
1237  * \param display_ The display mask
1238  */
1239  rpcbasic_register_get(const std::string& name,
1240  const char* functionbase,
1241  T* obj,
1242  Tfrom (T::*function)(),
1243  const pmt::pmt_t& min,
1244  const pmt::pmt_t& max,
1245  const pmt::pmt_t& def,
1246  const char* units_ = "",
1247  const char* desc_ = "",
1248  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
1249  DisplayType display_ = DISPNULL)
1250  {
1251  d_min = min;
1252  d_max = max;
1253  d_def = def;
1254  d_units = units_;
1255  d_desc = desc_;
1256  d_minpriv = minpriv_;
1257  d_display = display_;
1258  d_object = obj;
1259 #ifdef GR_RPCSERVER_ENABLED
1261  new rpcbasic_inserter<T, Tfrom>(d_object, function),
1262  minpriv_,
1263  std::string(units_),
1264  display_,
1265  std::string(desc_),
1266  min,
1267  max,
1268  def);
1269  std::ostringstream oss(std::ostringstream::out);
1270  oss << name << "::" << functionbase;
1271  d_id = oss.str();
1272  // std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl;
1273  rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
1274 #endif
1275  }
1276 
1277 
1278  /*!
1279  * \brief Same as above that allows using '[variable]() const'
1280  * getter functions.
1281  */
1282  rpcbasic_register_get(const std::string& name,
1283  const char* functionbase,
1284  T* obj,
1285  Tfrom (T::*function)() const,
1286  const pmt::pmt_t& min,
1287  const pmt::pmt_t& max,
1288  const pmt::pmt_t& def,
1289  const char* units_ = "",
1290  const char* desc_ = "",
1291  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
1292  DisplayType display_ = DISPNULL)
1293  {
1294  d_min = min;
1295  d_max = max;
1296  d_def = def;
1297  d_units = units_;
1298  d_desc = desc_;
1299  d_minpriv = minpriv_;
1300  d_display = display_;
1301  d_object = obj;
1302 #ifdef GR_RPCSERVER_ENABLED
1304  new rpcbasic_inserter<T, Tfrom>(d_object, (Tfrom(T::*)())function),
1305  minpriv_,
1306  std::string(units_),
1307  display_,
1308  std::string(desc_),
1309  min,
1310  max,
1311  def);
1312  std::ostringstream oss(std::ostringstream::out);
1313  oss << name << "::" << functionbase;
1314  d_id = oss.str();
1315  // std::cerr << "REGISTERING GET CONST: " << d_id << " " << desc_ << " " <<
1316  // display_ << std::endl;
1317  rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
1318 #endif
1319  }
1320 
1322  {
1323 #ifdef GR_RPCSERVER_ENABLED
1325 #endif
1326  }
1327 
1328  pmt::pmt_t min() const { return d_min; }
1329  pmt::pmt_t max() const { return d_max; }
1330  pmt::pmt_t def() const { return d_def; }
1331  std::string units() const { return d_units; }
1332  std::string description() const { return d_desc; }
1333  priv_lvl_t privilege_level() const { return d_minpriv; }
1334  DisplayType default_display() const { return d_display; }
1335 
1336  void set_min(pmt::pmt_t p) { d_min = p; }
1337  void set_max(pmt::pmt_t p) { d_max = p; }
1338  void set_def(pmt::pmt_t p) { d_def = p; }
1339  void units(std::string u) { d_units = u; }
1340  void description(std::string d) { d_desc = d; }
1341  void privilege_level(priv_lvl_t p) { d_minpriv = p; }
1342  void default_display(DisplayType d) { d_display = d; }
1343 
1344 private:
1345  std::string d_id;
1346  pmt::pmt_t d_min, d_max, d_def;
1347  std::string d_units, d_desc;
1348  priv_lvl_t d_minpriv;
1349  DisplayType d_display;
1350  T* d_object;
1351 };
1352 
1353 
1354 /*********************************************************************
1355  * RPC Register Variable Classes
1356  ********************************************************************/
1357 
1358 /*!
1359  * \brief Registers a read-only function to get a parameter over ControlPort.
1360  *
1361  * \details
1362  *
1363  * This class allows us to remotely get a value or parameter of the
1364  * block over ControlPort. Unlike the rpcbasic_register_get class,
1365  * this version is passed the variable directly and establishes a
1366  * getter for us, so there is no need to have a getter function
1367  * already in the object.
1368  *
1369  * This version is for read-only get access.
1370  *
1371  * We can set the (expected) minimum (\p min), maximum (\p max), and
1372  * default (\p def) of the variables we will get. These values are not
1373  * enforced, however, but can be useful for setting up graphs and
1374  * other ways of bounding the data.
1375  *
1376  * This class also allows us to provide information to the user about
1377  * the variable, such as an appropriate unit (\p units_) as well as a
1378  * description (\p desc_) about what the variable does.
1379  *
1380  * The privilege (\p minpriv_) level is the minimum privilege level a
1381  * remote must identify with to be able to call this function.
1382  *
1383  * We also provide display hints (\p display_), which can be used by
1384  * the ControlPort client application to know how to best display or
1385  * even print the data. This is a mask of options for variables set in
1386  * rpccallbackregister_base.h. The mask is defined by one of the
1387  * "DisplayType Plotting Types" and or'd with any of the "DisplayType
1388  * Options" features. See "Display Options" in \ref page_ctrlport for
1389  * details.
1390  */
1391 template <typename Tfrom>
1393 {
1394 protected:
1396  Tfrom* d_variable;
1397  Tfrom get() { return *d_variable; }
1398 
1399 public:
1400  void setptr(Tfrom* _variable)
1401  {
1403  }
1404 
1405  /*! Empty constructor which should never be called but needs to
1406  * exist for ues in varous STL data structures
1407  */
1409  : d_rpc_reg("FAIL",
1410  "FAIL",
1411  this,
1413  pmt::PMT_NIL,
1414  pmt::PMT_NIL,
1415  pmt::PMT_NIL,
1416  DISPNULL,
1417  "FAIL",
1418  "FAIL",
1419  RPC_PRIVLVL_MIN),
1420  d_variable(NULL)
1421  {
1422  throw std::runtime_error(
1423  "ERROR: rpcbasic_register_variable called with no args. If this happens, "
1424  "someone has tried to use rpcbasic_register_variable incorrectly.");
1425  };
1426 
1427  /*!
1428  * \brief Adds the ability to get the variable over ControlPort.
1429  *
1430  * \details
1431  *
1432  * Creates a new getter accessor function to read \p variable.
1433  *
1434  * \param namebase Name of the object being set up for ControlPort access
1435  * \param functionbase The name of the function that we'll access over ControlPort
1436  * \param variable A pointer to the variable, possibly as a member of a class
1437  * \param min Expected minimum value the parameter can hold
1438  * \param max Expected maximum value the parameter can hold
1439  * \param def Expected default value the parameter can hold
1440  * \param units_ A string to describe what units to represent the variable with
1441  * \param desc_ A string to describing the variable.
1442  * \param minpriv_ The required minimum privilege level
1443  * \param display_ The display mask
1444  */
1445  rpcbasic_register_variable(const std::string& namebase,
1446  const char* functionbase,
1447  Tfrom* variable,
1448  const pmt::pmt_t& min,
1449  const pmt::pmt_t& max,
1450  const pmt::pmt_t& def,
1451  const char* units_ = "",
1452  const char* desc_ = "",
1453  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
1454  DisplayType display_ = DISPNULL)
1455  : d_rpc_reg(namebase,
1456  functionbase,
1457  this,
1459  min,
1460  max,
1461  def,
1462  units_,
1463  desc_,
1464  minpriv_,
1465  display_),
1466  d_variable(variable)
1467  {
1468  // std::cerr << "REGISTERING VAR: " << " " << desc_ << std::endl;
1469  }
1470 };
1471 
1472 
1473 /*!
1474  * \brief Registers a read/write function to get and set a parameter
1475  * over ControlPort.
1476  *
1477  * \details
1478  *
1479  * This class allows us to remotely get and/or set a value or
1480  * parameter of the block over ControlPort. Unlike the
1481  * rpcbasic_register_get class, this version is passed the variable
1482  * directly and establishes a getter for us, so there is no need to
1483  * have a getter function already in the object.
1484  *
1485  * This version establishes both get and set functions and so provides
1486  * read/write access to the variable.
1487  *
1488  * We can set the (expected) minimum (\p min), maximum (\p max), and
1489  * default (\p def) of the variables we will get. These values are not
1490  * enforced, however, but can be useful for setting up graphs and
1491  * other ways of bounding the data.
1492  *
1493  * This class also allows us to provide information to the user about
1494  * the variable, such as an appropriate unit (\p units_) as well as a
1495  * description (\p desc_) about what the variable does.
1496  *
1497  * The privilege (\p minpriv_) level is the minimum privilege level a
1498  * remote must identify with to be able to call this function.
1499  *
1500  * We also provide display hints (\p display_), which can be used by
1501  * the ControlPort client application to know how to best display or
1502  * even print the data. This is a mask of options for variables set in
1503  * rpccallbackregister_base.h. The mask is defined by one of the
1504  * "DisplayType Plotting Types" and or'd with any of the "DisplayType
1505  * Options" features. See "Display Options" in \ref page_ctrlport for
1506  * details.
1507  */
1508 template <typename Tfrom>
1510 {
1511 private:
1513 
1514 public:
1515  /*! Empty constructor which should never be called but needs to
1516  * exist for ues in varous STL data structures.
1517  */
1519  : d_rpc_regset("FAIL",
1520  "FAIL",
1521  this,
1523  pmt::PMT_NIL,
1524  pmt::PMT_NIL,
1525  pmt::PMT_NIL,
1526  DISPNULL,
1527  "FAIL",
1528  "FAIL",
1530  {
1531  throw std::runtime_error(
1532  "ERROR: rpcbasic_register_variable_rw called with no args. if this happens "
1533  "someone used rpcbasic_register_variable_rw incorrectly.\n");
1534  };
1535 
1536  void set(Tfrom _variable)
1537  {
1539  }
1540 
1541  /*!
1542  * \brief Adds the ability to set and get the variable over ControlPort.
1543  *
1544  * \details
1545  *
1546  * Creates new getter and setter accessor functions to read and write \p variable.
1547  *
1548  * \param namebase Name of the object being set up for ControlPort access
1549  * \param functionbase The name of the function that we'll access over ControlPort
1550  * \param variable A pointer to the variable, possibly as a member of a class
1551  * \param min Expected minimum value the parameter can hold
1552  * \param max Expected maximum value the parameter can hold
1553  * \param def Expected default value the parameter can hold
1554  * \param units_ A string to describe what units to represent the variable with
1555  * \param desc_ A string to describing the variable.
1556  * \param minpriv The required minimum privilege level
1557  * \param display_ The display mask
1558  */
1559  rpcbasic_register_variable_rw(const std::string& namebase,
1560  const char* functionbase,
1561  Tfrom* variable,
1562  const pmt::pmt_t& min,
1563  const pmt::pmt_t& max,
1564  const pmt::pmt_t& def,
1565  const char* units_ = "",
1566  const char* desc_ = "",
1567  priv_lvl_t minpriv = RPC_PRIVLVL_MIN,
1568  DisplayType display_ = DISPNULL)
1569  : rpcbasic_register_variable<Tfrom>(
1570  namebase, functionbase, variable, min, max, def, units_, desc_),
1571  d_rpc_regset(namebase,
1572  functionbase,
1573  this,
1575  min,
1576  max,
1577  def,
1578  units_,
1579  desc_,
1580  minpriv,
1581  display_)
1582  {
1583  // no action
1584  }
1585 };
1586 
1587 
1588 /*!
1589  * \brief Registers a message handler function to post a message to a
1590  * block's handler.
1591  */
1592 template <typename T>
1594 {
1595 public:
1596  /*!
1597  * \brief Adds the ability to pass a message over ControlPort.
1598  *
1599  * \details
1600  * This makes any message handler function avialable over
1601  * ControlPort. Since message handlers always take in a single PMT
1602  * message input, this interface provides a very generic way of
1603  * setting values in a block in a flowgraph.
1604  *
1605  * \param block_alias Alias of the block
1606  * \param handler The name of the message port in the block
1607  * \param units_ A string to describe what units to represent the variable with
1608  * \param desc_ A string to describing the variable.
1609  * \param minpriv_ The required minimum privilege level
1610  * \param display_ The display mask
1611  */
1612  rpcbasic_register_handler(const std::string& block_alias,
1613  const char* handler,
1614  const char* units_ = "",
1615  const char* desc_ = "",
1616  priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
1617  DisplayType display_ = DISPNULL)
1618  {
1619  d_units = units_;
1620  d_desc = desc_;
1621  d_minpriv = minpriv_;
1622  d_display = display_;
1623  d_object = dynamic_cast<T*>(
1624  global_block_registry.block_lookup(pmt::intern(block_alias)).get());
1625 #ifdef GR_RPCSERVER_ENABLED
1627  new rpcbasic_handler<T>(d_object, handler),
1628  minpriv_,
1629  std::string(units_),
1630  display_,
1631  std::string(desc_),
1632  0,
1633  0,
1634  0);
1635  std::ostringstream oss(std::ostringstream::out);
1636  oss << block_alias << "::" << handler;
1637  d_id = oss.str();
1638  // std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl;
1639  rpcmanager::get()->i()->registerHandlerCallback(d_id, inserter);
1640 #endif
1641  }
1642 
1644  {
1645 #ifdef GR_RPCSERVER_ENABLED
1647 #endif
1648  }
1649 
1650  std::string units() const { return d_units; }
1651  std::string description() const { return d_desc; }
1652  priv_lvl_t privilege_level() const { return d_minpriv; }
1653  DisplayType default_display() const { return d_display; }
1654 
1655  void units(std::string u) { d_units = u; }
1656  void description(std::string d) { d_desc = d; }
1657  void privilege_level(priv_lvl_t p) { d_minpriv = p; }
1658  void default_display(DisplayType d) { d_display = d; }
1659 
1660 private:
1661  std::string d_id;
1662  std::string d_units, d_desc;
1663  priv_lvl_t d_minpriv;
1664  DisplayType d_display;
1665  T* d_object;
1666 };
1667 
1668 
1669 #endif
Definition: rpcregisterhelpers.h:731
virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback)=0
Definition: rpccallbackregister_base.h:94
~rpcbasic_register_trigger()
Definition: rpcregisterhelpers.h:1046
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:592
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:450
Tfrom get()
Definition: rpcregisterhelpers.h:1397
PMT_API pmt_t from_complex(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
~rpchandler_base()
Definition: rpcregisterhelpers.h:174
rpcbasic_inserter(T *source, std::complex< double >(T::*func)())
Definition: rpcregisterhelpers.h:702
T * _source
Definition: rpcregisterhelpers.h:179
rpcbasic_register_get(const std::string &name, const char *functionbase, T *obj, Tfrom(T::*function)() const, const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Same as above that allows using '[variable]() const' getter functions.
Definition: rpcregisterhelpers.h:1282
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)())
Definition: rpcregisterhelpers.h:471
PMT_API pmt_t init_s32vector(size_t k, const int32_t *data)
Templated parent class for registering a ControlPort Extractor.
Definition: rpcregisterhelpers.h:188
rpcbasic_register_variable()
Definition: rpcregisterhelpers.h:1408
std::string units() const
Definition: rpcregisterhelpers.h:912
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:621
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:911
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1657
void set(Tfrom _variable)
Definition: rpcregisterhelpers.h:1536
PMT_API std::complex< double > to_complex(pmt_t z)
rpcbasic_inserter(T *source, std::vector< int >(T::*func)())
Definition: rpcregisterhelpers.h:529
T * _source
Definition: rpcregisterhelpers.h:125
rpcbasic_register_variable_rw()
Definition: rpcregisterhelpers.h:1518
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:118
std::string units() const
Definition: rpcregisterhelpers.h:1650
rpcbasic_extractor(T *source, void(T::*func)(double))
Definition: rpcregisterhelpers.h:269
float min(float a, float b)
rpcbasic_register_set(const std::string &block_alias, const char *functionbase, void(T::*function)(Tto), const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to set the variable over ControlPort.
Definition: rpcregisterhelpers.h:802
static purpose_t msg
Definition: source_logger.h:39
rpcbasic_extractor(T *source, void(T::*func)(float))
Definition: rpcregisterhelpers.h:289
rpcbasic_inserter(T *source, std::vector< short >(T::*func)() const)
Definition: rpcregisterhelpers.h:494
PMT_API pmt_t init_u8vector(size_t k, const uint8_t *data)
Templated parent class for registering a ControlPort Extractor.
Definition: rpcregisterhelpers.h:92
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:355
rpcbasic_inserter(T *source, std::complex< float >(T::*func)())
Definition: rpcregisterhelpers.h:673
rpcbasic_extractor(T *source, void(T::*func)())
Definition: rpcregisterhelpers.h:210
Tfrom * d_variable
Definition: rpcregisterhelpers.h:1396
void units(std::string u)
Definition: rpcregisterhelpers.h:1655
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1653
Registers a read/write function to get and set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1509
Base class for registering a ControlPort Handler. Acts as a message acceptor.
Definition: rpcregisterhelpers.h:167
rpcbasic_handler(T *source, const char *handler)
Definition: rpcregisterhelpers.h:191
rpcbasic_inserter(T *source, std::vector< int64_t >(T::*func)() const)
Definition: rpcregisterhelpers.h:551
Base class for registering a ControlPort function.
Definition: rpcregisterhelpers.h:721
rpcbasic_inserter(T *source, std::vector< short >(T::*func)())
Definition: rpcregisterhelpers.h:500
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:419
std::string description() const
Definition: rpcregisterhelpers.h:1651
PMT_API pmt_t init_s8vector(size_t k, const int8_t *data)
void description(std::string d)
Definition: rpcregisterhelpers.h:1057
Virtual base class that produces messages.
Definition: msg_producer.h:35
T * _source
Definition: rpcregisterhelpers.h:66
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:679
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)())
Definition: rpcregisterhelpers.h:644
void(T::* _func)(Tto)
Definition: rpcregisterhelpers.h:67
std::string description() const
Definition: rpcregisterhelpers.h:913
priv_lvl_t
Definition: rpccallbackregister_base.h:46
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:923
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:563
Registers a message handler function to post a message to a block's handler.
Definition: rpcregisterhelpers.h:1593
void description(std::string d)
Definition: rpcregisterhelpers.h:1656
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1341
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:255
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:910
void units(std::string u)
Definition: rpcregisterhelpers.h:1339
Base class for registering a ControlPort Inserter. Produces a message.
Definition: rpcregisterhelpers.h:112
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:275
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:59
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:235
PMT_API pmt_t intern(const std::string &s)
Alias for pmt_string_to_symbol.
rpcbasic_extractor(T *source, void(T::*func)(std::string))
Definition: rpcregisterhelpers.h:413
virtual void unregisterConfigureCallback(const std::string &id)=0
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:477
rpcbasic_extractor(T *source, void(T::*func)(Tto))
Definition: rpcregisterhelpers.h:95
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:650
rpcbasic_extractor(T *source, void(T::*func)(char))
Definition: rpcregisterhelpers.h:229
PMT_API const std::string symbol_to_string(const pmt_t &sym)
static int count
Definition: rpcregisterhelpers.h:725
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1337
PMT_API bool to_bool(pmt_t val)
Return true if val is pmt::True, return false when val is pmt::PMT_F,.
rpcbasic_inserter(T *source, uint64_t(T::*func)())
Definition: rpcregisterhelpers.h:444
Definition: rpccallbackregister_base.h:46
Tfrom(T::* _func)()
Definition: rpcregisterhelpers.h:126
rpcbasic_extractor(T *source, void(T::*func)(long))
Definition: rpcregisterhelpers.h:309
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:150
Registers a 'get' function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1104
virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback)=0
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:922
Templated parent class for registering a ControlPort Inserter.
Definition: rpcregisterhelpers.h:135
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:535
PMT_API pmt_t from_uint64(uint64_t x)
Return the pmt value that represents the uint64 x.
rpcbasic_register_variable_rw(const std::string &namebase, const char *functionbase, Tfrom *variable, const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to set and get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1559
rpcbasic_register_set(const std::string &name, const char *functionbase, T *obj, void(T::*function)(Tto), const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to set the variable over ControlPort.
Definition: rpcregisterhelpers.h:863
virtual ~rpcbasic_base()
Definition: rpcregisterhelpers.h:735
rpcbasic_register_handler(const std::string &block_alias, const char *handler, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to pass a message over ControlPort.
Definition: rpcregisterhelpers.h:1612
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1338
~rpcextractor_base()
Definition: rpcregisterhelpers.h:75
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1333
rpchandler_base(T *source, const char *handler)
Definition: rpcregisterhelpers.h:170
rpcbasic_extractor(T *source, void(T::*func)(std::complex< double >))
Definition: rpcregisterhelpers.h:392
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:295
std::string description() const
Definition: rpcregisterhelpers.h:1054
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1652
virtual void unregisterQueryCallback(const std::string &id)=0
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1055
rpcbasic_register_variable(const std::string &namebase, const char *functionbase, Tfrom *variable, const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1445
rpcinserter_base(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:115
rpcbasic_register_get(const std::string &name, const char *functionbase, T *obj, Tfrom(T::*function)(), const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1239
Base class for registering a ControlPort Extractor. Acts as a message acceptor.
Definition: rpcregisterhelpers.h:50
T * _source
Definition: rpcregisterhelpers.h:84
rpcbasic_extractor(T *source, void(T::*func)(short))
Definition: rpcregisterhelpers.h:249
rpcbasic_inserter(T *source, std::vector< int64_t >(T::*func)())
Definition: rpcregisterhelpers.h:557
rpcbasic_register_get(const std::string &block_alias, const char *functionbase, Tfrom(T::*function)(), const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1133
Virtual base class that accepts messages.
Definition: messages/msg_accepter.h:35
rpcbasic_inserter(T *source, uint64_t(T::*func)() const)
Definition: rpcregisterhelpers.h:438
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1658
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:918
PMT_API long to_long(pmt_t x)
Convert pmt to long if possible.
~rpcextractor_base()
Definition: rpcregisterhelpers.h:57
virtual rpcserver_base * i()=0
rpcextractor_base(T *source, void(T::*func)(Tto))
Definition: rpcregisterhelpers.h:53
PMT_API double to_double(pmt_t x)
Convert pmt to double if possible.
void setptr(Tfrom *_variable)
Definition: rpcregisterhelpers.h:1400
virtual void unregisterHandlerCallback(const std::string &id)=0
static rpcserver_booter_base * get()
PMT_API pmt_t init_s64vector(size_t k, const int64_t *data)
rpcbasic_extractor(T *source, void(T::*func)(std::complex< float >))
Definition: rpcregisterhelpers.h:370
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:1329
#define PMT_NIL
Definition: pmt.h:103
rpcbasic_inserter(T *source, std::vector< float >(T::*func)())
Definition: rpcregisterhelpers.h:615
~rpcbasic_register_get()
Definition: rpcregisterhelpers.h:1321
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:1328
rpcbasic_inserter(T *source, std::vector< int >(T::*func)() const)
Definition: rpcregisterhelpers.h:523
Registers a 'trigger' function to trigger an action over ControlPort.
Definition: rpcregisterhelpers.h:960
Registers a read-only function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1392
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:914
const uint32_t DISPNULL
DisplayType Plotting types.
Definition: rpccallbackregister_base.h:32
rpcbasic_inserter(T *source, std::vector< float >(T::*func)() const)
Definition: rpcregisterhelpers.h:609
rpcextractor_base(T *source, void(T::*func)())
Definition: rpcregisterhelpers.h:74
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:919
PMT_API pmt_t init_f32vector(size_t k, const float *data)
DisplayType default_display() const
Definition: rpcregisterhelpers.h:915
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:1330
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)() const)
Definition: rpcregisterhelpers.h:638
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:909
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:335
const char * _handler
Definition: rpcregisterhelpers.h:180
rpcbasic_register_get< rpcbasic_register_variable< Tfrom >, Tfrom > d_rpc_reg
Definition: rpcregisterhelpers.h:1395
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:77
Specialized extractor class to make calls to functions that do not take data (enable, reset, start, etc.).
Definition: rpcregisterhelpers.h:207
virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback)=0
rpcinserter_base()
Definition: rpcregisterhelpers.h:116
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:708
PMT_API pmt_t init_c32vector(size_t k, const std::complex< float > *data)
std::string units() const
Definition: rpcregisterhelpers.h:1331
GR_RUNTIME_API gr::block_registry global_block_registry
rpcbasic_inserter(T *source, std::complex< float >(T::*func)() const)
Definition: rpcregisterhelpers.h:667
rpcbasic_register_get(const std::string &block_alias, const char *functionbase, Tfrom(T::*function)() const, const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Same as rpcbasic_register_get::rpcbasic_register_get that allows using '[variable]() const' getter fu...
Definition: rpcregisterhelpers.h:1176
rpcbasic_inserter(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:144
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:917
rpcbasic_base()
Definition: rpcregisterhelpers.h:734
std::string description() const
Definition: rpcregisterhelpers.h:1332
rpcbasic_register_trigger(const std::string &name, const char *functionbase, T *obj, void(T::*function)(), const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN)
Adds the ability to trigger a function over ControlPort.
Definition: rpcregisterhelpers.h:1023
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:315
void units(std::string u)
Definition: rpcregisterhelpers.h:920
~rpcbasic_register_set()
Definition: rpcregisterhelpers.h:901
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1342
rpcbasic_inserter(T *source, std::complex< double >(T::*func)() const)
Definition: rpcregisterhelpers.h:696
void description(std::string d)
Definition: rpcregisterhelpers.h:921
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
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1336
rpcbasic_register_trigger(const std::string &block_alias, const char *functionbase, void(T::*function)(), const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN)
Adds the ability to trigger a function over ControlPort.
Definition: rpcregisterhelpers.h:982
rpc_register_base()
Definition: rpcregisterhelpers.h:722
rpcbasic_inserter(T *source, std::vector< std::complex< float > >(T::*func)() const)
Definition: rpcregisterhelpers.h:580
~rpcbasic_register_handler()
Definition: rpcregisterhelpers.h:1643
PMT_API pmt_t init_s16vector(size_t k, const int16_t *data)
rpcbasic_extractor(T *source, void(T::*func)(int))
Definition: rpcregisterhelpers.h:329
rpcbasic_inserter(T *source, Tfrom(T::*func)() const)
Definition: rpcregisterhelpers.h:138
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:376
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:176
basic_block_sptr block_lookup(pmt::pmt_t symbol)
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:216
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)() const)
Definition: rpcregisterhelpers.h:465
void description(std::string d)
Definition: rpcregisterhelpers.h:1340
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:506
static pmt_t mp(const std::string &s)
Make pmt symbol.
Definition: pmt_sugar.h:35
rpcbasic_extractor(T *source, void(T::*func)(bool))
Definition: rpcregisterhelpers.h:349
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1058
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1334
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:398
rpcbasic_inserter(T *source, std::vector< std::complex< float > >(T::*func)())
Definition: rpcregisterhelpers.h:586
uint32_t DisplayType
Definition: rpccallbackregister_base.h:29
Registers a 'set' function to set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:775