MIRA
ReflectorInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_REFLECTORINTERFACE_H_
48 #define _MIRA_REFLECTORINTERFACE_H_
49 
50 #include <string>
51 #include <unordered_map>
52 
53 #ifndef Q_MOC_RUN
54 #include <boost/preprocessor/repetition.hpp>
55 #include <boost/mpl/bool.hpp>
56 #include <boost/type_traits/integral_constant.hpp>
57 #endif
58 
59 #include <platform/Environment.h>
60 #include <platform/Typename.h>
61 
62 #include <rpc/RPCMacros.h>
66 
67 namespace mira {
68 
70 
71 namespace serialization {
72  typedef uint8 VersionType;
73  typedef std::unordered_map<Typename, VersionType> ClassVersionMap;
74 
81 }
82 
110 template <typename Derived>
112 {
113 public:
114  struct Tag {};
115 
121  typedef boost::mpl::bool_<true> isReadOnly;
122 
128  typedef boost::mpl::bool_<true> useHumanReadableIDs;
129 
148  typedef boost::mpl::bool_<false> requireReflectBarriers;
149 
179  struct ReflectState {};
180 
181 public:
193 
195 
241  template <typename T>
242  VersionType version(VersionType version, const T* caller = NULL)
243  {
244  return version;
245  }
246 
248  MIRA_DEPRECATED("Please call as version<MyType>(v) or version(v, this)",
250 
275  template <typename T>
277  VersionType minVersion, const T* caller = NULL) { return version; }
278 
280  MIRA_DEPRECATED("Please call as requireVersion<MyType>(v, minV) or requireVersion(v, minV, this)",
282 
287  template <typename T>
288  void requireVersion(VersionType version, const T* caller = NULL) {}
289 
291  MIRA_DEPRECATED("Please call as requireVersion<MyType>(v) or requireVersion(v, this)",
293 
295 
328  void desireClassVersions(const ClassVersionMap& versions) {}
329 
331 
336  template <typename T>
338  {
339  return version;
340  }
341 
346  template <typename T>
348  AcceptDesiredVersion, const T* caller = NULL) { return version; }
349 
354  template <typename T>
355  void requireVersion(VersionType version, AcceptDesiredVersion, const T* caller = NULL) {}
356 
358 
364 
374  template<typename T>
375  void member(const char* name, T& member, const char* comment,
377 
383  template<typename T>
384  void member(const char* name, const std::string& id, T& member,
385  const char* comment, ReflectCtrlFlags flags = REFLECT_CTRLFLAG_NONE) {}
386 
391  template<typename T>
392  void member(const char* name, const T& member, Setter<T> setter,
393  const char* comment, ReflectCtrlFlags flags = REFLECT_CTRLFLAG_NONE) {}
394 
401  template<typename T>
402  void member(const char* name, Getter<T> getter, Setter<T> setter,
403  const char* comment, ReflectCtrlFlags flags = REFLECT_CTRLFLAG_NONE) {}
404 
405 
406  // with default value
407 
413  template<typename T, typename U>
414  void member(const char* name, T& member, const char* comment,
415  const U& defaultValue, ReflectCtrlFlags flags = REFLECT_CTRLFLAG_NONE) {}
416 
422  template<typename T, typename U>
423  void member(const char* name, const T& member, Setter<T> setter,
424  const char* comment, const U& defaultValue,
426 
432  template<typename T, typename U>
433  void member(const char* name, Getter<T> getter, Setter<T> setter,
434  const char* comment, const U& defaultValue,
436 
437  // Properties
438 
444  template<typename T>
445  void property(const char* name, T& member, const char* comment,
446  PropertyHint&& hint = PropertyHint(),
448 
454  template<typename T>
455  void property(const char* name, const std::string& id, T& member,
456  const char* comment, PropertyHint&& hint = PropertyHint(),
458 
463  template<typename T>
464  void property(const char* name, const T& member, Setter<T> setter,
465  const char* comment, PropertyHint&& hint = PropertyHint(),
467 
472  template<typename T>
473  void property(const char* name, Getter<T> getter, Setter<T> setter,
474  const char* comment, PropertyHint&& hint = PropertyHint(),
476 
477  // default values
478 
483  template<typename T, typename U>
484  void property(const char* name, T& member, const char* comment,
485  const U& defaultValue, PropertyHint&& hint = PropertyHint(),
487 
492  template<typename T, typename U>
493  void property(const char* name, const T& member, Setter<T> setter,
494  const char* comment, const U& defaultValue,
495  PropertyHint&& hint = PropertyHint(),
497 
502  template<typename T, typename U>
503  void property(const char* name, Getter<T> getter, Setter<T> setter,
504  const char* comment, const U& defaultValue,
505  PropertyHint&& hint = PropertyHint(),
507 
508 
513  template<typename T>
514  void roproperty(const char* name, const T& member,
515  const char* comment, PropertyHint&& hint = PropertyHint(),
517 
522  template<typename T>
523  void roproperty(const char* name, const std::string& id, const T& member,
524  const char* comment, PropertyHint&& hint = PropertyHint(),
526 
531  template<typename T>
532  void roproperty(const char* name, Getter<T> getter, const char* comment,
533  PropertyHint&& hint = PropertyHint(),
535 
541  void itemName(const std::string& name) {}
542 
548  template<typename T>
549  void delegate(T& member,
551 
557  template<typename T>
558  void delegate(const T& member, Setter<T> setter,
560 
566  template<typename T>
569 
571 
574 
581  void interface(const char* name) {}
582 
583  #define RPC_METHODS_MAX_PARAMS 8
584 
585  // method(name, function<...>, comment)
586  #define RPCGEN_METHODS(z,n,_) \
587  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
588  void method(const char* name, R (*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), const char* comment) {} \
589  \
590  template<typename R, typename Class BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
591  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), Class*, const char* comment) {} \
592  \
593  template<typename R, typename Class BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
594  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)) const, Class*, const char* comment) {} \
595  \
596  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
597  void method(const char* name, boost::function<R (BOOST_PP_ENUM_PARAMS_Z(z,n,P))>, const char* comment) {} \
598 
599  BOOST_PP_REPEAT(BOOST_PP_INC(RPC_METHODS_MAX_PARAMS),RPCGEN_METHODS,nil)
600  #undef RPCGEN_METHODS
601 
602  // method(name, function<...>, comment, paramname, paramdescription, ... )
603  #define RPCGEN_METHODS_PARAMDESC(z,n,_) \
604  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
605  void method(const char* name, R (*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), \
606  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_DECL,nil)) {} \
607  \
608  template<typename R, typename Class BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
609  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), Class*, \
610  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_DECL,nil)) {} \
611  \
612  template<typename R, typename Class BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
613  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)) const, Class*, \
614  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_DECL,nil)) {} \
615  \
616  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
617  void method(const char* name, boost::function<R (BOOST_PP_ENUM_PARAMS_Z(z,n,P))>, \
618  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_DECL,nil)) {} \
619 
620  // generate variants with parameter descriptions only for param count > 0
621  BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_INC(RPC_METHODS_MAX_PARAMS),RPCGEN_METHODS_PARAMDESC,nil)
622  #undef RPCGEN_METHODS_PARAMDESC
623 
624  // method(name, function<...>, comment, paramname, paramdescription, paramsamplevalue, ... )
625  #define RPCGEN_METHODS_PARAMDESCSAMPLE(z,n,_) \
626  template<typename R, BOOST_PP_ENUM(n,RPCGEN_CALL_TYPENAME_PARAM_DECL,nil)> \
627  void method(const char* name, R (*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), \
628  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_SAMPLE_DECL,nil)) {} \
629  \
630  template<typename R, typename Class, BOOST_PP_ENUM(n,RPCGEN_CALL_TYPENAME_PARAM_DECL,nil)> \
631  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), Class*, \
632  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_SAMPLE_DECL,nil)) {} \
633  \
634  template<typename R, typename Class, BOOST_PP_ENUM(n,RPCGEN_CALL_TYPENAME_PARAM_DECL,nil)> \
635  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)) const, Class*, \
636  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_SAMPLE_DECL,nil)) {} \
637  \
638  template<typename R, BOOST_PP_ENUM(n,RPCGEN_CALL_TYPENAME_PARAM_DECL,nil)> \
639  void method(const char* name, boost::function<R (BOOST_PP_ENUM_PARAMS_Z(z,n,P))>, \
640  const char* comment, BOOST_PP_ENUM(n,RPCGEN_CALL_NAME_DESC_SAMPLE_DECL,nil)) {} \
641 
642  // generate variants with parameter descriptions only for param count > 0
643  BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_INC(RPC_METHODS_MAX_PARAMS),RPCGEN_METHODS_PARAMDESCSAMPLE,nil)
644  #undef RPCGEN_METHODS_PARAMDESCSAMPLE
645  #undef RPCGEN_METHODS_CONSTCHARPTR_NAME_DESC_SAMPLE
646 
647  // These are essentially catch-all clauses for mismatched parameter numbers/types. We will just ignore
648  // the mismatch here where we don't implement these functions anyway (i.e., subclasses NOT overriding
649  // method() with actual implementation will also not complain about invalid optional parameters).
650  // We could just include ONLY these catch-alls here instead of the 2 sets above, but they have the extra
651  // requirement of compiler support for variadic templates. Keeping them as a separate add-on allows to
652  // make them available conditionally if required (their existence just helps getting more informative
653  // compiler error messages on wrong use).
654  #define RPCGEN_METHODS_WRONG_ARGUMENT_NUMBER(z,n,_) \
655  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P), typename... Args> \
656  void method(const char* name, R (*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), \
657  const char* comment, Args...) {} \
658  \
659  template<typename R, typename Class BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P), typename... Args> \
660  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)), Class* This, \
661  const char* comment, Args...) {} \
662  \
663  template<typename R, typename Class BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P), typename... Args> \
664  void method(const char* name, R (Class::*fn)(BOOST_PP_ENUM_PARAMS_Z(z,n,P)) const, Class* This, \
665  const char* comment, Args...) {} \
666  \
667  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P), typename... Args> \
668  void method(const char* name, boost::function<R (BOOST_PP_ENUM_PARAMS_Z(z,n,P))> fn, \
669  const char* comment, Args...) {} \
670 
671  BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_INC(RPC_METHODS_MAX_PARAMS),RPCGEN_METHODS_WRONG_ARGUMENT_NUMBER,nil)
672  #undef RPCGEN_METHODS_WRONG_ARGUMENT_NUMBER
673 
674  // provide a method that causes an error at compile time if instantiated. Derived classes overriding
675  // method() should call this in their implementation for wrong argument number
676  #define RPCGEN_METHODS_INVALID(z,n,_) \
677  template<typename R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,n,typename P)> \
678  void invalid_method() \
679  { /* force this to fail whenever it is instantiated - but only then! */ \
680  static_assert(sizeof(R*)==0, \
681  "_____________NUMBER OR TYPES OF NAMES/DESCRIPTIONS/SAMPLEVALUES FOR PARAMETERS " \
682  "IN CALL TO Reflector::method() DO NOT MATCH THE PROVIDED FUNCTION'S SIGNATURE. " \
683  "PLEASE PROVIDE const char* NAME AND DESCRIPTION FOR EACH RPC METHOD PARAMETER, " \
684  "OR NAME, DESCRIPTION AND A CORRECTLY TYPED SAMPLE VALUE FOR EACH PARAMETER._____________"); \
685  }
686 
687  BOOST_PP_REPEAT(BOOST_PP_INC(RPC_METHODS_MAX_PARAMS),RPCGEN_METHODS_INVALID,nil)
688  #undef RPCGEN_METHODS_INVALID
689 
690 #ifdef DOXYGEN
691  // this is a fake method to generate a doxygen documentation for the
692  // methods created above
693 
725  void method(const char* name, Method method, const char* comment,
726  const char* paramName, const char* paramDescription, P paramSampleValue, ...);
727 
751  void method(const char* name, Method method, Class* object, const char* comment,
752  const char* paramName, const char* paramDescription, P paramSampleValue, ...);
753 
777  void method(const char* name, Method method, const char* comment,
778  const char* paramName, const char* paramDescription, P paramSampleValue, ...);
779 
780 #endif
781 
783 
788 
791 
794 
796 
835  template <typename Base>
836  void reflectBase(Base& base) {}
837 
838 
845  static bool usesHumanReadableIDs() {
846  return Derived::useHumanReadableIDs::value;
847  }
848 
866  ReflectState preReflect(const char* context = "")
867  {
868  MIRA_THROW(XNotImplemented,
869  typeName<Derived>() << "::requireReflectBarriers == true, but " <<
870  typeName<Derived>() << "::preReflect() not implemented!");
871 
872  return ReflectState();
873  }
874 
876  void postReflect(const ReflectState&)
877  {
878  MIRA_THROW(XNotImplemented,
879  typeName<Derived>() << "::requireReflectBarriers == true, but " <<
880  typeName<Derived>() << "::postReflect() not implemented!");
881  }
882 
883 protected:
884 
885  static int checkForcedVersion(const std::string& variable)
886  {
887  try {
888  std::stringstream ss;
889  ss.str(resolveEnvironmentVariable(variable));
890  int i;
891  ss >> i;
892  return i;
893  }
894  catch(XInvalidConfig&) {}
895 
896  return -1;
897  }
898 };
899 
900 
918 #define MIRA_REFLECT_VERSION(reflector, versionNumber) reflector.version(versionNumber, this)
919 
937 #define MIRA_REFLECT_REQUIRE_VERSION(reflector, versionNumber) reflector.requireVersion(versionNumber, this)
938 
956 #define MIRA_REFLECT_BASE(reflector, BaseClass) reflector.template reflectBase<BaseClass>(*this)
957 
975 #define MIRA_REFLECT_BASE_NONINTRUSIVE(reflector, BaseClass, object) reflector.template reflectBase<BaseClass>(object)
976 
1014 #define MIRA_REFLECT_BASE_IF_VERSION_ATLEAST(reflector, BaseClass, versionvar, minversion) \
1015  if (versionvar < minversion) \
1016  BaseClass::reflect(reflector); \
1017  else \
1018  reflector.template reflectBase<BaseClass>(*this); \
1019 
1020 
1029 #define MIRA_REFLECT_BASE_NONINTRUSIVE_IF_VERSION_ATLEAST(reflector, BaseClass, object, versionvar, minversion) \
1030  if (versionvar < minversion) \
1031  reflect(reflector, (BaseClass&)object); \
1032  else \
1033  reflector.template reflectBase<BaseClass>(object); \
1034 
1035 
1047 #define MIRA_MEMBER_WITH_ID(reflector, name, id, var, ...) \
1048  if(reflector.usesHumanReadableIDs()) \
1049  reflector.member(name, id, var, __VA_ARGS__); \
1050  else \
1051  reflector.member(name, var, __VA_ARGS__);
1052 
1053 #define MIRA_PROPERTY_WITH_ID(reflector, name, id, var, ...) \
1054  if(reflector.usesHumanReadableIDs()) \
1055  reflector.property(name, id, var, __VA_ARGS__); \
1056  else \
1057  reflector.property(name, var, __VA_ARGS__);
1058 
1060 
1061 } // namespace
1062 
1063 #endif
static int checkForcedVersion(const std::string &variable)
Definition: ReflectorInterface.h:885
std::unordered_map< Typename, VersionType > ClassVersionMap
Definition: ReflectorInterface.h:73
void popObjectTrackingStore()
Pop the current object tracking memory from internal stack (restore).
Definition: ReflectorInterface.h:793
#define RPC_METHODS_MAX_PARAMS
Definition: ReflectorInterface.h:583
void property(const char *name, T &member, const char *comment, const U &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as the corresponding member-method, to indicate that the member is a property and can be altered...
Definition: ReflectorInterface.h:484
VersionType version(VersionType version, const T *caller=NULL)
Specifies the current class version and returns the version found in the data stream.
Definition: ReflectorInterface.h:242
void member(const char *name, const T &member, Setter< T > setter, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, with a special setter method for reading the member.
Definition: ReflectorInterface.h:392
serialization::ClassVersionMap ClassVersionMap
Definition: ReflectorInterface.h:294
#define RPCGEN_METHODS(z, n, _)
Definition: ReflectorInterface.h:586
void delegate(Getter< T > getter, Setter< T > setter, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Delegates the serialization/reflection of a member directly to the member.
Definition: ReflectorInterface.h:567
void member(const char *name, const std::string &id, T &member, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, with an extra parameter for specifying the id explicitly if it differs from name...
Definition: ReflectorInterface.h:384
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
void itemName(const std::string &name)
If the currently reflected object is an item within a collection, this allows to specify an explicit ...
Definition: ReflectorInterface.h:541
If &#39;reflect barriers&#39; are used, each separated reflection block within an object has a separate state...
Definition: ReflectorInterface.h:179
boost::mpl::bool_< false > requireReflectBarriers
Specifies whether the Reflector uses so-called &#39;reflect barriers&#39; to allow maintaining separate state...
Definition: ReflectorInterface.h:148
Provides property hints and attributes.
Setter< T > setter(void(*f)(const T &))
Creates a Setter for global or static class methods taking the argument by const reference.
Definition: GetterSetter.h:443
void member(const char *name, Getter< T > getter, Setter< T > setter, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, with a special getter and setter accessing the member.
Definition: ReflectorInterface.h:402
Holds a boost::function object to a special setter function that must meet the signature "void method...
Definition: GetterSetter.h:395
VersionType requireVersion(VersionType version, VersionType minVersion, const T *caller=NULL)
Same as above, but allows to specify a minimum supported version, and throws XIO if the minimum versi...
Definition: ReflectorInterface.h:276
Get compiler and platform independent typenames.
void desireClassVersions(const ClassVersionMap &versions)
Historically, classes have just been defining their current version themselves during serialization (...
Definition: ReflectorInterface.h:328
uint8 VersionType
Definition: ReflectorInterface.h:72
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:81
void roproperty(const char *name, const T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
A property that just reflects a runtime state of the object and can be displayed but not altered...
Definition: ReflectorInterface.h:514
This is the public interface of all reflectors that are able to visit a class&#39; reflect() method...
Definition: ReflectorInterface.h:111
A property hint gives optional instructions to the property editor, i.e.
Definition: PropertyHint.h:82
void roproperty(const char *name, Getter< T > getter, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, with a special getter method for reading the member.
Definition: ReflectorInterface.h:532
#define RPCGEN_METHODS_PARAMDESC(z, n, _)
Definition: ReflectorInterface.h:603
Flags controlling reflector behaviour.
boost::mpl::bool_< true > isReadOnly
Specifies, if the Reflector is read-only (true) or write-only (false).
Definition: ReflectorInterface.h:121
static bool usesHumanReadableIDs()
Returns true, if the concrete derived Reflector supports human readable IDs.
Definition: ReflectorInterface.h:845
MIRA_DEPRECATED("Please call as requireVersion<MyType>(v) or requireVersion(v, this)", VersionType requireVersion(VersionType version))
Deprecated &#39;anonymous&#39; (no type) requireVersion().
Definition: ReflectorInterface.h:291
void pushObjectTrackingStore()
Push the current object tracking memory to an internal stack (backup).
Definition: ReflectorInterface.h:790
void reflectBase(Base &base)
Method that can be called to reflect the base class easily.
Definition: ReflectorInterface.h:836
MIRA_BASE_EXPORT std::string resolveEnvironmentVariable(const std::string &envVar)
Resolves an environmental variable.
No flags.
Definition: ReflectControlFlags.h:65
void member(const char *name, Getter< T > getter, Setter< T > setter, const char *comment, const U &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, where a default value can be specified that is used, if the value is not available in ...
Definition: ReflectorInterface.h:433
void property(const char *name, Getter< T > getter, Setter< T > setter, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as the corresponding member-method, to indicate that the member is a property and can be altered...
Definition: ReflectorInterface.h:473
MIRA_DEPRECATED("Please call as version<MyType>(v) or version(v, this)", VersionType version(VersionType version))
Deprecated &#39;anonymous&#39; (no type) version().
Definition: ReflectorInterface.h:248
Tag class used as parameter to ReflectorInterface::version() etc.
Definition: ReflectorInterface.h:80
VersionType version(VersionType version, AcceptDesiredVersion, const T *caller=NULL)
Extension of version() (see above), that additionally signals the reflector that the caller will prop...
Definition: ReflectorInterface.h:337
void property(const char *name, const T &member, Setter< T > setter, const char *comment, const U &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as the corresponding member-method, to indicate that the member is a property and can be altered...
Definition: ReflectorInterface.h:493
Getter< T > getter(T(*f)())
Creates a Getter for global or static class methods returning the result by value.
Definition: GetterSetter.h:136
void delegate(const T &member, Setter< T > setter, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Delegates the serialization/reflection of a member directly to the member.
Definition: ReflectorInterface.h:558
void property(const char *name, Getter< T > getter, Setter< T > setter, const char *comment, const U &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as the corresponding member-method, to indicate that the member is a property and can be altered...
Definition: ReflectorInterface.h:503
#define RPCGEN_METHODS_PARAMDESCSAMPLE(z, n, _)
Definition: ReflectorInterface.h:625
void delegate(T &member, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Delegates the serialization/reflection of a member directly to the member.
Definition: ReflectorInterface.h:549
Utility macros used in generating RPC method definitions with BOOST_PP.
void member(const char *name, T &member, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Specifies a class member for reflection/serialization.
Definition: ReflectorInterface.h:375
void method(const char *name, Method method, const char *comment, const char *paramName, const char *paramDescription, P paramSampleValue,...)
Specifies that the class that is reflected provides a service through the specified static member fun...
void member(const char *name, T &member, const char *comment, const U &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, where a default value can be specified that is used, if the value is not available in ...
Definition: ReflectorInterface.h:414
void roproperty(const char *name, const std::string &id, const T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, with an extra parameter for specifying the id explicitly if it differs from name...
Definition: ReflectorInterface.h:523
void property(const char *name, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as the corresponding member-method, to indicate that the member is a property and can be altered...
Definition: ReflectorInterface.h:445
serialization::VersionType VersionType
Definition: ReflectorInterface.h:194
Holds a boost::function object to a special getter function that must meet the signature "T method()"...
Definition: GetterSetter.h:87
#define RPCGEN_METHODS_INVALID(z, n, _)
Definition: ReflectorInterface.h:676
void property(const char *name, const std::string &id, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, with an extra parameter for specifying the id explicitly if it differs from name...
Definition: ReflectorInterface.h:455
Functions for platform independent resolving of environment variables.
VersionType requireVersion(VersionType version, VersionType minVersion, AcceptDesiredVersion, const T *caller=NULL)
Extension of requireVersion() (see above), that additionally signals the reflector that the caller wi...
Definition: ReflectorInterface.h:347
ReflectCtrlFlags
Control Flags that can modify the behavior of certain reflectors.
Definition: ReflectControlFlags.h:63
serialization::AcceptDesiredVersion AcceptDesiredVersion
Definition: ReflectorInterface.h:330
void requireVersion(VersionType version, AcceptDesiredVersion, const T *caller=NULL)
Extension of requireVersion() (see above), that additionally signals the reflector that the caller wi...
Definition: ReflectorInterface.h:355
void property(const char *name, const T &member, Setter< T > setter, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as the corresponding member-method, to indicate that the member is a property and can be altered...
Definition: ReflectorInterface.h:464
ReflectState preReflect(const char *context="")
If a reflector requires reflection barriers, preReflect() and postReflect() should be called before/a...
Definition: ReflectorInterface.h:866
boost::mpl::bool_< true > useHumanReadableIDs
Specifies, if the Reflector supports human readable IDs.
Definition: ReflectorInterface.h:128
#define RPCGEN_METHODS_WRONG_ARGUMENT_NUMBER(z, n, _)
Definition: ReflectorInterface.h:654
MIRA_DEPRECATED("Please call as requireVersion<MyType>(v, minV) or requireVersion(v, minV, this)", VersionType requireVersion(VersionType version, VersionType minVersion))
Deprecated &#39;anonymous&#39; (no type) requireVersion().
Definition: ReflectorInterface.h:280
Provides definition for getters and setters that are used with the serialization framework.
void member(const char *name, const T &member, Setter< T > setter, const char *comment, const U &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Same as above, where a default value can be specified that is used, if the value is not available in ...
Definition: ReflectorInterface.h:423
Definition: ReflectorInterface.h:114
void requireVersion(VersionType version, const T *caller=NULL)
Specifies the current class version, which is also the minimum (and therefore only) version accepted ...
Definition: ReflectorInterface.h:288
void interface(const char *name)
Indicates that the class implements the specified RPC interface.
Definition: ReflectorInterface.h:581
void postReflect(const ReflectState &)
See preReflect for documentation.
Definition: ReflectorInterface.h:876