MIRA
|
Macros for use with reflectors. More...
#include <utility>
Go to the source code of this file.
Namespaces | |
mira | |
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec> | |
mira::serialization::barrier | |
Macros | |
#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. More... | |
Typedefs | |
template<typename Reflector > | |
using | State = typename Reflector::ReflectState |
Functions | |
template<typename Reflector > | |
auto | preCommand (Reflector &r, const char *context) -> State< Reflector > |
template<typename Reflector > | |
void | postCommand (Reflector &r, State< Reflector > &&state) |
Macros for use with reflectors.
#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.
The reflector will then regard these as separate reflection blocks and keep a separate state for them. E.g. the BinarySerializer can allow these blocks to have separate reflection versions and will make sure these version numbers are correctly serialized (and deserialized later). Without making the reflector aware, it might know only one state for these different blocks, e.g. the BinarySerializer would potentially assume a version is reported twice for the same object (possibly with different version numbers!), and throw an exception. MIRA_REFLECT_CALL is used to insert the code required to mark the start and end of a call to a separate reflection function to the reflector. It can thus be seen as a generalization of the concept of using reflectBase()/MIRA_REFLECT_BASE instead of calling Base::reflect() directly.
context must be a const char* that must persist until after postCommand (e.g. use a string literal or create a static const string).