Serialization
Description
Collaboration diagram for Serialization:
Classes | |
class | chrono::ChExceptionArchive |
Macro to create a ChDetect_ArchiveINconstructor that can be used in templates, to select which specialized template to use. More... | |
class | chrono::ChFunctorArchiveIn |
Functor to call the ArchiveIN function for unrelated classes that implemented them. More... | |
class | chrono::ChNameValue< T > |
This is a base class for name-value pairs. More... | |
class | chrono::ChValue |
Class that handle C++ values of generic type using type erasure and functors. More... | |
class | chrono::ChEnumMapperBase |
Class for mapping enums to ChNameValue pairs that contain a 'readable' ascii string of the selected enum. More... | |
class | chrono::ChArchive |
This is a base class for archives with pointers to shared objects. More... | |
class | chrono::ChArchiveOut |
This is a base class for serializing into archives. More... | |
class | chrono::ChArchiveIn |
This is a base class for serializing from archives. More... | |
Macros | |
#define | FIRST(...) FIRST_HELPER(__VA_ARGS__, throwaway) |
Macros to create ChNameValue objects easier. | |
#define | FIRST_HELPER(first, ...) first |
#define | REST(...) REST_HELPER(NUM(__VA_ARGS__), __VA_ARGS__) |
#define | REST_HELPER(qty, ...) REST_HELPER2(qty, __VA_ARGS__) |
#define | REST_HELPER2(qty, ...) REST_HELPER_##qty(__VA_ARGS__) |
#define | REST_HELPER_ONE(first) |
#define | REST_HELPER_TWOORMORE(first, ...) , __VA_ARGS__ |
#define | NUM(...) SELECT_10TH(__VA_ARGS__, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, ONE, throwaway) |
#define | SELECT_10TH(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, ...) a10 |
#define | STRINGIFY0(v) #v |
#define | STRINGIFY(v) STRINGIFY0(v) |
#define | CHNVP(...) make_ChNameValue("" STRINGIFY(FIRST(__VA_ARGS__)) "", FIRST(__VA_ARGS__) REST(__VA_ARGS__) ) |
Use this macro to mark a value, ex myarchive << CHNVP (myvalue, "mnemonic name") or, not providing the mnemonic name, the name will be get from the C name of the variable: myarchive << CHNVP (myvalue) | |
#define | CH_ENUM_MAPPER_BEGIN(__enum_type) |
Three macros to simplify the use of enum mapper. More... | |
#define | CH_ENUM_VAL(...) this->AddMapping("" STRINGIFY(FIRST(__VA_ARGS__)) "", FIRST(__VA_ARGS__) REST(__VA_ARGS__) ); |
#define | CH_ENUM_MAPPER_END(__enum_type) |
Functions | |
template<class T > | |
ChNameValue< T > | chrono::make_ChNameValue (const char *auto_name, const T &t, const char *custom_name, char flags=0) |
template<class T > | |
ChNameValue< T > | chrono::make_ChNameValue (const char *auto_name, const T &t, char flags=0) |
virtual void | chrono::ChValueSpecific< TClass >::CallOut (ChArchiveOut &marchive) |
Macro Definition Documentation
◆ CH_ENUM_MAPPER_BEGIN
#define CH_ENUM_MAPPER_BEGIN | ( | __enum_type | ) |
Value:
class __enum_type##_mapper : public ChEnumMapper< __enum_type > { \
public: \
__enum_type##_mapper() {
Three macros to simplify the use of enum mapper.
Use them always in sequence, with nothing else in between. Possibly, use them just after you defined an enum. After this, you have a class called "MyEnum_mapper", inherited from ChEnumMapper, and you can use it for converting enums from/to strings. Example:
enum eChMyenum { ATHLETIC = 0, SKINNY = 3, FAT };
CH_ENUM_MAPPER_BEGIN(MyEnum); CH_ENUM_VAL(ATHLETIC); CH_ENUM_VAL(SKINNY); CH_ENUM_VAL(FAT, "fatty"); // overrides the "FAT" mapped string with "fatty" CH_ENUM_MAPPER_END(MyEnum);
◆ CH_ENUM_MAPPER_END
#define CH_ENUM_MAPPER_END | ( | __enum_type | ) |
Value:
}; \
ChEnumMapper< __enum_type > operator() ( __enum_type & mval) { \
ChEnumMapper< __enum_type > res(this->enummap); \
res.value_ptr = &mval; \
return res; \
} };