|
AGXDynamics
2.31.1.0
|
Class for reading a binary stream of serialized data. More...
#include <InputArchive.h>
Inheritance diagram for agxStream::InputArchive: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. More... | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| virtual void | beginSection (const char *title) override |
| virtual void | close () |
| virtual void | endSection (const char *title) override |
| bool | eof () const |
| agx::String | getAppName () const |
| agx::String | getArchiveDate () const |
| virtual void | getAttribute (const char *name, double &value) |
| virtual void | getAttribute (const char *name, float &value) |
| virtual void | getAttribute (const char *name, bool &value) |
| virtual void | getAttribute (const char *name, std::string &value) |
| virtual void | getAttribute (const char *name, char &value) |
| virtual void | getAttribute (const char *name, agx::UInt16 &value) |
| virtual void | getAttribute (const char *name, agx::UInt64 &value) |
| virtual void | getAttribute (const char *name, agx::UInt32 &value) |
| 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::UInt8 &value) |
| virtual void | getAttribute (const char *name, agx::Uuid &value) |
| bool | getBinaryMode () const |
| 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 |
| int | getReferenceCount () const |
| RestoreMode | getRestoreMode () const |
| agx::String | getRevision () const |
| agx::UInt16 | getSerializationVersion () const |
| std::istream & | getStream () |
| Return a reference to the inputstream. More... | |
| size_t | getVersion () const |
| bool | hasModification (const char *str) const |
| bool | hasModifications (const agx::StringVector &modifications) const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | isOpen () const |
| virtual void | newAttribute () |
| Called whenever a new item is initiated. More... | |
| void | open () |
| virtual void | read (char &val) |
| virtual void | read (bool &val) |
| virtual void | read (agx::Int8 &val) |
| virtual void | read (agx::UInt8 &val) |
| virtual void | read (agx::Int16 &val) |
| virtual void | read (agx::UInt16 &val) |
| virtual void | read (agx::UInt32 &val) |
| virtual void | read (agx::Int32 &val) |
| virtual void | read (std::string &val) |
| virtual void | read (agx::UInt64 &val) |
| virtual void | read (agx::Int64 &val) |
| virtual void | read (float &val) |
| virtual void | read (double &val) |
| virtual void | read (agx::RangeReal &val) |
| virtual void | read (agx::Vec2f &val) |
| virtual void | read (agx::Vec2d &val) |
| virtual void | read (agx::Vec2i32 &val) |
| virtual void | read (agx::Vec2i64 &val) |
| virtual void | read (agx::Vec3f &val) |
| virtual void | read (agx::Vec3d &val) |
| virtual void | read (agx::Vec3i32 &val) |
| virtual void | read (agx::Vec3i64 &val) |
| virtual void | read (agx::Vec4f &val) |
| virtual void | read (agx::Vec4d &val) |
| virtual void | read (agx::Quat &val) |
| virtual void | read (agx::SPDMatrix3x3 &val) |
| virtual void | read (agx::Matrix3x3d &val) |
| virtual void | read (agx::Matrix3x3f &val) |
| virtual void | read (agx::AffineMatrix4x4f &val) |
| virtual void | read (agx::AffineMatrix4x4d &val) |
| virtual void | read (agx::Uuid &val) |
| virtual void | read (void *buf, size_t len) |
| This method will read raw data from the archive. More... | |
| virtual void | read (agx::String &val) |
| virtual void | read (agx::Name &val) |
| template<typename VECTOR_TYPE > | |
| AGXCORE_EXPORT void | read_vector (const agx::String &name, VECTOR_TYPE &val) |
| Read an array of data. More... | |
| Serializable * | readObjectByRef () |
| bool | readObjectByVal (Serializable &obj) |
| template<typename T > | |
| void | readRef (T **obj, StorageMode mode) |
| void | readVal (Serializable &obj, StorageMode mode) |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| bool | removeRestoreListener (RestoreListener *listener) |
| Remove a RestoreListener. More... | |
| void | setBinaryMode (bool m) |
| void | setFinished () |
| Must be called when archive is de-serialized successfully. More... | |
| void | setRestoreMode (RestoreMode mode) |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
Static Public Member Functions | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Public Attributes | |
| RestoreEvent | restoreEvent |
Protected Types | |
| typedef agx::HashTable < RestoreListener *, RestoreListenerRef > | RestoreListenerHash |
Protected Member Functions | |
| InputArchive (const InputArchive &inputStream) | |
| virtual | ~InputArchive () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
| 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. More... | |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| IdToClassNameVector | m_defaultNameCache |
| IdToObjectVector | m_defaultObjectCache |
| IdToClassNameVector & | m_idToClassNameVector |
| IdToObjectVector & | m_IdToObjectVector |
| IdToStorageAgentVector | m_IdToStorageAgentVector |
| std::istream & | m_inputStream |
| bool | m_isOpen |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
| RestoreListenerHash | m_restoreListeners |
Class for reading a binary stream of serialized data.
Definition at line 51 of file InputArchive.h.
Definition at line 114 of file InputArchive.h.
| typedef agx::Vector< std::string > agxStream::InputArchive::IdToClassNameVector |
Definition at line 60 of file InputArchive.h.
Definition at line 59 of file InputArchive.h.
Definition at line 61 of file InputArchive.h.
| typedef agx::Event3<agx::UInt32, Serializable *, const std::string&> agxStream::InputArchive::RestoreEvent |
Definition at line 55 of file InputArchive.h.
|
protected |
Definition at line 303 of file InputArchive.h.
Definition at line 218 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.
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
overridevirtual |
Implements agxStream::Archive.
Reimplemented in agxStream::XMLInputArchive.
Referenced by agxStream::operator>>(), and agxStream::RestoreObjects< T >::RestoreObjects().
Reimplemented in agxStream::OutputArchive, and agxStream::XMLOutputArchive.
|
protectedinherited |
|
overridevirtual |
Implements agxStream::Archive.
Reimplemented in agxStream::XMLInputArchive.
Referenced by agxStream::operator>>(), and agxStream::RestoreObjects< T >::RestoreObjects().
|
inline |
Definition at line 357 of file InputArchive.h.
Referenced by agxStream::RestoreObjects< T >::RestoreObjects().
|
inlineprotected |
Definition at line 361 of file InputArchive.h.
| agx::String agxStream::InputArchive::getAppName | ( | ) | const |
| agx::String agxStream::InputArchive::getArchiveDate | ( | ) | const |
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
Referenced by agxStream::RestoreObjects< T >::RestoreObjects().
|
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.
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
Reimplemented in agxStream::XMLInputArchive.
|
inlineinherited |
| agx::String agxStream::InputArchive::getBuildDate | ( | ) | const |
| const BuildConfigurationTable& agxStream::InputArchive::getBuildFlags | ( | ) | const |
| agx::String agxStream::InputArchive::getBuildTime | ( | ) | const |
|
staticprotectedinherited |
| 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 |
|
inherited |
| 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
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
|
inlineinherited |
|
inlinevirtualinherited |
| void agxStream::InputArchive::open | ( | ) |
|
protected |
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
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.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in agxStream::XMLInputArchive.
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.
|
virtual |
| 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 178 of file InputArchive.h.
References agxThrow, agx::AgXString< std::string >::format(), agxStream::Serializable::getClassName(), and agxStream::STORE_BY_REF.
Referenced by agxStream::operator>>().
|
protectedvirtual |
| void agxStream::InputArchive::readVal | ( | Serializable & | obj, |
| StorageMode | mode | ||
| ) |
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
Referenced by agxData::Val< UInt >::Val().
|
protected |
Remove the serialized object from list.
| bool agxStream::InputArchive::removeRestoreListener | ( | RestoreListener * | listener | ) |
Remove a RestoreListener.
|
inlineinherited |
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
| 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 | ) |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
|
staticinherited |
|
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 294 of file InputArchive.h.
|
protected |
Definition at line 297 of file InputArchive.h.
|
protected |
Definition at line 292 of file InputArchive.h.
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
protected |
Definition at line 304 of file InputArchive.h.
| RestoreEvent agxStream::InputArchive::restoreEvent |
Definition at line 56 of file InputArchive.h.