A helper class to provide some basic mechanism of C++ reflection (introspection).
Properties of objects can be accessed/listed as name-value pairs. Names are those provided in the CHNVP pairs in ArchiveOut/ArchiveIn. As this is a quite simple reflection system, the value is always passed as void*, it is up to you to do the proper static_cast<> to the class of the object. There are some shortcuts though, to access double, int and other fundamental types with a single statement.
|
template<class T, class P> |
bool | FetchValue (P &val, const T &root, const std::string &property_name) |
| Search a property in "root" and directly assign it to "vl".
|
|
template<class T> |
std::vector< ChValue * > & | FetchValues (T &root, const std::string &value_name) |
| Search one or more values in "root" and return reference to a vector with results.
|
|
std::vector< ChValue * > & | FetchValues (ChValue &root, const std::string &value_name) |
| Same as generic FetchValues(), but specialized for the case of finding sub ChValue properties of an already found ChValue.
|
|
std::vector< ChValue * > & | GetFetchResults () |
| Access the results of the last search, ex. after FetchValues()
|
|
template<class T> |
bool | IsObject (const T &root) |
| Tell if "root" has sub values (i.e.
|
|
bool | IsObject (ChValue &root) |
| Tell if "root" has sub values (i.e.
|
|
void | SetUseWildcards (const bool mw) |
|
bool | GetUseWildcards () |
|
void | SetUseUserNames (const bool mw) |
|
bool | GetUseUserNames () |
|
virtual void | out (ChNameValue< bool > bVal) |
|
virtual void | out (ChNameValue< int > bVal) |
|
virtual void | out (ChNameValue< double > bVal) |
|
virtual void | out (ChNameValue< float > bVal) |
|
virtual void | out (ChNameValue< unsigned int > bVal) |
|
virtual void | out (ChNameValue< unsigned long > bVal) |
|
virtual void | out (ChNameValue< unsigned long long > bVal) |
|
virtual void | out (ChNameValue< ChEnumMapperBase > bVal) |
|
virtual void | out (ChNameValue< char > bVal) |
|
virtual void | out (ChNameValue< std::string > bVal) |
|
virtual void | out_array_pre (ChValue &bVal, size_t msize) |
|
virtual void | out_array_between (ChValue &bVal, size_t msize) |
|
virtual void | out_array_end (ChValue &bVal, size_t msize) |
|
virtual void | out (ChValue &bVal, bool tracked, size_t obj_ID) |
|
virtual void | out_ref (ChValue &bVal, bool already_inserted, size_t obj_ID, size_t ext_ID) |
|
void | SetCutAllPointers (bool mcut) |
| If you enable SetCutAllPointers(true), no serialization happens for objects referenced via pointers.
|
|
std::unordered_set< void * > & | CutPointers () |
| Access the container of pointers that must not be serialized.
|
|
void | UnbindExternalPointer (void *mptr, size_t ID) |
| Use the following to declare pointer(s) that must not be de-serialized but rather be 'unbind' and be saved just as unique IDs.
|
|
void | UnbindExternalPointer (std::shared_ptr< void > mptr, size_t ID) |
| Use the following to declare pointer(s) that must not be de-serialized but rather be 'unbind' and be saved just as unique IDs.
|
|
virtual void | out (ChNameValue< FunGetSet< bool > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< int > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< double > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< float > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< char > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< unsigned int > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< const char * > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< unsigned long > > bVal) const |
|
virtual void | out (ChNameValue< FunGetSet< unsigned long long > > bVal) const |
|
template<class T> |
void | out (ChNameValue< ChEnumMapper< T > > bVal) |
|
template<class T, size_t N> |
void | out (ChNameValue< T[N]> bVal) |
|
template<class T> |
void | out (ChNameValue< std::vector< T > > bVal) |
|
template<class T> |
void | out (ChNameValue< std::list< T > > bVal) |
|
template<class T, class Tv> |
void | out (ChNameValue< std::pair< T, Tv > > bVal) |
|
template<class T, class Tv> |
void | out (ChNameValue< std::unordered_map< T, Tv > > bVal) |
|
template<class T, class Tv> |
void | out (ChNameValue< std::map< T, Tv > > bVal) |
|
template<class T> |
void | out (ChNameValue< std::shared_ptr< T > > bVal) |
|
template<class T> |
void | out (ChNameValue< T * > bVal) |
|
template<class T> |
void | out (ChNameValue< T > bVal) |
|
template<class T> |
ChArchiveOut & | operator<< (ChNameValue< T > bVal) |
| Operator to allow easy serialization as myarchive << mydata;.
|
|
void | VersionWrite (int iv) |
|
template<class T> |
void | VersionWrite () |
|
void | SetUseVersions (bool muse) |
| Turn off version info in archives.
|
|
void | SetClusterClassVersions (bool mcl) |
| If true, the version number is not saved in each class.
|
|