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