Description

This is a class for deserializing from JSON archives.

#include <ChArchiveJSON.h>

Inheritance diagram for chrono::ChArchiveInJSON:
Collaboration diagram for chrono::ChArchiveInJSON:

Public Member Functions

 ChArchiveInJSON (ChStreamInAsciiFile &mistream)
 
rapidjson::Value * GetValueFromNameOrArray (const char *mname)
 
virtual void in (ChNameValue< bool > bVal)
 
virtual void in (ChNameValue< int > bVal)
 
virtual void in (ChNameValue< double > bVal)
 
virtual void in (ChNameValue< float > bVal)
 
virtual void in (ChNameValue< char > bVal)
 
virtual void in (ChNameValue< unsigned int > bVal)
 
virtual void in (ChNameValue< std::string > bVal)
 
virtual void in (ChNameValue< unsigned long > bVal)
 
virtual void in (ChNameValue< unsigned long long > bVal)
 
virtual void in (ChNameValue< ChEnumMapperBase > bVal)
 
virtual void in_array_pre (const char *name, size_t &msize)
 
virtual void in_array_between (const char *name)
 
virtual void in_array_end (const char *name)
 
virtual void in (ChNameValue< ChFunctorArchiveIn > bVal)
 
virtual void * in_ref (ChNameValue< ChFunctorArchiveIn > bVal)
 
void SetTolerateMissingTokens (bool mtol)
 By default, if a token is missing (respect to those required by << deserialization in c++) an exception is thrown. More...
 
- Public Member Functions inherited from chrono::ChArchiveIn
void RebindExternalPointer (void *mptr, size_t ID)
 Use the following to declare object IDs that must not be de-serialized but rather be 'rebind' to already-existing external pointers, given unique IDs. More...
 
void RebindExternalPointer (std::shared_ptr< void > mptr, size_t ID)
 Use the following to declare object IDs that must not be de-serialized but rather be 'rebind' to already-existing external shared pointers, given unique IDs. More...
 
template<class T >
void in (ChNameValue< ChEnumMapper< T > > bVal)
 
template<class T , size_t N>
void in (ChNameValue< T[N]> bVal)
 
template<class T >
void in (ChNameValue< std::vector< T > > bVal)
 
template<class T >
void in (ChNameValue< std::list< T > > bVal)
 
template<class T , class Tv >
void in (ChNameValue< std::pair< T, Tv > > bVal)
 
template<class T , class Tv >
void in (ChNameValue< std::unordered_map< T, Tv > > bVal)
 
template<class T >
void in (ChNameValue< std::shared_ptr< T > > bVal)
 
template<class T >
void in (ChNameValue< T * > bVal)
 
template<class T >
void in (ChNameValue< T > bVal)
 
template<class T >
ChArchiveInoperator>> (ChNameValue< T > bVal)
 Operator to allow easy serialization as myarchive << mydata;.
 
int VersionRead ()
 
template<class T >
int VersionRead ()
 
- Public Member Functions inherited from chrono::ChArchive
void SetUseVersions (bool muse)
 By default, version numbers are saved in archives Use this to turn off version info in archives (either save/load both with version info, or not, do not mix because it could give problems in binary archives.).
 
void SetClusterClassVersions (bool mcl)
 If true, the version number is not saved in each class: rather, it is saved only the first time that class is encountered. More...
 

Protected Member Functions

void token_notfound (const char *mname)
 
- Protected Member Functions inherited from chrono::ChArchiveIn
void PutPointer (void *object, bool &already_stored, size_t &obj_ID)
 Find a pointer in pointer map: eventually add it to map if it was not previously inserted. More...
 
virtual int in_version (const std::type_info &mtype)
 

Protected Attributes

ChStreamInAsciiFileistream
 
rapidjson::Document document
 
rapidjson::Value * level
 
std::stack< rapidjson::Value * > levels
 
std::stack< bool > is_array
 
std::stack< int > array_index
 
bool tolerate_missing_tokens
 
- Protected Attributes inherited from chrono::ChArchiveIn
std::unordered_map< void *, size_t > internal_ptr_id
 
std::unordered_map< size_t, void * > internal_id_ptr
 
size_t currentID
 
std::unordered_map< void *, std::shared_ptr< void > > shared_ptr_map
 
std::unordered_map< size_t, void * > external_id_ptr
 container of pointers marker with external IDs to re-bind instead of de-serializing
 
- Protected Attributes inherited from chrono::ChArchive
bool cluster_class_versions
 
std::unordered_map< std::type_index, int > class_versions
 
bool use_versions
 

Member Function Documentation

◆ SetTolerateMissingTokens()

void chrono::ChArchiveInJSON::SetTolerateMissingTokens ( bool  mtol)
inline

By default, if a token is missing (respect to those required by << deserialization in c++) an exception is thrown.

This function can deactivate the exception throwing, so the default c++ variables values are left, if no token is found.


The documentation for this class was generated from the following file:
  • /builds/uwsbel/chrono/src/chrono/serialization/ChArchiveJSON.h