MIRA
|
Serializer for serializing objects in JSON format. More...
#include <serialization/JSONSerializer.h>
Public Types | |
enum | OutputFormat { STANDARD = 0x00, STRING_MAP_AS_OBJECT = 0x01 } |
Flags for JSON output format. More... | |
typedef boost::mpl::bool_< true > | isReadOnly |
typedef boost::mpl::bool_< true > | isObjectTrackingSupported |
typedef Base::VersionType | VersionType |
typedef Base::ClassVersionMap | ClassVersionMap |
typedef ReflectorInterface< JSONSerializer >::AcceptDesiredVersion | AcceptDesiredVersion |
typedef boost::mpl::bool_< true > | useHumanReadableIDs |
Specifies, if the Reflector supports human readable IDs. More... | |
typedef boost::mpl::bool_< false > | requireReflectBarriers |
Specifies whether the Reflector uses so-called 'reflect barriers' to allow maintaining separate states for individual blocks of reflected data. More... | |
Public Member Functions | |
MIRA_ENUM_TO_FLAGS_INCLASS (OutputFormat) JSONSerializer(bool readOnly | |
Construct a serializer. More... | |
template<typename T > | |
VersionType | version (VersionType version, const T *caller=NULL) |
MIRA_DEPRECATED ("Please call as version<MyType>(v) or version(v, this)", VersionType version(VersionType version)) | |
template<typename T > | |
VersionType | version (VersionType version, AcceptDesiredVersion, const T *caller=NULL) |
template<typename T > | |
void | atomic (T &member) |
void | atomic (json::Value &member) |
template<typename T > | |
void | object (T &member) |
template<typename T > | |
void | collection (T &member) |
template<typename mapped_type > | |
void | collection (std::map< std::string, mapped_type > &member) |
void | pointerReference (int referencedObjectID) |
void | pointerWithClassType (const std::string &type) |
void | pointerNull () |
template<typename T > | |
void | roproperty (const char *name, const T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
template<typename T > | |
void | roproperty (const char *name, const std::string &id, const T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
template<typename T > | |
void | roproperty (const char *name, Getter< T > getter, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE) |
template<typename Container > | |
void | mapEntry (int id, const typename Container::value_type &p) |
void | desireClassVersions (const ClassVersionMap &versions) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
void | serialize (const std::string &name, const T &value, const std::string &comment="") |
Serializes the specified object value under the given name. More... | |
void | trackObject (T &member) |
void | pointer (T *&pointer) |
void | pointerNormal (T *&pointer, int typeId) |
void | pointerPolymorphic (T *&pointer, int typeId) |
void | pointerAbstract (T *&pointer, int typeId) |
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... | |
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 | reflectBase (Base &base) |
implements ReflectorInterface (for documentation see ReflectorInterface) More... | |
ReflectState | preReflect (const char *context="") |
If a reflector requires reflection barriers, preReflect() and postReflect() should be called before/after calling an external method within reflect(), to declare these barriers (such a 'barrier' is just a declaration to the reflector, in fact). More... | |
void | postReflect (const ReflectState &) |
See preReflect for documentation. More... | |
Special Pointer Handlers For Overwriting | |
void | pointerWithoutClassType () |
Is called if a pointer points to a non-polymorphic type and hence the object can be stored without specifying a class type. 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... | |
Optional Class Versioning. | |
These visiting methods may be supported by different reflectors like the RecursiveMemberReflector and the RPCMethodReflector, etc.
| |
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... | |
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 | 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... | |
Methods for reflecting members | |
These visiting methods are supported by the RecursiveMemberReflector. | |
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... | |
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... | |
Static Public Member Functions | |
static int | forcedSerializeVersion () |
Returns either the version number from value of environment variable 'MIRA_FORCE_SERIALIZE_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... | |
Public Attributes | |
OutputFormat | format |
Protected Types | |
typedef std::set< AObject > | ObjectSet |
typedef std::map< int, std::string > | ObjectIDToNameMap |
typedef std::pair< ObjectSet, ObjectIDToNameMap > | TrackingState |
Protected Member Functions | |
VersionType | queryDesiredClassVersion (VersionType version, const std::string &type, bool acceptDesiredVersion=false) |
VersionType | queryDesiredClassVersion (VersionType version, bool acceptDesiredVersion=false) |
bool | isTrackingEnabled () const |
Returns true, if object tracking is enabled for the type T. More... | |
const std::string & | getHumanReadableFullID (int objectID) const |
Returns the full human readable object id / name for the given internal objectID. More... | |
void | invokeTrackObject (T &member) |
tracks the given object (if pointer tracking is enabled for type T) More... | |
JSONSerializer * | This () |
"Curiously recurring template pattern" (CRTP). More... | |
void | invoke (T &object) |
Invokes this reflector on the specified object. More... | |
void | invokeOverwrite (T &object) |
The actual invoke implementation, that may also be overwritten in derived classes to add additional functionality. More... | |
Static Protected Member Functions | |
static int | checkForcedVersion (const std::string &variable) |
Protected Attributes | |
ClassVersionMap | mDesiredClassVersions |
ObjectSet | mObjects |
ObjectIDToNameMap | mObjectIDToName |
std::stack< TrackingState > | mTrackingStack |
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... | |
Serializer for serializing objects in JSON format.
Example usage:
For the deserialization of JSON content see JSONDeserializer.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
|
inherited |
Specifies, if the Reflector supports human readable IDs.
This type must be set to the proper boost::mpl::bool type by the derived Reflector class. (Default is true)
|
inherited |
Specifies whether the Reflector uses so-called 'reflect barriers' to allow maintaining separate states for individual blocks of reflected data.
A reflect barrier is just a virtual separation line declared by a reflected object. It tells the reflector that certain parts of the reflected data should be considered as independent and can have separate states (if the reflector maintains any states for data). As an example, the BinarySerializer reserves space for a version number for each reflected object. If there is more than one individual block, it reserves space for a version for each of the blocks. If the reflector needs reflect barriers, it defines requireReflectBarriers::type to true in its class scope, and defines methods preReflect() and postReflect() that should be called by reflected objects for separation of independent reflection blocks (where the separation is not already implied by visitors like reflector.member()!) (The default is false). Also see ReflectState and MIRA_REFLECT_CALL.
enum OutputFormat |
MIRA_ENUM_TO_FLAGS_INCLASS | ( | OutputFormat | ) |
Construct a serializer.
readOnly | If true it also visits ro properties and creates JSON output that should NOT be used to deserialize an object from. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestaticinherited |
Returns either the version number from value of environment variable 'MIRA_FORCE_SERIALIZE_VERSION', or -1 (= do not force a version).
|
inlineinherited |
implements ReflectorInterface (for documentation see ReflectorInterface)
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineinherited |
Serializes the specified object value under the given name.
If you overwrite this method in a derived class you usually MUST call this method of the base class.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Is called if a pointer points to a non-polymorphic type and hence the object can be stored without specifying a class type.
It can be implemented by derived concrete serializers to indicate that no pointer reference and no class type needs to be stored and the full object will follow afterwards. (this is used by the BinarySerializer)
|
inlineprotectedinherited |
Returns true, if object tracking is enabled for the type T.
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedinherited |
Returns the full human readable object id / name for the given internal objectID.
The human readable id only is available, if the Reflector has set useHumanReadableIDs to true.
|
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().
|
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)
|
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 |
|
inlineinherited |
|
inlineinherited |
Deprecated 'anonymous' (no type) requireVersion().
|
inlineinherited |
Deprecated 'anonymous' (no type) requireVersion().
|
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 |
The actual invoke implementation, that may also be overwritten in derived classes to add additional functionality.
|
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 |
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.
|
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:
|
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 |
If a reflector requires reflection barriers, preReflect() and postReflect() should be called before/after calling an external method within reflect(), to declare these barriers (such a 'barrier' is just a declaration to the reflector, in fact).
The base implementation is empty and should not actually be called (if a reflector needs these methods, it must provide own definitions).
context | Can be used to provide context, e.g. name of the reflected class or function that is called. How this is used depends on the reflector implementation, e.g. MetaSerializer uses it to generate comments on data elements implicitly defined by preReflect. |
The complete process of calling these methods is wrapped by MIRA_REFLECT_CALL. That macro should be used to simplify handling.
See requireReflectBarriers and ReflectState.
|
inlineinherited |
See preReflect for documentation.
|
inlinestaticprotectedinherited |
OutputFormat format |
|
protectedinherited |
|
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.