MIRA
|
#include <serialization/BinarySerializer.h>
Public Types | |
typedef boost::mpl::bool_< false > | useHumanReadableIDs |
typedef std::map< TypeId, BinarySerializerCodecPtr > | CodecsMap |
A map of binary serialization codecs. More... | |
typedef Format::requireReflectBarriers | requireReflectBarriers |
typedef Format::ReflectState | ReflectState |
typedef Format::VersionType | VersionType |
typedef Base::AcceptDesiredVersion | AcceptDesiredVersion |
typedef boost::mpl::bool_< false > | isReadOnly |
typedef boost::mpl::bool_< true > | isObjectTrackingSupported |
enum | PointerType { NULL_POINTER = 0, POINTER_REFERENCE = 1, NORMAL_POINTER = 2, POLYMORPHIC_POINTER = 3 } |
Pointer type that is stored as 1-byte marker before storing the pointer. More... | |
Public Member Functions | |
ConcreteBinaryDeserializer (typename BinaryStream::streambuffer_pointer buffer) | |
Create a new binary deserializer based on the specified stream buffer object. More... | |
ConcreteBinaryDeserializer (BinaryStream &stream) | |
Create a new binary deserializer and read the data from the specified binary stream. More... | |
ConcreteBinaryDeserializer (BinaryStream &stream, typename BinaryStream::pos_type pos) | |
Create a new binary deserializer and read the data from the specified binary stream, starting at the specified position. More... | |
void | reassign (typename BinaryStream::streambuffer_pointer buffer) |
Reassigns the specified stream buffer to this deserializer. More... | |
BinaryStream::pos_type | streamPosition () |
template<typename T > | |
void | deserialize (T &value, bool enableTypeCheck=true, bool recursive=false) |
Provides a special deserialize interface for the BinaryDeserializer. More... | |
template<typename T > | |
VersionType | version (VersionType expectedVersion, const T *object=NULL) |
MIRA_DEPRECATED ("Please call as version<MyType>(v) or version(v, this)", VersionType version(VersionType expectedVersion)) | |
template<typename T > | |
VersionType | version (VersionType expectedVersion, AcceptDesiredVersion, const T *object=NULL) |
template<typename T > | |
void | atomic (T &member) |
Format::ReflectState | preReflect (const char *context="") |
void | postReflect (const typename Format::ReflectState &prev) |
template<typename T > | |
void | pointer (T *&pointer) |
Overwrites Deserializer::pointer. More... | |
std::string | pointerClassType () |
template<typename T > | |
void | invokeOverwrite (T &object) |
template<typename T > | |
void | invokeOverwrite (serialization::PlainArray< T > &array) |
Specialized for Array to implement an optimized variant for deserializing an array, if possible (i.e. More... | |
template<typename T > | |
void | read (T *data, std::size_t count) |
template<typename T > | |
bool | hasCodec () const |
Supported for compatibility with BinarySerializer in a common reflect method. More... | |
template<typename T > | |
bool | codec (T &obj) |
Decodes the specified object from the serialized data. More... | |
const CodecsMap & | getCodecs () const |
Return the map of currently known codecs. More... | |
void | setCodecs (const CodecsMap &codecs) |
Set the map of known codecs. More... | |
VersionType | version (VersionType version, const T *caller=NULL) |
VersionType | version (VersionType version, AcceptDesiredVersion, const T *caller=NULL) |
MIRA_DEPRECATED ("Please call as version<MyType>(v) or version(v, this)", VersionType version(VersionType version)) | |
MIRA_DEPRECATED ("Please call as requireVersion<MyType>(v, minV) or requireVersion(v, minV, this)", VersionType requireVersion(VersionType version, VersionType minVersion)) | |
MIRA_DEPRECATED ("Please call as requireVersion<MyType>(v) or requireVersion(v, this)", void requireVersion(VersionType requiredVersion)) | |
void | deserialize (const std::string &name, T &value) |
Deserializes the specified object value with the given name. More... | |
void | trackObject (T &member) |
void | pointerNormal (T *&pointer, int typeId) |
void | pointerPolymorphic (T *&pointer, int typeId) |
void | pointerAbstract (T *&pointer, int typeId) |
void | sharedPointerReset (boost::shared_ptr< T > &ptr, T *rawPtr) |
void | sharedPointerReset (std::shared_ptr< T > &ptr, T *rawPtr) |
void | sharedPointerReset (SType< T > &ptr, T *rawPtr, std::map< void *, SType< void > > &pointerMap) |
void | pushObjectTrackingStore () |
void | popObjectTrackingStore () |
void | member (const char *name, T &member, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, const std::string &id, T &member, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, const T &member, Setter< T > setter, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, Getter< T > getter, Setter< T > setter, const char *comment, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, T &member, const char *comment, const T &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, T &member, const char *comment, const U &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, const T &member, Setter< T > setter, const char *comment, const T &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, const T &member, Setter< T > setter, const char *comment, const U &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, Getter< T > getter, Setter< T > setter, const char *comment, const T &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | member (const char *name, Getter< T > getter, Setter< T > setter, const char *comment, const U &defaultValue, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, const std::string &id, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, const T &member, Setter< T > setter, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, Getter< T > getter, Setter< T > setter, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, T &member, const char *comment, const T &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, T &member, const char *comment, const U &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
void | property (const char *name, const T &member, Setter< T > setter, const char *comment, const T &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
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) |
void | property (const char *name, Getter< T > getter, Setter< T > setter, const char *comment, const T &defaultValue, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
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) |
void | delegate (T &member, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
Delegates the serialization directly to the specified member, without creating a separate compound for the current object. More... | |
void | delegate (const T &member, Setter< T > setter, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
Delegates the serialization directly to the specified member, without creating a separate compound for the current object. More... | |
void | delegate (Getter< T > getter, Setter< T > setter, ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
Delegates the serialization directly to the specified member, without creating a separate compound for the current object. More... | |
const ReflectMemberMeta & | getCurrentMemberMeta () const |
Returns the meta-information of the current member that is reflected. More... | |
const std::string & | getCurrentMemberFullID () const |
Returns the full human readable object id / name of the current member being reflected. More... | |
void | invokeMember (T &member, const ReflectMemberMeta &meta) |
Is called to invoke this Reflector on the member with the specified meta information. More... | |
void | invokeMemberOverwrite (T &member, const ReflectMemberMeta &meta) |
The actual invokeMember implementation that is called from invokeMember(). More... | |
void | invokePointerObject (T &member) |
Is called to reflect objects of pointers. More... | |
void | invokeMemberWithoutDefault (T &member, const ReflectMemberMeta &meta) |
Delegates to invokeMember() and rethrows any occurring XMemberNotFound exception as XIO exception. More... | |
void | invokeMemberWithDefault (T &member, const ReflectMemberMeta &meta, const U &defaultValue) |
Delegates to invokeMember() and handles any occurring XMemberNotFound exception by setting the member to the given default value. More... | |
void | invokeMemberWithDefault (T &member, const ReflectMemberMeta &meta, const serialization::IgnoreMissing &defaultValue) |
Delegates to invokeMember() and handles any occurring XMemberNotFound exception by ignoring the exception and hence the missing member, as indicated by IgnoreMissing as default value. More... | |
VersionType | requireVersion (VersionType version, VersionType minVersion, const T *caller=NULL) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
void | requireVersion (VersionType requiredVersion, const T *caller=NULL) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
VersionType | requireVersion (VersionType version, VersionType minVersion, AcceptDesiredVersion, const T *caller=NULL) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
void | requireVersion (VersionType requiredVersion, AcceptDesiredVersion, const T *caller=NULL) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
void | reflectBase (Base &base) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
void | postReflect (const ReflectState &) |
See preReflect for documentation. More... | |
Visiting methods that are called by the RecursiveMemberReflector | |
while reflecting the members | |
void | enumeration (T &member) |
Is called by the if the member is an enumeration. More... | |
void | object (T &member) |
Is called for each complex object. More... | |
void | collection (T &member) |
Is called for each complex object or array, where the IsCollection<T> trait is true_type. More... | |
Methods for reflecting members | |
These visiting methods are supported by the RecursiveMemberReflector. | |
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. More... | |
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. More... | |
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. More... | |
void | itemName (const std::string &name) |
If the currently reflected object is an item within a collection, this allows to specify an explicit name for that item. More... | |
Methods for reflecting RPC (remote procedure call) methods | |
void | interface (const char *name) |
Indicates that the class implements the specified RPC interface. More... | |
InvalidRPCDescription< R(Args...), Description... > | method (const char *, F &&, Description &&...) |
InvalidRPCDescription< F, Description... > | method (const char *, F &&, Description &&...) |
InvalidRPCDescription< R(Class::*)(Args...), Description... > | method (const char *, R(Class::*)(Args...), Class *, Description &&...) |
InvalidRPCDescription< R(Class::*)(Args...) const, Description... > | method (const char *, R(Class::*)(Args...) const, Class *, Description &&...) |
ValidRPCDescription< R(Args...), Description... > | method (const char *, F &&, Description &&...) |
ValidRPCDescription< F, Description... > | method (const char *, F &&, Description &&...) |
ValidRPCDescription< R(Class::*)(Args...), Description... > | method (const char *, R(Class::*)(Args...), Class *, Description &&...) |
ValidRPCDescription< R(Class::*)(Args...) const, Description... > | method (const char *, R(Class::*)(Args...) const, Class *, Description &&...) |
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 function or free function. More... | |
void | method (const char *name, Method method, Class *object, const char *comment, const char *paramName, const char *paramDescription, P paramSampleValue,...) |
Specifies that the class that is reflected provides a service through the specified non-static member function. More... | |
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 function wrapper. More... | |
void | invalid_method () |
Static Public Member Functions | |
static int | forcedDeserializeVersion () |
Returns either the version number from value of environment variable 'MIRA_FORCE_DESERIALIZE_VERSION', or -1 (= do not force a version). More... | |
static void | registerClass () |
Registers a new polymorphic class at the PolymorphPointerReflector. More... | |
static void | unregisterClass () |
Unregisters the class. More... | |
static bool | isReflectedAsPointer () |
For internal use only: Returns true, if the type T is ever reflected as pointer within the current translation unit (C file). More... | |
static bool | usesHumanReadableIDs () |
Returns true, if the concrete derived Reflector supports human readable IDs. More... | |
Protected Types | |
typedef std::map< std::string, void *> | ObjectNameToInstanceMap |
typedef std::vector< void *> | ObjectsVector |
typedef std::pair< ObjectsVector, ObjectNameToInstanceMap > | TrackingState |
typedef std::map< void *, boost::shared_ptr< void > > | BoostSharedPointerMap |
typedef std::map< void *, std::shared_ptr< void > > | StdSharedPointerMap |
Protected Member Functions | |
bool | isTrackingEnabled () const |
Returns true, if object tracking is enabled for the type T. More... | |
T * | resolveReference (int objectId) |
Resolves a pointer reference to a previously stored object with the specified full id. More... | |
T * | resolveReference (const std::string &fullId) |
Same as the above method, but here the object id can be specified as full human readable id. More... | |
void | invokeTrackObject (T &member) |
tracks the given object (if pointer tracking is enabled for type T) More... | |
void | reflectUnknown (T &member) |
void | reflectAtomic (T &member) |
Type A1: for atomic members (float,int,etc.) More... | |
void | reflectEnumeration (T &member) |
Type A2: for enums. More... | |
void | reflectArray (T &member) |
Type A3: for arrays. More... | |
void | reflectComplex (T &member) |
Type B1/B2: for complex types. More... | |
void | reflectCollection (T &member) |
Type B?c: for collection types. More... | |
void | reflectPointer (T &member) |
Type C: for members that are pointers. More... | |
void | reflectPointerNormal (T *&member) |
Type C1: for members that are pointers to normal classes. More... | |
void | reflectPointerPolymorphic (T *&member) |
Type C2: for members that are pointers to polymorphic classes derived from mira::Object. More... | |
void | reflectPointerAbstract (T *&member) |
Type C3: for members that are pointers to abstract classes not derived from mira::Object. More... | |
void | chooseReflect (T &member) |
Detect the members type (A1,A2,A3,B1,B2,C) and choose the appropriate function. More... | |
ConcreteBinaryDeserializer< BinaryStream, BinaryFormatVersion > * | This () |
"Curiously recurring template pattern" (CRTP). More... | |
void | invoke (T &object) |
Invokes this reflector on the specified object. More... | |
void | reflectComplexIntrusive (T &object) |
For classes with reflect method call their reflect method directly. More... | |
void | reflectComplexNonintrusive (T &object) |
For classes without reflect method, where we need to look somewhere else to get the information for visiting it. More... | |
void | reflectMissing (T &object) |
Static Protected Member Functions | |
static int | checkForcedVersion (const std::string &variable) |
Protected Attributes | |
ObjectNameToInstanceMap | mObjectNameToInstance |
maps full id names to instance pointers More... | |
ObjectsVector | mObjects |
maps the ids to the instance pointers More... | |
std::stack< TrackingState > | mTrackingStack |
BoostSharedPointerMap | mBoostSharedPointers |
StdSharedPointerMap | mStdSharedPointers |
Static Protected Attributes | |
static constexpr auto | MIRA_REFLECTOR_TOPLEVEL_NAME |
Use this when a reflector needs to choose a name for serializing an object. More... | |
Optional Class Versioning. | |
These visiting methods may be supported by different reflectors like the RecursiveMemberReflector and the RPCMethodReflector, etc.
| |
typedef serialization::ClassVersionMap | ClassVersionMap |
VersionType | version (VersionType version, const T *caller=NULL) |
Specifies the current class version and returns the version found in the data stream. More... | |
VersionType | version (VersionType version, AcceptDesiredVersion, const T *caller=NULL) |
Extension of version() (see above), that additionally signals the reflector that the caller will properly handle a different version than the one it specifies itself. More... | |
MIRA_DEPRECATED ("Please call as requireVersion<MyType>(v, minV) or requireVersion(v, minV, this)", VersionType requireVersion(VersionType version, VersionType minVersion)) | |
Deprecated 'anonymous' (no type) requireVersion(). More... | |
MIRA_DEPRECATED ("Please call as requireVersion<MyType>(v) or requireVersion(v, this)", VersionType requireVersion(VersionType version)) | |
Deprecated 'anonymous' (no type) requireVersion(). More... | |
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 version requirement is not met. More... | |
void | requireVersion (VersionType version, const T *caller=NULL) |
Specifies the current class version, which is also the minimum (and therefore only) version accepted (therefore, no need to return a version number). More... | |
VersionType | requireVersion (VersionType version, VersionType minVersion, AcceptDesiredVersion, const T *caller=NULL) |
Extension of requireVersion() (see above), that additionally signals the reflector that the caller will properly handle a different version than the one it specifies itself. More... | |
void | requireVersion (VersionType version, AcceptDesiredVersion, const T *caller=NULL) |
Extension of requireVersion() (see above), that additionally signals the reflector that the caller will properly handle a different version than it one it specifies itself. More... | |
void | desireClassVersions (const ClassVersionMap &versions) |
Historically, classes have just been defining their current version themselves during serialization (the case where an object exists and its state is read out and serialized), by calling Reflector::version() with the respective version number parameter. More... | |
typedef boost::mpl::bool_<false> useHumanReadableIDs |
typedef std::map<TypeId, BinarySerializerCodecPtr> CodecsMap |
A map of binary serialization codecs.
typedef Format::requireReflectBarriers requireReflectBarriers |
typedef Format::ReflectState ReflectState |
typedef Format::VersionType VersionType |
|
inherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
|
inherited |
Pointer type that is stored as 1-byte marker before storing the pointer.
Enumerator | |
---|---|
NULL_POINTER | |
POINTER_REFERENCE | |
NORMAL_POINTER | |
POLYMORPHIC_POINTER |
|
inline |
Create a new binary deserializer based on the specified stream buffer object.
The stream buffer object must be specified as pointer. If you use this class with BinaryStlIstream, then the stream buffer object must be of the type std::basic_streambuf<_CharT, _Traits> (see corresponding documentation of STL streams). If you use this class with BinaryBufferIstream, the stream buffer object must be of the type std::vector<char>.
|
inline |
Create a new binary deserializer and read the data from the specified binary stream.
|
inline |
Create a new binary deserializer and read the data from the specified binary stream, starting at the specified position.
Can be used to continue reading from the stream when data was read from it before.
|
inline |
Reassigns the specified stream buffer to this deserializer.
The stream buffer usually is specified in the constructor. This method can be used to change the assigned buffer.
|
inline |
|
inline |
Provides a special deserialize interface for the BinaryDeserializer.
It allows to skip the name, since the name is not used by the binary serializer. Instead an optional second parameter is provided that allows to enable an automatic type check. If the type check is enabled the deserializer will read the full typename from the stream before serializing the content. If the types do not match, an XBadCast exception is thrown. If the type check is enabled here, it also must be enabled in the corresponding serialize() call of the BinarySerializer and vice versa. recursive must only be set to true if called from within checkFormatVersion (e.g. of a different version serializer).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Overwrites Deserializer::pointer.
Reads the 1-byte marker to identify the type of the pointer: NULL_POINTER =0, POINTER_REFERENCE =1, NORMAL_POINTER =2, POLYMORPHIC_POINTER =3
If it is null pointer the pointer is set to NULL, if it is a reference then it reads the id string that was stored by the Serializer in pointerReference(). If it is a PolymorphicPointer it reads the class type and calls the pointer() method of the Deserializer base class to deserialize the full object. Otherwise if it is a normal pointer it calls the pointer() method of the Deserializer base class to deserialize the full object.
|
inline |
|
inline |
|
inline |
Specialized for Array to implement an optimized variant for deserializing an array, if possible (i.e.
if object tracking is enabled and each value in the array can be serialized bitwise).
|
inline |
|
inline |
Supported for compatibility with BinarySerializer in a common reflect method.
Always returns false for deserializers.
|
inline |
Decodes the specified object from the serialized data.
If no codec was used to serialize the data, false is returned, and the caller must deserialize the data manually without codec. If no codec for decoding the data exists, an exception is thrown.
|
inline |
Return the map of currently known codecs.
|
inline |
Set the map of known codecs.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Specifies the current class version and returns the version found in the data stream.
During serialization (read-only reflector), the specified version usually is stored as class version in the data stream. However, the serialized version can be overridden by setting a specific version for a certain class identifier, using desireClassVersions(). In that case, version() may return a different value than specified, and the class' reflect() method must implement reflection according to that version number. During deserialization (write-only reflector), the reflector reads the version found in the data stream and returns it. Providing the type of the caller enables defining separate version numbers for all base classes of an inherited type. Each class in the inheritance hierarchy can store and retrieve a version number independently of all its bases or sub-classes (assuming reflect() calls the reflect() method of the base class using reflectBase()). The type of the caller is also required to look up whether a specific version is desired (see desireClassVersions()). The sole purpose of the 'caller' parameter is to enable automatic deduction of the template parameter T. It can be omitted when T is given explicitly.
Usage:
|
inlineinherited |
Extension of version() (see above), that additionally signals the reflector that the caller will properly handle a different version than the one it specifies itself.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Deprecated 'anonymous' (no type) requireVersion().
|
inlineinherited |
Deprecated 'anonymous' (no type) requireVersion().
|
inlinestaticinherited |
Returns either the version number from value of environment variable 'MIRA_FORCE_DESERIALIZE_VERSION', or -1 (= do not force a version).
|
inlineinherited |
Deserializes the specified object value with the given name.
If you overwrite this method in a derived class you usually SHOULD call this method of the base class.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedinherited |
Returns true, if object tracking is enabled for the type T.
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedinherited |
Resolves a pointer reference to a previously stored object with the specified full id.
This is usually called by the derived concrete deserializer that has implemented the pointer() method where it detects a stored pointer reference. Instead of calling the pointer() method of this base class it then has to call this method to resolve the pointer reference. If no object with the given ID exits, an exception is thrown.
|
inlineprotectedinherited |
Same as the above method, but here the object id can be specified as full human readable id.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Delegates the serialization directly to the specified member, without creating a separate compound for the current object.
This method usually is used together with IsTransparentSerializable. Note: only one call of delegate is allowed within one reflect method.
|
inlineinherited |
Delegates the serialization directly to the specified member, without creating a separate compound for the current object.
This method usually is used together with IsTransparentSerializable. Note: only one call of delegate is allowed within one reflect method.
|
inlineinherited |
Delegates the serialization directly to the specified member, without creating a separate compound for the current object.
This method usually is used together with IsTransparentSerializable. Note: only one call of delegate is allowed within one reflect method.
|
inlineinherited |
Is called by the if the member is an enumeration.
(Type A2)
As for all the other visit-methods the parameter is a reference to the actual visited/reflected member.
The default implementation casts the enum to an uint32 and calls atomic().
|
inlineinherited |
Is called for each complex object.
See documentation of RecursiveMemberReflectorBase class for detailed calling sequences. If you overwrite this method in a derived class you should call the method of the Base class to allow recursive reflection of the complex object's members.
|
inlineinherited |
Is called for each complex object or array, where the IsCollection<T> trait is true_type.
The default implementation calls object().
|
inlinestaticinherited |
Registers a new polymorphic class at the PolymorphPointerReflector.
Each RecursiveMemberReflector only is able to process pointers to polymorphic classes that are registered using this method.
The MIRA_CLASS_SERIALIZATION macro provides a simple mechanism to register a class in all known MemberReflectors and calls their registerClass() method. If you implement a new MemberReflector you should modify the MIRA_CLASS_SERIALIZATION macro and add your reflector there.
|
inlinestaticinherited |
Unregisters the class.
The MIRA_CLASS_SERIALIZATION macro provides a simple mechanism to register a class in all known MemberReflectors and calls their registerClass() method. If you implement a new MemberReflector you should modify the MIRA_CLASS_SERIALIZATION macro and add your reflector there.
|
inlineinherited |
Returns the meta-information of the current member that is reflected.
|
inlineinherited |
Returns the full human readable object id / name of the current member being reflected.
This method must not be called if the Reflector has set useHumanReadableIDs to false. If it is called anyway we will assert here.
|
inlinestaticinherited |
For internal use only: Returns true, if the type T is ever reflected as pointer within the current translation unit (C file).
|
inlineprotectedinherited |
tracks the given object (if pointer tracking is enabled for type T)
|
inlineprotectedinherited |
|
inlineprotectedinherited |
Type A1: for atomic members (float,int,etc.)
|
inlineprotectedinherited |
Type A2: for enums.
|
inlineprotectedinherited |
Type A3: for arrays.
|
inlineprotectedinherited |
Type B1/B2: for complex types.
|
inlineprotectedinherited |
Type B?c: for collection types.
|
inlineprotectedinherited |
Type C: for members that are pointers.
|
inlineprotectedinherited |
Type C1: for members that are pointers to normal classes.
|
inlineprotectedinherited |
Type C2: for members that are pointers to polymorphic classes derived from mira::Object.
|
inlineprotectedinherited |
Type C3: for members that are pointers to abstract classes not derived from mira::Object.
|
inlineprotectedinherited |
Detect the members type (A1,A2,A3,B1,B2,C) and choose the appropriate function.
|
inlineinherited |
Is called to invoke this Reflector on the member with the specified meta information.
This method delegates the call to the most derived invokeMemberOverwrite() method that may be overwritten in subclasses.
|
inlineinherited |
The actual invokeMember implementation that is called from invokeMember().
This method may be overwritten in derived classes to add additional functionality, however, you should always call this implementation of the base class.
|
inlineinherited |
Is called to reflect objects of pointers.
They will use the same meta as the pointer
|
inlineinherited |
Delegates to invokeMember() and rethrows any occurring XMemberNotFound exception as XIO exception.
|
inlineinherited |
Delegates to invokeMember() and handles any occurring XMemberNotFound exception by setting the member to the given default value.
|
inlineinherited |
Delegates to invokeMember() and handles any occurring XMemberNotFound exception by ignoring the exception and hence the missing member, as indicated by IgnoreMissing as default value.
The value of the member remains unchanged.
|
inlineinherited |
implements ReflectorInterface (for documentation see ReflectorInterface)
|
inlineinherited |
implements ReflectorInterface (for documentation see ReflectorInterface)
|
inlineinherited |
implements ReflectorInterface (for documentation see ReflectorInterface)
|
inlineinherited |
implements ReflectorInterface (for documentation see ReflectorInterface)
|
inlineinherited |
Same as above, but allows to specify a minimum supported version, and throws XIO if the minimum version requirement is not met.
Calls version() internally.
Usage:
|
inlineinherited |
Specifies the current class version, which is also the minimum (and therefore only) version accepted (therefore, no need to return a version number).
See above.
|
inlineinherited |
Extension of requireVersion() (see above), that additionally signals the reflector that the caller will properly handle a different version than the one it specifies itself.
|
inlineinherited |
Extension of requireVersion() (see above), that additionally signals the reflector that the caller will properly handle a different version than it one it specifies itself.
|
inlineinherited |
implements ReflectorInterface (for documentation see ReflectorInterface)
|
inlineprotectedinherited |
"Curiously recurring template pattern" (CRTP).
Safely casts this into Derived. This is safe since when implementing derived class their type is passed as template parameter.
See Wikipedia for more details on CRTP if necessary!
|
inlineprotectedinherited |
Invokes this reflector on the specified object.
This is like calling object.reflect(*this). However, this automatically examines if the class T contains a reflect method. In this case it calls the intrusive reflect method, otherwise it uses the non-intrusive reflect method.
|
inlineprotectedinherited |
For classes with reflect method call their reflect method directly.
|
inlineprotectedinherited |
For classes without reflect method, where we need to look somewhere else to get the information for visiting it.
To do so we call a global non-intrusive reflect-function which must be specialized for the visitor and the member type. This allows non-intrusive reflection. If the non-intrusive reflect method does not exist we will get a compiler error here!
|
inlineprotectedinherited |
|
inlineinherited |
Historically, classes have just been defining their current version themselves during serialization (the case where an object exists and its state is read out and serialized), by calling Reflector::version() with the respective version number parameter.
Different versions of a class were only considered during deserialization (i.e. restoring an object state from serialized data). In some cases it may be desirable, however, to serialize a different version (naturally, this can not be a higher version than the class implementation knows, only lower). This is useful e.g. to ensure serializing data that is compatible with a certain other (older) implementation, thus it can be deserialized by another instance.
For such cases, a mechanism is provided to generally enable requesting a specific version for any class from the reflector. This involves providing a map of class types (type names) to version numbers to the reflector. When a class contained in the map calls version() in its reflect() method, the call shall return the version number from the version map instead of the version number indicated by the class implementation itself. The class serialization must then follow that returned version.
A call to this method will always overwrite any previous setting of desired versions, i.e. the map is not cumulative.
|
inlineinherited |
A property that just reflects a runtime state of the object and can be displayed but not altered.
|
inlineinherited |
Same as above, with an extra parameter for specifying the id explicitly if it differs from name.
|
inlineinherited |
Same as above, with a special getter method for reading the member.
|
inlineinherited |
If the currently reflected object is an item within a collection, this allows to specify an explicit name for that item.
This currently is interpreted by the PropertySerializer only.
|
inlineinherited |
Indicates that the class implements the specified RPC interface.
If you indicate that your class implements the specified interface by calling this method in your reflect method, there is an implicit contract that your class provides all methods that are defined by that interface.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Specifies that the class that is reflected provides a service through the specified static member function or free function.
The method will then be available for RPC calls. For each method its name (used to identify the method in RPC calls) and a comment that describes the method must be specified.
name | The name of the method (used for calling it) |
method | The static member function (or free function) that implements the method |
comment | A comment that describes the method |
paramName | Optional additional argument(s) for the names of the method's parameters |
paramDescription | Optional additional argument(s) for the descriptions of the method's parameters. |
paramSampleValue | Optional additional argument(s) providing a sample value for each parameter. These are not default values, they are only used for documentation purpose, and should mainly serve to illustrate notation. |
The optional parameter documentation arguments must be either a sequence of pairs of const char* values or a sequence of triplets, where each third value is a value of the respective method parameter's type. (name and description must both be provided, for all parameters or for none, and if sample values are to be added, they also need to be added for all parameters).
Examples:
|
inherited |
Specifies that the class that is reflected provides a service through the specified non-static member function.
The method will then be available for RPC calls. For each method its name (used to identify the method in RPC calls) and a comment that describes the method must be specified.
name | The name of the method (used for calling it) |
method | The non-static member function (const or non-const) that implements the method |
object | A pointer to the object on which the function is called (usually "this") |
comment | A comment that describes the method |
paramName | Optional additional argument(s) for the names of the method's parameters |
paramDescription | Optional additional argument(s) for the descriptions of the method's parameters. |
paramSampleValue | Optional additional argument(s) providing a sample value for each parameter. |
See above for documentation of optional parameter documentation arguments.
Example:
|
inherited |
Specifies that the class that is reflected provides a service through the specified function wrapper.
The method will then be available for RPC calls. For each method its name (used to identify the method in RPC calls) and a comment that describes the method must be specified.
name | The name of the method (used for calling it) |
method | The function wrapper object that implements the method, e.g. created using boost::bind |
comment | A comment that describes the method |
paramName | Optional additional argument(s) for the names of the method's parameters |
paramDescription | Optional additional argument(s) for the descriptions of the method's parameters. |
paramSampleValue | Optional additional argument(s) providing a sample value for each parameter. |
See above for documentation of optional parameter documentation arguments.
Example:
|
inlineinherited |
|
inlinestaticinherited |
Returns true, if the concrete derived Reflector supports human readable IDs.
The return value of this method is known at compile time and hence the compiler is able to optimize the code depending on that value.
|
inlineinherited |
See preReflect for documentation.
|
inlinestaticprotectedinherited |
|
protectedinherited |
maps full id names to instance pointers
|
protectedinherited |
maps the ids to the instance pointers
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
staticprotectedinherited |
Use this when a reflector needs to choose a name for serializing an object.
Internally this is used to recognize it is not a name defined by the reflected object, but by the reflector.