MIRA
Namespaces | Classes | Macros | Typedefs | Enumerations | Functions
Serialization Module


For detailed information see Serialization. More...

Collaboration diagram for Serialization Module:

Namespaces

 mira::PropertyHints
 Namespace to put all PropertyHint creation functions.
 

Classes

class  AbstractReflector< Derived >
 Abstract base class for most Reflectors. More...
 
struct  BinarySerializerTag
 Serializer that uses BinaryOstream to serialize the objects in binary format. More...
 
class  BinaryDeserializer< Derived >
 Deserializer that uses BinaryIstream to deserialize the objects from binary format. More...
 
class  BinarySerializerCodec
 Abstract base class for codecs that can be used with BinarySerializer and BinaryDeserializer. More...
 
class  DefaultInitializer
 Reflector that visits the reflect method of objects in order to initialize them using the specified default values. More...
 
class  Deserializer< Derived >
 Is a special reflector that is used for deserialization. More...
 
class  Getter< T >
 Holds a boost::function object to a special getter function that must meet the signature "T method()". More...
 
class  Setter< T >
 Holds a boost::function object to a special setter function that must meet the signature "void method(T)". More...
 
class  IgnoreMissing
 Marker for indicating parameters that should be ignored if they are missing in the config file. More...
 
class  IsAtomicSerializable< T >
 Type trait that indicates whether a type can be serialized as an atomic value. More...
 
class  IsBitwiseSerializable< T >
 Type trait that indicates whether a type can be serialized bitwise by just copying the data buffer. More...
 
class  IsCollection< T >
 Type trait that indicates whether a type is a collection. More...
 
class  IsNotMetaSerializable< T >
 Type trait that indicates whether a type does not support to gather meta information about it, e.g. More...
 
class  IsObjectTrackable< T >
 Type trait that indicates whether pointer tracking can be enabled for this type. More...
 
class  IsPointerOrSharedPointer< T >
 Type trait that indicates whether a type is a pointer type or a shared pointer. More...
 
class  IsTransparentSerializable< T, SerializerTag >
 Type trait that indicates whether a type should be serialized "transparently", i.e. More...
 
class  JSONSerializer
 Serializer for serializing objects in JSON format. More...
 
class  JSONDeserializer
 Deserializer for serializing objects from JSON format. More...
 
class  PropertyHint
 A property hint gives optional instructions to the property editor, i.e. More...
 
class  PropertyManager
 The property manager maintains the properties of objects that are added to the manager. More...
 
class  PropertyNode
 Abstract base class for all derived property node classes. More...
 
class  TypedPropertyNode< T >
 Abstract base class for all typed property nodes. More...
 
class  AbstractRemotePropertyNode
 Special derived class of PropertyNode, that allows to handle "remote properties" transparently. More...
 
class  TypedRemotePropertyNode< T >
 Special TypedPropertyNode for remote properties. More...
 
class  PropertyReflector< Derived >
 Base class for all Reflectors that take care of properties. More...
 
class  PropertySerializer
 A special PropertyReflector that creates a PropertyNode for each reflected property. More...
 
class  PropertyTree
 Helper class that is able to hold a complete property tree structure. More...
 
class  RecursiveMemberReflectorBase< Derived >
 The RecursiveMemberReflectorBase is a base class for all Reflectors that are used to visit the reflect methods of the classes recursively in order to collect information on the members of these classes. More...
 
class  RecursiveMemberReflector< Derived >
 The RecursiveMemberReflector extents the RecursiveMemberReflectorBase class and implements the member() and property() methods of the ReflectorInterface class by calling the appropriate methods of RecursiveMemberReflectorBase. More...
 
struct  ReflectCollectionCount< Reflector, Collection >
 Can be specialized for a concrete derived RecursiveMemberReflector to reflect the size of collections like vectors, arrays, lists, maps, etc. More...
 
struct  ReflectCollectionItems< Reflector, Container >
 Can be specialized for a concrete derived RecursiveMemberReflector to reflect the items of collections like vectors, arrays, lists, maps, etc. More...
 
struct  ReflectMemberMeta
 Stores meta information for each member. More...
 
class  ReflectorInterface< Derived >
 This is the public interface of all reflectors that are able to visit a class' reflect() method. More...
 
class  Serializer< Derived >
 Is a special reflector that is used for serialization. More...
 
struct  XMLSerializerTag
 Serializer for serializing objects in XML format. More...
 
class  XMLDeserializer
 Deserializer for serializing objects from XML format. More...
 

Macros

#define MIRA_INITIALIZE_THIS   mira::DefaultInitializer::initialize(*this)
 Initializes the members of this instance using the default values specified within the reflect method. More...
 
#define MIRA_NO_GENERIC_REFLECT_MEMBER(Type)
 Exception that is thrown, if a certain type does not support the specified reflector/serializer/deserializer since it does not support a generic reflect method that matches with all reflectors. More...
 
