![]() |
AGX Dynamics 2.40.0.0
|
Class for reading a binary stream of serialized data. More...
#include <InputArchive.h>
Public Types | |
typedef agx::HashTable< agx::UInt, bool > | BuildConfigurationTable |
typedef agx::Vector< std::string > | IdToClassNameVector |
typedef agx::VectorPOD< Serializable * > | IdToObjectVector |
typedef agx::Vector< StorageAgent * > | IdToStorageAgentVector |
typedef agx::Event3< agx::UInt32, Serializable *, const std::string & > | RestoreEvent |
enum | RestoreMode { TRY_BY_VALUE , TRY_BY_REFERENCE , DEFAULT = TRY_BY_REFERENCE } |
Public Member Functions | |
InputArchive (std::istream &inputStream) | |
InputArchive (std::istream &inputStream, IdToObjectVector &objectCache, IdToClassNameVector &nameCache) | |
bool | addRestoreListener (RestoreListener *listener) |
Add a listener that will be called for each restored Serializable object. | |
virtual void | beginSection (const char *title) override |
virtual void | endSection (const char *title) override |
bool | eof () const |
agx::String | getAppName () const |
agx::String | getArchiveDate () const |
virtual void | getAttribute (const char *name, agx::Int32 &value) |
virtual void | getAttribute (const char *name, agx::Int8 &value) |
virtual void | getAttribute (const char *name, agx::UInt16 &value) |
virtual void | getAttribute (const char *name, agx::UInt32 &value) |
virtual void | getAttribute (const char *name, agx::UInt64 &value) |
virtual void | getAttribute (const char *name, agx::UInt8 &value) |
virtual void | getAttribute (const char *name, agx::Uuid &value) |
virtual void | getAttribute (const char *name, bool &value) |
virtual void | getAttribute (const char *name, char &value) |
virtual void | getAttribute (const char *name, double &value) |
virtual void | getAttribute (const char *name, float &value) |
virtual void | getAttribute (const char *name, std::string &value) |
agx::String | getBuildDate () const |
const BuildConfigurationTable & | getBuildFlags () const |
agx::String | getBuildTime () const |
bool | getEndianMatch () const |
agx::UInt8 | getGenerationVersion () const |
agx::UInt8 | getMajorVersion () const |
agx::UInt8 | getMinorVersion () const |
int | getNumObjectsRead () const |
agx::UInt8 | getPatchVersion () const |
RestoreMode | getRestoreMode () const |
agx::String | getRevision () const |
agx::UInt16 | getSerializationVersion () const |
std::istream & | getStream () |
Return a reference to the inputstream. | |
size_t | getVersion () const |
bool | hasModification (const char *str) const |
bool | hasModifications (const agx::StringVector &modifications) const |
void | open () |
virtual void | read (agx::AffineMatrix4x4d &val) |
virtual void | read (agx::AffineMatrix4x4f &val) |
virtual void | read (agx::Int16 &val) |
virtual void | read (agx::Int32 &val) |
virtual void | read (agx::Int64 &val) |
virtual void | read (agx::Int8 &val) |
virtual void | read (agx::Matrix3x3d &val) |
virtual void | read (agx::Matrix3x3f &val) |
virtual void | read (agx::Name &val) |
virtual void | read (agx::Quat &val) |
virtual void | read (agx::RangeReal &val) |
virtual void | read (agx::SPDMatrix3x3 &val) |
virtual void | read (agx::String &val) |
virtual void | read (agx::UInt16 &val) |
virtual void | read (agx::UInt32 &val) |
virtual void | read (agx::UInt64 &val) |
virtual void | read (agx::UInt8 &val) |
virtual void | read (agx::Uuid &val) |
virtual void | read (agx::Vec2d &val) |
virtual void | read (agx::Vec2f &val) |
virtual void | read (agx::Vec2i32 &val) |
virtual void | read (agx::Vec2i64 &val) |
virtual void | read (agx::Vec3d &val) |
virtual void | read (agx::Vec3f &val) |
virtual void | read (agx::Vec3i32 &val) |
virtual void | read (agx::Vec3i64 &val) |
virtual void | read (agx::Vec4d &val) |
virtual void | read (agx::Vec4f &val) |
virtual void | read (bool &val) |
virtual void | read (char &val) |
virtual void | read (double &val) |
virtual void | read (float &val) |
virtual void | read (std::string &val) |
virtual void | read (void *buf, size_t len) |
This method will read raw data from the archive. | |
template<typename VECTOR_TYPE > | |
AGXCORE_EXPORT void | read_vector (const agx::String &name, VECTOR_TYPE &val) |
Read an array of data. | |
Serializable * | readObjectByRef () |
bool | readObjectByVal (Serializable &obj) |
template<typename T > | |
void | readRef (T **obj, StorageMode mode) |
void | readVal (Serializable &obj, StorageMode mode) |
bool | removeRestoreListener (RestoreListener *listener) |
Remove a RestoreListener. | |
void | setFinished () |
Must be called when archive is de-serialized successfully. | |
void | setRestoreMode (RestoreMode mode) |
![]() | |
Archive () | |
virtual void | beginSection (const char *)=0 |
virtual void | close () |
virtual void | endSection (const char *)=0 |
bool | getBinaryMode () const |
bool | isOpen () const |
virtual void | newAttribute () |
Called whenever a new item is initiated. | |
void | setBinaryMode (bool m) |
![]() | |
Referenced () | |
Default constructor. | |
Referenced (const Referenced &) | |
template<typename T > | |
T * | as () |
Subclass casting. | |
template<typename T > | |
const T * | as () const |
template<typename T > | |
T * | asSafe () |
Safe subclass casting, return nullptr if template type does not match. | |
template<typename T > | |
const T * | asSafe () const |
int | getReferenceCount () const |
template<typename T > | |
bool | is () const |
Subclass test. | |
Referenced & | operator= (const Referenced &) |
Assignment operator. Will increment the number of references to the referenced object. | |
void | reference (void *ptr=nullptr) const |
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
void | unreference (void *ptr=nullptr) const |
Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
void | unreference_nodelete () const |
Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Public Attributes | |
RestoreEvent | restoreEvent |
Protected Types | |
typedef agx::HashTable< RestoreListener *, RestoreListenerRef > | RestoreListenerHash |
Protected Member Functions | |
InputArchive (const InputArchive &inputStream) | |
virtual | ~InputArchive () |
Destructor. | |
void | eof (bool flag) |
virtual size_t | getNumBytesRead () const |
agx::String | getSerializationVersionStringMessage () const |
agx::String | getVersionStringMessage () const |
InputArchive & | operator= (const InputArchive &) |
virtual void | readArchiveHeader () |
void | readCompareBitSize () |
void | readHeaderData () |
virtual void | readObjectHeader (StorageMode &storageMode, StorageAgent *&agent) |
virtual void | readTypeHeader (StorageAgent *&agent) |
bool | removeObject (Serializable *object) |
Remove the serialized object from list. | |
![]() | |
virtual | ~Archive () |
Destructor. | |
void | open () |
![]() | |
virtual | ~Referenced () |
Destructor. | |
void | allocateObserverVector () const |
void | deleteUsingDeleteHandler () const |
Protected Attributes | |
IdToClassNameVector | m_defaultNameCache |
IdToObjectVector | m_defaultObjectCache |
IdToClassNameVector & | m_idToClassNameVector |
IdToObjectVector & | m_IdToObjectVector |
IdToStorageAgentVector | m_IdToStorageAgentVector |
std::istream & | m_inputStream |
RestoreListenerHash | m_restoreListeners |
![]() | |
bool | m_isOpen |
![]() | |
Mutex | m_mutex |
ObserverContainer | m_observers |
AtomicValue | m_refCount |
Additional Inherited Members | |
![]() | |
template<typename T > | |
static bool | ValidateCast (const Referenced *object) |
![]() | |
static DeleteHandler * | getDeleteHandler () |
static void | setDeleteHandler (DeleteHandler *handler) |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Class for reading a binary stream of serialized data.
Definition at line 50 of file InputArchive.h.
Definition at line 113 of file InputArchive.h.
typedef agx::Vector< std::string > agxStream::InputArchive::IdToClassNameVector |
Definition at line 59 of file InputArchive.h.
Definition at line 58 of file InputArchive.h.
Definition at line 60 of file InputArchive.h.
typedef agx::Event3<agx::UInt32, Serializable *, const std::string&> agxStream::InputArchive::RestoreEvent |
Definition at line 54 of file InputArchive.h.
|
protected |
Definition at line 302 of file InputArchive.h.
Definition at line 217 of file InputArchive.h.
agxStream::InputArchive::InputArchive | ( | std::istream & | inputStream | ) |
agxStream::InputArchive::InputArchive | ( | std::istream & | inputStream, |
IdToObjectVector & | objectCache, | ||
IdToClassNameVector & | nameCache | ||
) |
|
protectedvirtual |
Destructor.
|
protected |
bool agxStream::InputArchive::addRestoreListener | ( | RestoreListener * | listener | ) |
Add a listener that will be called for each restored Serializable object.
|
overridevirtual |
Implements agxStream::Archive.
Reimplemented in agxStream::XMLInputArchive.
Referenced by agxStream::RestoreObjects< T >::RestoreObjects().
|
overridevirtual |
Implements agxStream::Archive.
Reimplemented in agxStream::XMLInputArchive.
Referenced by agxStream::RestoreObjects< T >::RestoreObjects().
|
inline |
Definition at line 356 of file InputArchive.h.
Referenced by agxStream::RestoreObjects< T >::RestoreObjects().
|
inlineprotected |
Definition at line 360 of file InputArchive.h.
agx::String agxStream::InputArchive::getAppName | ( | ) | const |
agx::String agxStream::InputArchive::getArchiveDate | ( | ) | const |
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
Referenced by agxStream::RestoreObjects< T >::RestoreObjects().
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
agx::String agxStream::InputArchive::getBuildDate | ( | ) | const |
const BuildConfigurationTable & agxStream::InputArchive::getBuildFlags | ( | ) | const |
agx::String agxStream::InputArchive::getBuildTime | ( | ) | const |
bool agxStream::InputArchive::getEndianMatch | ( | ) | const |
agx::UInt8 agxStream::InputArchive::getGenerationVersion | ( | ) | const |
agx::UInt8 agxStream::InputArchive::getMajorVersion | ( | ) | const |
agx::UInt8 agxStream::InputArchive::getMinorVersion | ( | ) | const |
|
protectedvirtual |
Reimplemented in agxStream::XMLInputArchive.
int agxStream::InputArchive::getNumObjectsRead | ( | ) | const |
agx::UInt8 agxStream::InputArchive::getPatchVersion | ( | ) | const |
RestoreMode agxStream::InputArchive::getRestoreMode | ( | ) | const |
agx::String agxStream::InputArchive::getRevision | ( | ) | const |
agx::UInt16 agxStream::InputArchive::getSerializationVersion | ( | ) | const |
|
protected |
std::istream & agxStream::InputArchive::getStream | ( | ) |
Return a reference to the inputstream.
size_t agxStream::InputArchive::getVersion | ( | ) | const |
|
protected |
bool agxStream::InputArchive::hasModification | ( | const char * | str | ) | const |
bool agxStream::InputArchive::hasModifications | ( | const agx::StringVector & | modifications | ) | const |
modifications
is represented in the current archive void agxStream::InputArchive::open | ( | ) |
|
protected |
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
References agxStream::read().
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
|
virtual |
This method will read raw data from the archive.
Notice that you should always have called beginSection() prior to calling this method. Otherwise it is not compatible with XML input
buf | - Pointer to the buffer where data will be written |
len | - Number of bytes to read |
Reimplemented in agxStream::XMLInputArchive, and agxStream::XMLInputArchive.
AGXCORE_EXPORT void agxStream::InputArchive::read_vector | ( | const agx::String & | name, |
VECTOR_TYPE & | val | ||
) |
Read an array of data.
Only works for agx::VectorPOD<> types.
name | - name of the vector data |
val | - Target of the read vector data. |
|
protectedvirtual |
|
protected |
|
protected |
Serializable * agxStream::InputArchive::readObjectByRef | ( | ) |
bool agxStream::InputArchive::readObjectByVal | ( | Serializable & | obj | ) |
|
protectedvirtual |
|
inline |
Definition at line 177 of file InputArchive.h.
References agxThrow, agx::AgXString< std::string >::format(), agxStream::Serializable::getClassName(), and agxStream::STORE_BY_REF.
|
protectedvirtual |
void agxStream::InputArchive::readVal | ( | Serializable & | obj, |
StorageMode | mode | ||
) |
|
protected |
Remove the serialized object from list.
bool agxStream::InputArchive::removeRestoreListener | ( | RestoreListener * | listener | ) |
Remove a RestoreListener.
void agxStream::InputArchive::setFinished | ( | ) |
Must be called when archive is de-serialized successfully.
If not, all dynamically allocated objects will be deleted.
void agxStream::InputArchive::setRestoreMode | ( | RestoreMode | mode | ) |
|
protected |
Definition at line 294 of file InputArchive.h.
|
protected |
Definition at line 292 of file InputArchive.h.
|
protected |
Definition at line 295 of file InputArchive.h.
|
protected |
Definition at line 293 of file InputArchive.h.
|
protected |
Definition at line 296 of file InputArchive.h.
|
protected |
Definition at line 291 of file InputArchive.h.
|
protected |
Definition at line 303 of file InputArchive.h.
RestoreEvent agxStream::InputArchive::restoreEvent |
Definition at line 55 of file InputArchive.h.