Description

Base class for deserializing from archives.

#include <ChArchive.h>

Inheritance diagram for chrono::ChArchiveIn:
Collaboration diagram for chrono::ChArchiveIn:

Public Member Functions

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...
 
bool CanTolerateMissingTokens () const
 Returns true if the class can tolerate missing tokes; on the contrary the archive must contain a complete set of info about the object that is going to be loaded.
 
virtual bool TryTolerateMissingTokens (bool try_tolerate)
 Suggest the archive to tolerate missing tokens/properties in the archive file; The function returns the new settings: for those classes for which CanTolerateMissingTokens returns false this function does not have any effect and will trivially return false.
 
bool GetTolerateMissingTokens () const
 Returns true if the archive is currently tolerating missing tokens.
 
virtual bool in (ChNameValue< bool > bVal)=0
 
virtual bool in (ChNameValue< int > bVal)=0
 
virtual bool in (ChNameValue< double > bVal)=0
 
virtual bool in (ChNameValue< float > bVal)=0
 
virtual bool in (ChNameValue< char > bVal)=0
 
virtual bool in (ChNameValue< unsigned int > bVal)=0
 
virtual bool in (ChNameValue< std::string > bVal)=0
 
virtual bool in (ChNameValue< unsigned long > bVal)=0
 
virtual bool in (ChNameValue< unsigned long long > bVal)=0
 
virtual bool in (ChNameValue< ChEnumMapperBase > bVal)=0
 
virtual bool in (ChNameValue< ChFunctorArchiveIn > bVal)=0
 
virtual bool in_ref (ChNameValue< ChFunctorArchiveIn > bVal, void **ptr, std::string &true_classname)=0
 
virtual bool in_array_pre (const std::string &name, size_t &msize)=0
 
virtual void in_array_between (const std::string &name)=0
 
virtual void in_array_end (const std::string &name)=0
 
template<class T >
bool in (ChNameValue< ChEnumMapper< T >> bVal)
 
template<class T , size_t N>
bool in (ChNameValue< T[N]> bVal)
 
template<class T >
bool in (ChNameValue< std::vector< T >> bVal)
 
template<class T >
bool in (ChNameValue< std::list< T >> bVal)
 
template<class T , class Tv >
bool in (ChNameValue< std::pair< T, Tv >> bVal)
 
template<class T , class Tv >
bool in (ChNameValue< std::unordered_map< T, Tv >> bVal)
 
template<class T >
bool in (ChNameValue< std::shared_ptr< T >> bVal)
 
template<class T >
bool in (ChNameValue< T * > bVal)
 
template<class T >
bool 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)
 Turn off version info in archives. More...
 
void SetClusterClassVersions (bool mcl)
 If true, the version number is not saved in each class. More...
 

Protected Types

using shared_pair_type = std::pair< std::shared_ptr< void >, std::string >
 

Protected Member Functions

void PutNewPointer (void *object, size_t obj_ID)
 Find a pointer in pointer map: eventually add it to map i f it was not previously inserted. More...
 
virtual int in_version (const std::type_index mtypeid)
 

Protected Attributes

std::unordered_map< void *, size_t > internal_ptr_id
 
std::unordered_map< size_t, void * > internal_id_ptr
 
std::unordered_map< void *, shared_pair_type > 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
 
bool can_tolerate_missing_tokens
 
bool try_tolerate_missing_tokens
 
- 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

◆ PutNewPointer()

void chrono::ChArchiveIn::PutNewPointer ( void *  object,
size_t  obj_ID 
)
inlineprotected

Find a pointer in pointer map: eventually add it to map i f it was not previously inserted.

Returns already_stored=false if was already inserted. Return 'obj_ID' offset in vector in any case. For null pointers, always return 'already_stored'=true, and 'obj_ID'=0.

◆ RebindExternalPointer() [1/2]

void chrono::ChArchiveIn::RebindExternalPointer ( std::shared_ptr< void >  mptr,
size_t  ID 
)
inline

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.

Note, the IDs can be whatever integer > 0. Use unique IDs per each pointer. Note, the same IDs must be used when serializing pointers in ArchiveOut. Note, there is no check on pointer types when rebinding!

◆ RebindExternalPointer() [2/2]

void chrono::ChArchiveIn::RebindExternalPointer ( void *  mptr,
size_t  ID 
)
inline

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.

Note, the IDs can be whatever integer > 0. Use unique IDs per each pointer. Note, the same IDs must be used when serializing pointers in ArchiveOut. Note, there is no check on pointer types when rebinding!


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