#define MIRA_NO_GENERIC_REFLECT(Type)
 Macro that can be used to indicate that a class type does not support all possible Reflectors/Serializers that may visit the reflect method of the type. More...
 
#define MIRA_REFLECT_VERSION(reflector, versionNumber)   reflector.version(versionNumber, this)
 Macro that should be used to specify the (reflected) version of the class. More...
 
#define MIRA_REFLECT_REQUIRE_VERSION(reflector, versionNumber)   reflector.requireVersion(versionNumber, this)
 Macro that should be used to specify the required (reflected) version of the class. More...
 
#define MIRA_REFLECT_BASE(reflector, BaseClass)   reflector.template reflectBase<BaseClass>(*this)
 Macro that can be used to reflect the base class easily. More...
 
#define MIRA_REFLECT_BASE_NONINTRUSIVE(reflector, BaseClass, object)   reflector.template reflectBase<BaseClass>(object)
 Macro that can be used to reflect the base class easily in a non-intrusive reflect() method. More...
 
#define MIRA_REFLECT_BASE_IF_VERSION_ATLEAST(reflector, BaseClass, versionvar, minversion)
 Macro that can be used to selectively call BaseClass::reflect() directly or through reflectBase(), depending on version. More...
 
#define MIRA_REFLECT_BASE_NONINTRUSIVE_IF_VERSION_ATLEAST(reflector, BaseClass, object, versionvar, minversion)
 Macro that can be used in non-intrusive reflection to selectively call reflect(reflector, (BaseClass&)object) directly or through reflectBase(), depending on version. More...
 
#define MIRA_MEMBER_WITH_ID(reflector, name, id, var, ...)
 Macro that should be used to reflect a member if a manually specified ID is used. More...
 
#define MIRA_CLASS_SERIALIZATION(pCLASS, ...)
 Registers the specified class in the class factory and additionally registers polymorphic serialization/deserialization with all known serializers. More...
 
#define MIRA_TEMPLATE_CLASS_SERIALIZATION(Namespace, Class, TmplSpec, ...)
 Registers the specified template class in the class factory and additionally registers polymorphic serialization/deserialization with all known serializers. More...
 
#define MIRA_VARTEMPLATE_CLASS_SERIALIZATION(Namespace, Class, NumTmplPrm, TmplSpec, ...)
 Registers the specified template class in the class factory and additionally registers polymorphic serialization/deserialization with all known serializers. More...
 
#define MIRA_SPLIT_REFLECT(Type)
 Macro that inserts a reflect() method consisting of just a call to splitReflect() (splitting to reflectRead() / reflectWrite()). More...
 
#define MIRA_SPLIT_REFLECT_MEMBER
 Macro that insert a class member reflect() method just splitting reflection into a reflectRead() and reflectWrite() method. More...
 

Typedefs

typedef ConcreteBinarySerializer< BinaryBufferOstream, 2 > BinaryBufferSerializer
 Typedef for BinarySerializer based on a Buffer. More...
 
typedef ConcreteBinarySerializer< BinaryStlOstream, 2 > BinaryStreamSerializer
 Typedef for BinarySerializer based on STL streams. More...
 
typedef ConcreteBinaryDeserializer< BinaryBufferIstream, 2 > BinaryBufferDeserializer
 Typedef for BinaryDeserializer based on a Buffer. More...
 
typedef ConcreteBinaryDeserializer< BinaryStlIstream, 2 > BinaryStreamDeserializer
 Typedef for BinaryDeserializer based on a stl stream. More...
 

Enumerations

enum  ReflectCtrlFlags { REFLECT_CTRLFLAG_NONE = 0x0000, REFLECT_CTRLFLAG_TEMP_TRACKING = 0x0001, REFLECT_CTRLFLAG_VOLATILE = 0x0002, REFLECT_CTRLFLAG_MEMBER_AS_ROPROPERTY = 0x0004 }
 Control Flags that can modify the behavior of certain reflectors. More...
 

Functions

template<typename T >
Getter< T > getter (T(*f)())
 Creates a Getter for global or static class methods returning the result by value. More...
 
template<typename T >
Getter< T > getter (const T &(*f)())
 Creates a Getter for global or static class methods returning the result by const reference. More...
 
template<typename T , typename Class >
Getter< T > getter (T(Class::*f)(), Class *obj)
 Creates a Getter for non-const class methods returning the result by value. More...
 
template<typename T , typename Class >
Getter< T > getter (const T &(Class::*f)(), Class *obj)
 Creates a Getter for non-const class methods returning the value by const reference. More...
 
template<typename T , typename LambdaFn >
Getter< T > getter (LambdaFn fn)
 Creates a Getter for a lambda function. More...
 
template<typename T >
Getter< T > getter (boost::function< T()> f)
 Creates a Getter for boost function or boost bind. More...
 
