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