Description

Collaboration diagram for Serialization:

Classes

class  chrono::ChFunctorArchiveIn
 Functor to call the ArchiveIn function for unrelated classes that implemented them. More...
 
class  chrono::ChNameValue< T >
 Class to manage name-value pairs for serialization/deserialization. More...
 
class  chrono::ChValue
 Class to 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
 Base class for archives with pointers to shared objects. More...
 
class  chrono::ChArchiveOut
 Base class for serializing into archives. More...
 
class  chrono::ChArchiveIn
 Base class for deserializing from archives. More...
 

Macros

#define MAKE_GETSET_FUNPAIR(returnType, codeGet, codeSet)
 Macro to create a ChDetect_ArchiveInConstructor that can be used in templates, to select which specialized template to use. More...
 
#define FIRST(...)   FIRST_HELPER(__VA_ARGS__, throwaway)
 
#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(...)
 
#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)
 

Enumerations

enum  ChCausalityType {
  parameter, calculatedParameter, input, output,
  local, independent
}
 
enum  ChVariabilityType {
  constant, fixed, tunable, discrete,
  continuous
}
 

Functions

template<class T >
ChNameValue< T > chrono::make_ChNameValue (const std::string &auto_name, const T &t, const std::string &custom_name, char flags=0, ChCausalityType causality=ChCausalityType::local, ChVariabilityType variability=ChVariabilityType::continuous)
 
template<class T >
ChNameValue< T > chrono::make_ChNameValue (const std::string &auto_name, const T &t, char flags=0, ChCausalityType causality=ChCausalityType::local, ChVariabilityType variability=ChVariabilityType::continuous)
 
virtual void chrono::ChValueSpecific< TClass >::CallOut (ChArchiveOut &archive_out)
 

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; \
} \
} \
;

◆ MAKE_GETSET_FUNPAIR

#define MAKE_GETSET_FUNPAIR (   returnType,
  codeGet,
  codeSet 
)
Value:
std::make_pair(std::function<returnType()>([this]() -> returnType codeGet), \
std::function<void(returnType)>([this](returnType val) codeSet))

Macro to create a ChDetect_ArchiveInConstructor that can be used in templates, to select which specialized template to use.

Macro to create a ChDetect_ArchiveOutConstructor that can be used in templates, to select which specialized template to use Macro to create a ChDetect_ArchiveOut that can be used in templates, to select which specialized template to use Macro to create a ChDetect_ArchiveIn that can be used in templates, to select which specialized template to use Macro to create a ChDetect_ArchiveContainerName that can be used in templates, to select which specialized template to use

◆ NUM

#define NUM (   ...)
Value:
SELECT_10TH(__VA_ARGS__, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, \
ONE, throwaway)