template<typename T , typename TObject >
Getter< T > getter (T(*f)(const TObject &), const TObject &object)
 Creates a Getter for a global function or static class method that additionally is assigned with a certain object of type TObject, i.e. More...
 
template<typename T , typename TObject >
Getter< T > getter (T(*f)(TObject), const TObject &object)
 Creates a Getter for a global function or static class method that additionally is assigned with a certain object. More...
 
template<typename T , typename TObject >
Getter< T > getter (boost::function< T(const TObject &)> f, const TObject &object)
 Creates a Getter for a boost bind function that additionally is assigned with a certain object. More...
 
template<typename T , typename TObject >
Getter< T > getter (boost::function< T(TObject)> f, const TObject &object)
 Creates a Getter for a boost bind function that additionally is assigned with a certain object. More...
 
template<typename T >
Setter< T > setter (void(*f)(const T &))
 Creates a Setter for global or static class methods taking the argument by const reference. More...
 
template<typename T >
Setter< T > setter (void(*f)(T))
 Creates a Setter for global or static class methods taking the argument by value. More...
 
template<typename T , typename LambdaFn >
Setter< T > setter (LambdaFn fn)
 Creates a Setter for lambda function. More...
 
template<typename T , typename Class >
Setter< T > setter (void(Class::*f)(const T &), Class *obj)
 Creates a Setter for class methods taking the argument by const reference. More...
 
template<typename T , typename Class >
Setter< T > setter (void(Class::*f)(T), Class *obj)
 Creates a Setter for class methods taking the argument by value. More...
 
template<typename T >
Setter< T > setter (boost::function< void(const T &)> f)
 Creates a Setter for boost function or boost bind. More...
 
template<typename T , typename TObject >
Setter< T > setter (TObject(*f)(const T &), TObject &object)
 Creates a Setter for a global function or static class method that additionally is assigned with a certain object of type TObject, i.e. More...
 
template<typename T >
Private::TPrintHelper< T > print (const T &value, bool prettyPrint=true)
 Convenient function for simple output of a serializable class to a stream. More...
 
template<typename T >
Private::TPrintHelper< T > print (const T &value, PrintFormat format, int precision=-1)
 Convenient function for simple output of a serializable class to a stream. More...
 
template<typename T >
PropertyHint minimum (const T &min)
 Sets the attribute "minimum" to the specified value. More...
 
template<typename T >
PropertyHint maximum (const T &max)
 Sets the attribute "maximum" to the specified value. More...
 
template<typename T >
PropertyHint step (const T &step)
 Sets the attribute "step" to the specified value. More...
 
template<typename T >
PropertyHint limits (const T &min, const T &max)
 Sets both attributes "minimum" and "maximum" to the specified values. More...
 
PropertyHint precision (int p)
 Sets the attribute "precision". More...
 
PropertyHint type (const std::string &t)
 Sets the attribute "type" to the specified value. More...
 
PropertyHint enumeration (const std::string &values)
 Sets the attribute "enumeration". More...
 
template<typename T >
PropertyHint slider (const T &min, const T &max, const T &s)
 Sets the attribute "type" to the value "slider" and sets the "minimum", "maximum" and "step" attributes. More...
 
template<typename T >
PropertyHint spin (const T &min, const T &max, const T &s)
 Sets the attribute "type" to the value "spinbox" and sets the "minimum", "maximum" and "step" attributes. More...
 
template<typename T >
Setter< T > setterNotify (T &member, boost::function< void()> notifyFn)
 Creates a setter that simply sets the value of the specified member to the given value AND calls a user defined notification method afterwards. More...
 
template<typename T , typename Class >
Setter< T > setterNotify (T &member, void(Class::*f)(), Class *obj)
 Creates a setter that simply sets the value of the specified member to the given value AND calls a user defined notification method afterwards. More...
 
template<typename Reflector , typename Class >
void splitReflectMember (mira::ReflectorInterface< Reflector > &r, Class *This)
 This method is used to split reflection into a reflectRead() and reflectWrite() method. More...
 

Detailed Description


For detailed information see Serialization.

Macro Definition Documentation

◆ MIRA_INITIALIZE_THIS

#define MIRA_INITIALIZE_THIS   mira::DefaultInitializer::initialize(*this)

Initializes the members of this instance using the default values specified within the reflect method.

This macro should be used within the constructor.

◆ MIRA_NO_GENERIC_REFLECT_MEMBER

#define MIRA_NO_GENERIC_REFLECT_MEMBER (   Type)
Value:
template<typename Derived> \
{ \
MIRA_THROW(XNoGenericReflect, "'" << typeName<Type>() \
<< "' does not support the reflector '" \
<< typeName<Derived>() << "'"); \
}
This is the public interface of all reflectors that are able to visit a class&#39; reflect() method...
Definition: ReflectorInterface.h:111
void reflect(Reflector &r, LogRecord &record)
Non-intrusive reflector for LogRecord.
Definition: LoggingCore.h:136

Exception that is thrown, if a certain type does not support the specified reflector/serializer/deserializer since it does not support a generic reflect method that matches with all reflectors.

Macro that can be used to indicate that a class type does not support all possible Reflectors/Serializers that may visit the reflect method of the type. This is useful for class types that, e.g. support the BinarySerializer only. In this case the reflect method must be specialized for that certain reflector as shown in the following example:

class MyClass
{
// indicate that no generic reflect for all Reflectors is supported
template<typename Derived>
void reflect(BinarySerializer<Derived>& r) {
// special code for BinarySerializer
}
};

◆ MIRA_NO_GENERIC_REFLECT

#define MIRA_NO_GENERIC_REFLECT (   Type)
Value:
template<typename Derived> \
{ \
MIRA_THROW(XNoGenericReflect, "'" << typeName<Type>() \
<< "' does not support the reflector '" \
<< typeName<Derived>() << "'"); \
}
This is the public interface of all reflectors that are able to visit a class&#39; reflect() method...
Definition: ReflectorInterface.h:111
void reflect(Reflector &r, LogRecord &record)
Non-intrusive reflector for LogRecord.
Definition: LoggingCore.h:136

Macro that can be used to indicate that a class type does not support all possible Reflectors/Serializers that may visit the reflect method of the type.

This is useful for class types that, e.g. support the BinarySerializer only. In this case the reflect method must be specialized for that certain reflector as shown in the following example:

// indicate that no generic reflect for all Reflectors is supported
template<typename Derived>
void reflect(BinarySerializer<Derived>& r, MyClass& obj) {
// special code for BinarySerializer
}

In contrast to MIRA_NO_GENERIC_REFLECT_MEMBER this macro can be used outside of a class.

◆ MIRA_REFLECT_VERSION

#define MIRA_REFLECT_VERSION (   reflector,
  versionNumber 
)    reflector.version(versionNumber, this)

Macro that should be used to specify the (reflected) version of the class.

template<typename Reflector>
void reflect(Reflector& r)
{
MIRA_REFLECT_VERSION(r, version);
}

The macro calls the version() method of the reflector.

See also
Serialization

◆ MIRA_REFLECT_REQUIRE_VERSION

#define MIRA_REFLECT_REQUIRE_VERSION (   reflector,
  versionNumber 
)    reflector.requireVersion(versionNumber, this)

Macro that should be used to specify the required (reflected) version of the class.

template<typename Reflector>
void reflect(Reflector& r)
{
}

The macro calls the requireVersion() method of the reflector.

See also
Serialization

◆ MIRA_REFLECT_BASE

#define MIRA_REFLECT_BASE (   reflector,
  BaseClass 
)    reflector.template reflectBase<BaseClass>(*this)

Macro that can be used to reflect the base class easily.

template<typename Reflector>
void reflect(Reflector& r)
{
MIRA_REFLECT_BASE(r, MyBaseClass); // reflect our base class first
}

The macro calls the reflectBase() method of the reflector.

See also
Serialization
Examples:
tutorials/FloatProducer.C, tutorials/MeanCalculator.C, tutorials/MeanCalculatorWithProperties.C, tutorials/Point2Visualization.C, and tutorials/Point3Visualization.C.

◆ MIRA_REFLECT_BASE_NONINTRUSIVE

#define MIRA_REFLECT_BASE_NONINTRUSIVE (   reflector,
  BaseClass,
  object 
)    reflector.template reflectBase<BaseClass>(object)

Macro that can be used to reflect the base class easily in a non-intrusive reflect() method.

template<typename Reflector>
void reflect(Reflector& r, Class& object)
{
MIRA_REFLECT_BASE(r, BaseClass, object); // reflect Class' base class first
}

The macro calls the reflectBase() method of the reflector.

See also
Serialization

◆ MIRA_REFLECT_BASE_IF_VERSION_ATLEAST

#define MIRA_REFLECT_BASE_IF_VERSION_ATLEAST (   reflector,
  BaseClass,
  versionvar,
  minversion 
)
Value:
if (versionvar < minversion) \
BaseClass::reflect(reflector); \
else \
reflector.template reflectBase<BaseClass>(*this); \
void reflect(Reflector &r, LogRecord &record)
Non-intrusive reflector for LogRecord.
Definition: LoggingCore.h:136

Macro that can be used to selectively call BaseClass::reflect() directly or through reflectBase(), depending on version.

Assume someone forgot to properly use reflectBase/MIRA_REFLECT_BASE when implementing the reflect method for a derived class:

template<typename Reflector>
void reflect(Reflector& r, Class& object)
{
}

Simply replacing BaseClass::reflect(r) with MIRA_REFLECT_BASE will break binary compatibility (it will add an extra version field for the base class). A non-breaking fix (allowing to read data created by the older implementation) is to define a new version and call MIRA_REFLECT_BASE for the new version, or BaseClass::reflect for the old version:

template<typename Reflector>
void reflect(Reflector& r, Class& object)
{
if (v < 1) // data from older implementations will be recognized as version=0
else
reflector.template reflectBase<BaseClass>(*this);
}
See also
Serialization

◆ MIRA_REFLECT_BASE_NONINTRUSIVE_IF_VERSION_ATLEAST

#define MIRA_REFLECT_BASE_NONINTRUSIVE_IF_VERSION_ATLEAST (   reflector,
  BaseClass,
  object,
  versionvar,
  minversion 
)
Value:
if (versionvar < minversion) \
reflect(reflector, (BaseClass&)object); \
else \
reflector.template reflectBase<BaseClass>(object); \

Macro that can be used in non-intrusive reflection to selectively call reflect(reflector, (BaseClass&)object) directly or through reflectBase(), depending on version.

See also
MIRA_REFLECT_BASE_IF_VERSION_ATLEAST

◆ MIRA_MEMBER_WITH_ID

#define MIRA_MEMBER_WITH_ID (   reflector,
  name,
  id,
  var,
  ... 
)
Value:
if(reflector.usesHumanReadableIDs()) \
reflector.member(name, id, var, __VA_ARGS__); \
else \
reflector.member(name, var, __VA_ARGS__);

Macro that should be used to reflect a member if a manually specified ID is used.

This macro checks if the reflector supports human readable IDs. If not, the usually time consuming construction of the ID is optimized out.

Note
If you do not need to specify an ID explicitly, then call the appropriate member() method of the Reflector directly.
See also
Serialization

◆ MIRA_CLASS_SERIALIZATION

#define MIRA_CLASS_SERIALIZATION (   pCLASS,
  ... 
)
Value:
MIRA_CLASS_REGISTER( pCLASS, __VA_ARGS__ ) \
BOOST_PP_SEQ_FOR_EACH( MIRA_CLASS_SERIALIZATION_IMPL, pCLASS, MIRA_SERIALIZER_SEQUENCE )
#define MIRA_CLASS_REGISTER(Class,...)
Use this macro to register your class at the ClassFactory.
Definition: FactoryMacros.h:257

Registers the specified class in the class factory and additionally registers polymorphic serialization/deserialization with all known serializers.

The first parameter must be the type of the class to register, while the second parameter must be the type of the base class.

If you derive a class from mira::Object, you must use this macro to register your class at the class factory and to register it at all known Serializers and Deserializers.

If you implement a new RecursiveMemberReflector you should add it above to the MIRA_SERIALIZER_SEQUENCE.

Examples:
tutorials/FloatProducer.C, tutorials/MeanCalculator.C, tutorials/MeanCalculatorWithProperties.C, tutorials/Point2Visualization.C, tutorials/Point3BasicVisualization.C, and tutorials/Point3Visualization.C.

◆ MIRA_TEMPLATE_CLASS_SERIALIZATION

#define MIRA_TEMPLATE_CLASS_SERIALIZATION (   Namespace,
  Class,
  TmplSpec,
  ... 
)
Value:
MIRA_TEMPLATE_CLASS_REGISTER(Namespace, Class, TmplSpec, __VA_ARGS__ ) \
BOOST_PP_SEQ_FOR_EACH(MIRA_INTERNAL_TEMPLATE_CLASS_SERIALIZATION, (1)(Class)Namespace,MIRA_MAKE_SEQ(1,TmplSpec))
#define MIRA_TEMPLATE_CLASS_REGISTER(Namespace, Class, TmplSpec,...)
Use this macro to register your template class at the ClassFactory.
Definition: FactoryMacros.h:450

Registers the specified template class in the class factory and additionally registers polymorphic serialization/deserialization with all known serializers.

See MIRA_CLASS_SERIALIZATION for more details.

◆ MIRA_VARTEMPLATE_CLASS_SERIALIZATION

#define MIRA_VARTEMPLATE_CLASS_SERIALIZATION (   Namespace,
  Class,
  NumTmplPrm,
  TmplSpec,
  ... 
)
Value:
MIRA_VARTEMPLATE_CLASS_REGISTER(Namespace, Class, NumTmplPrm, \
TmplSpec, __VA_ARGS__ ) \
BOOST_PP_SEQ_FOR_EACH(MIRA_INTERNAL_TEMPLATE_CLASS_SERIALIZATION, \
(NumTmplPrm)(Class)Namespace, \
MIRA_MAKE_SEQ(NumTmplPrm,TmplSpec))
#define MIRA_VARTEMPLATE_CLASS_REGISTER(Namespace, Class, NumTmplPrm, TmplSpec,...)
Use this macro to register your template class at the ClassFactory.
Definition: FactoryMacros.h:465

Registers the specified template class in the class factory and additionally registers polymorphic serialization/deserialization with all known serializers.

See MIRA_CLASS_SERIALIZATION for more details.

◆ MIRA_SPLIT_REFLECT

#define MIRA_SPLIT_REFLECT (   Type)
Value:
template<typename Reflector> \
{ \
splitReflect(r, value); \
}
This is the public interface of all reflectors that are able to visit a class&#39; reflect() method...
Definition: ReflectorInterface.h:111
void reflect(Reflector &r, LogRecord &record)
Non-intrusive reflector for LogRecord.
Definition: LoggingCore.h:136

Macro that inserts a reflect() method consisting of just a call to splitReflect() (splitting to reflectRead() / reflectWrite()).

In contrast to the MIRA_SPLIT_REFLECT_MEMBER macro this macro can be used outside of classes only, creating a non-intrusive variant of reflect() for Type.

See also
Serialization

◆ MIRA_SPLIT_REFLECT_MEMBER

#define MIRA_SPLIT_REFLECT_MEMBER
Value:
template<typename Reflector> \
{ \
Reflector& reflector = static_cast<Reflector&>(r); \
typedef typename serialization::SplitReflectMemberHelper<Reflector>::rwtype rwtype; \
\
/* proper use of reflect barrier enables to e.g. \
potentially add a version to the splitting mechanism \
itself (--> in splitReflectMemberInvoke()) */ \
\
typedef typename std::remove_reference<decltype(*this)>::type splitType; \
\
static const std::string context = typeName<splitType>() + " MIRA_SPLIT_REFLECT_MEMBER"; \
MIRA_REFLECT_CALL(Reflector, reflector, context.c_str(), \
(splitReflectMemberInvoke<rwtype>(reflector, this))); \
}
This is the public interface of all reflectors that are able to visit a class&#39; reflect() method...
Definition: ReflectorInterface.h:111
#define MIRA_REFLECT_CALL(ReflectorType, reflector, context, COMMAND)
Whenever a reflection function calls another function that is independently maintained, the call should be marked to the reflector.
Definition: ReflectorMacros.h:115
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
void reflect(Reflector &r, LogRecord &record)
Non-intrusive reflector for LogRecord.
Definition: LoggingCore.h:136

Macro that insert a class member reflect() method just splitting reflection into a reflectRead() and reflectWrite() method.

this->reflect(r) resolves to this->reflectRead(r) if the visiting Reflector is reading only and this->reflectWrite(r) if the visiting Reflector is writing only (checked at compile time). In contrast to the MIRA_SPLIT_REFLECT macro this macro can be used within classes only.

See also
Serialization

Typedef Documentation

◆ BinaryBufferSerializer

Typedef for BinarySerializer based on a Buffer.

See BinarySerializer for details.

◆ BinaryStreamSerializer

Typedef for BinarySerializer based on STL streams.

See BinarySerializer for details.

◆ BinaryBufferDeserializer

Typedef for BinaryDeserializer based on a Buffer.

See BinaryDeserializer for details.

◆ BinaryStreamDeserializer

Typedef for BinaryDeserializer based on a stl stream.

See BinaryDeserializer for details.

Enumeration Type Documentation

◆ ReflectCtrlFlags

Control Flags that can modify the behavior of certain reflectors.

Control flags can optionally be given in member()/property()/delegate() methods and affect reflection of the respective element.

Enumerator
REFLECT_CTRLFLAG_NONE 

No flags.

REFLECT_CTRLFLAG_TEMP_TRACKING 

This object can use object tracking internally, but the object tracking system's state remains unchanged (is restored) after the object is reflected.

Note
This MUST be used e.g. if function-local (non-primitive) objects are given to a member()/delegate() method, as in this case different objects may occupy the same memory location (subsequently) and otherwise erroneously be identified as address aliases.
Warning
Do not use function-local (or other lifetime-limited) variables/objects with property()/roproperty(), even with REFLECT_CTRLFLAG_TEMP_TRACKING! The PropertySerializer creates PropertyNodes, which hold memory references to the objects containing the property values. Expiration of a referred object's lifetime while the PropertyNode is in use will result in invalid memory access.
REFLECT_CTRLFLAG_VOLATILE 

This object is volatile: its memory location may become invalid to access.

Currently this flag is only relevant to property reflectors, which will use this information to avoid invalid memory access through a PropertyNode.

REFLECT_CTRLFLAG_MEMBER_AS_ROPROPERTY 

When this flag is used in calls to Reflector::member(), that member is also reflected as read-only property by instances of PropertyReflector (members are ignored by PropertyReflectors otherwise).

Thus, it avoids the need for an extra call to Reflector::roproperty() to also show the member in a PropertyEditor etc.

Be aware that the use as property may have other requirements than a member, e.g. see REFLECT_CTRLFLAG_VOLATILE and comments on REFLECT_CTRLFLAG_TEMP_TRACKING.

Function Documentation

◆ getter() [1/10]

Getter<T> mira::getter ( T(*)()  f)

Creates a Getter for global or static class methods returning the result by value.

e.g.:

int getValue() {}
...
getter(getValue)

◆ getter() [2/10]

Getter<T> mira::getter ( const T &(*)()  f)

Creates a Getter for global or static class methods returning the result by const reference.

e.g:

const int& getValue() {}
...
getter(getValue)

◆ getter() [3/10]

Getter< T > getter ( T(Class::*)()  f,
Class obj 
)

Creates a Getter for non-const class methods returning the result by value.

Creates a Getter for const class methods returning the result by value.

e.g:

class MyClass {
int getValue() {}
...
getter(&MyClass::getValue, this)
};

e.g.

class MyClass {
int getValue() const {}
...
getter(&MyClass::getValue, this)
};

◆ getter() [4/10]

Getter< T > getter ( const T &(Class::*)()  f,
Class obj 
)

Creates a Getter for non-const class methods returning the value by const reference.

Creates a Getter for const class methods returning the result by const reference.

e.g.

class MyClass {
const int& getValue() {}
...
getter(&MyClass::getValue, this)
};

e.g.

class MyClass {
const int& getValue() const {}
...
getter(&MyClass::getValue, this)
};

◆ getter() [5/10]

Getter<T> mira::getter ( LambdaFn  fn)

Creates a Getter for a lambda function.

e.g:

getter<size_t>([&](){ return myVector.size(); })

◆ getter() [6/10]

Getter<T> mira::getter ( boost::function< T()>  f)

Creates a Getter for boost function or boost bind.

e.g.

getter<int>(boost::bind(...))

◆ getter() [7/10]

Getter<T> mira::getter ( T(*)(const TObject &)  f,
const TObject &  object 
)

Creates a Getter for a global function or static class method that additionally is assigned with a certain object of type TObject, i.e.

when the Getter is called, the specified function is called with the assigned object as parameter in order to return a value of type T. This is often used for getters that convert values or types.

The passed function maps: TObject -> T

e.g.

float deg2rad(int v) { convert from integral degrees to floating point radian }
class MyClass
{
int myvalue;
getter<float>(deg2rad, myvalue)
};

◆ getter() [8/10]

Getter<T> mira::getter ( T(*)(TObject)  f,
const TObject &  object 
)

Creates a Getter for a global function or static class method that additionally is assigned with a certain object.

Same as above.

◆ getter() [9/10]

Getter<T> mira::getter ( boost::function< T(const TObject &)>  f,
const TObject &  object 
)

Creates a Getter for a boost bind function that additionally is assigned with a certain object.

Same as above.

◆ getter() [10/10]

Getter<T> mira::getter ( boost::function< T(TObject)>  f,
const TObject &  object 
)

Creates a Getter for a boost bind function that additionally is assigned with a certain object.

Same as above.

◆ setter() [1/7]

Setter<T> mira::setter ( void(*)(const T &)  f)

Creates a Setter for global or static class methods taking the argument by const reference.

e.g.

void setValue(const int& value) {}
...
setter(setValue)

◆ setter() [2/7]

Setter<T> mira::setter ( void(*)(T)  f)

Creates a Setter for global or static class methods taking the argument by value.

e.g:

void setValue(int value) {}
...
setter(setValue)

◆ setter() [3/7]

Setter<T> mira::setter ( LambdaFn  fn)

Creates a Setter for lambda function.

e.g:

setter([](int value){})

◆ setter() [4/7]

Setter<T> mira::setter ( void(Class::*)(const T &)  f,
Class obj 
)

Creates a Setter for class methods taking the argument by const reference.

e.g.

class MyClass {
void setValue(const int& value) {}
...
setter(&MyClass::setValue, this)
}

◆ setter() [5/7]

Setter<T> mira::setter ( void(Class::*)(T)  f,
Class obj 
)

Creates a Setter for class methods taking the argument by value.

e.g:

class MyClass {
void setValue(int value) {}
...
setter(&MyClass::setValue, this)
}

◆ setter() [6/7]

Setter<T> mira::setter ( boost::function< void(const T &)>  f)

Creates a Setter for boost function or boost bind.

e.g.

setter<int>(boost::bind(...))

◆ setter() [7/7]

Setter<T> mira::setter ( TObject(*)(const T &)  f,
TObject &  object 
)

Creates a Setter for a global function or static class method that additionally is assigned with a certain object of type TObject, i.e.

when the Setter is called, the specified function is called with a value of type T and the result is assigned to the assigned object. This is often used for setters that convert values or types.

The passed function maps: T -> TObject

e.g.

int rad2rad(float v) { convert from floating point radian to integral degrees}
class MyClass
{
int myvalue;
setter<float>(rad2deg, myvalue)
};

◆ print() [1/2]

Private::TPrintHelper<T> mira::print ( const T &  value,
bool  prettyPrint = true 
)

Convenient function for simple output of a serializable class to a stream.

Usage:

SomeClass c; ...
cout << "MyClass: " << print(c) << endl;
Parameters
valueThe object or value that should be serialized.
prettyPrintWhether to use pretty format.
See also
Serialization

◆ print() [2/2]

Private::TPrintHelper<T> mira::print ( const T &  value,
PrintFormat  format,
int  precision = -1 
)

Convenient function for simple output of a serializable class to a stream.

Adds more options than print(T, bool).

Usage:

SomeClass c; ...
log << "Status: " << print(c, COMPACT_PRINT, 2) << endl;
Parameters
valueThe object or value that should be serialized.
formatThe format for printing.
precisionPrecision for floating point elements. -1 to use application-wide configured default.

Note that precision determines the number of decimals in FORMATTED/COMPACT, but number of significant digits in PRETTY.

Examples:

float f = 32.12f;
print(f, PRETTY_PRINT, 3)    --> 32.1
print(f, FORMATTED_PRINT, 3) --> 32.120
f = 4321.0f;
print(f, PRETTY_PRINT, 3)    --> 4.32e+03
print(f, FORMATTED_PRINT, 3) --> 4321.000

'translation' between print() variants:

print(value[, true]) === print(value, PRETTY_PRINT, 16)
print(value, false) === print(value, FORMATTED_PRINT [, -1])
See also
Serialization

◆ minimum()

PropertyHint mira::PropertyHints::minimum ( const T &  min)
inline

Sets the attribute "minimum" to the specified value.

In property editors this is the minimum value the user can select.

◆ maximum()

PropertyHint mira::PropertyHints::maximum ( const T &  max)
inline

Sets the attribute "maximum" to the specified value.

In property editors this is the maximum value the user can select.

◆ step()

PropertyHint mira::PropertyHints::step ( const T &  step)
inline

Sets the attribute "step" to the specified value.

In property editors this specifies the single step. When the user is interacting with the editor the value will be incremented/decremented by this amount.

◆ limits()

PropertyHint mira::PropertyHints::limits ( const T &  min,
const T &  max 
)
inline

Sets both attributes "minimum" and "maximum" to the specified values.

See above.

◆ precision()

PropertyHint mira::PropertyHints::precision ( int  p)
inline

Sets the attribute "precision".

A property editor can use this hint to display the specified number of decimals of floating point values.

◆ type()

PropertyHint mira::PropertyHints::type ( const std::string &  t)
inline

Sets the attribute "type" to the specified value.

The attribute may be used by property editors to select the appropriate editor element (e.g. spin box or sliders, etc.)

◆ enumeration()

PropertyHint mira::PropertyHints::enumeration ( const std::string &  values)
inline

Sets the attribute "enumeration".

The specified values must be separated by semicolons and specify the strings of the enumeration values. A property editor that supports this hint may show a drop down box with the strings.

◆ slider()

PropertyHint mira::PropertyHints::slider ( const T &  min,
const T &  max,
const T &  s 
)
inline

Sets the attribute "type" to the value "slider" and sets the "minimum", "maximum" and "step" attributes.

A property editor that supports this hint may show a slider control instead of a spin box

◆ spin()

PropertyHint mira::PropertyHints::spin ( const T &  min,
const T &  max,
const T &  s 
)
inline

Sets the attribute "type" to the value "spinbox" and sets the "minimum", "maximum" and "step" attributes.

A property editor that supports this hint may show a spinbox control.

◆ setterNotify() [1/2]

Setter<T> mira::setterNotify ( T &  member,
boost::function< void()>  notifyFn 
)

Creates a setter that simply sets the value of the specified member to the given value AND calls a user defined notification method afterwards.

Example:

r.property("Foo", mFoo, setterNotify(mFoo, boost::bind(&MyClass::valueChanged, this)),"");
See also
Serialization

◆ setterNotify() [2/2]

Setter< T > setterNotify ( T &  member,
void(Class::*)()  f,
Class obj 
)

Creates a setter that simply sets the value of the specified member to the given value AND calls a user defined notification method afterwards.

Same as above method but with easier binding to member functions.

Example:

r.property("Foo", mFoo, setterNotify(mFoo, &MyClass::valueChanged, this),"");
See also
Serialization

◆ splitReflectMember()

void mira::splitReflectMember ( mira::ReflectorInterface< Reflector > &  r,
Class This 
)
inline

This method is used to split reflection into a reflectRead() and reflectWrite() method.

It can be called within a class member reflect() method. It resolves to this->reflectRead(r) if the visiting Reflector is reading only and this->reflectWrite(r) if the visiting Reflector is writing only (checked at compile time).

See also
Serialization