|
AGXDynamics
2.31.1.0
|
Class for writing serialized data in binary format to a stream. More...
#include <OutputArchive.h>
Inheritance diagram for agxStream::OutputArchive:Classes | |
| struct | IdEntry |
Public Types | |
| typedef agx::HashTable< const Serializable *, IdEntry > | ObjectToIdMap |
| typedef agx::HashTable < StorageAgent *, agx::UInt32 > | StorageAgentToIdMap |
| typedef agx::Event2< const Serializable *, agx::UInt32 > | StoreEvent |
Public Member Functions | |
| OutputArchive (std::ostream &outputStream) | |
| Create and associate an OutputArchive for writing to an open stream. More... | |
| OutputArchive (std::ostream &outputStream, ObjectToIdMap &cache) | |
| virtual void | addAttribute (const char *name, bool value) |
| virtual void | addAttribute (const char *name, const char *value) |
| virtual void | addAttribute (const char *name, char value) |
| virtual void | addAttribute (const char *name, agx::Int8 value) |
| virtual void | addAttribute (const char *name, agx::UInt8 value) |
| virtual void | addAttribute (const char *name, agx::UInt16 value) |
| virtual void | addAttribute (const char *name, agx::Int32 value) |
| virtual void | addAttribute (const char *name, agx::UInt32 value) |
| virtual void | addAttribute (const char *name, agx::UInt64 value) |
| virtual void | addAttribute (const char *name, float value) |
| virtual void | addAttribute (const char *name, double value) |
| virtual void | addAttribute (const char *name, const agx::Uuid &value) |
| bool | addModification (const char *str) |
| Add a modification string that will be stored in the archive. 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 *) override |
| void | close () override |
| Call flush. More... | |
| virtual void | endSection (const char *) override |
| void | flush () |
| Make sure all data in buffer is written to associated stream. More... | |
| bool | getBinaryMode () const |
| bool | getEndianMatch () const |
| int | getNumObjectsSkipped () const |
| int | getNumObjectsWritten () const |
| const ObjectToIdMap & | getObjectToIdMap () const |
| int | getReferenceCount () const |
| std::ostream & | getStream () |
| Return a reference to the output stream. More... | |
| bool | getUseCurrentDate () |
| Return if the current date (and time) at execution time should be used when creating archive, or if the build date should be used. More... | |
| agx::UInt32 | getWriteBufferSize () const |
| bool | hasModification (const agx::String &modification) 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 (const std::string &appName) |
| Open a new stream and write an archive header with some version information. More... | |
| 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... | |
| void | setBinaryMode (bool m) |
| void | setObjectToIdMap (const ObjectToIdMap &map) |
| void | setWriteBufferSize (agx::UInt32 bufferSize) |
| Specify a new buffer size for the write buffer. More... | |
| 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... | |
| virtual void | write (char val) |
| virtual void | write (bool val) |
| virtual void | write (agx::UInt8 val) |
| virtual void | write (agx::Int8 val) |
| virtual void | write (agx::Int16 val) |
| virtual void | write (agx::UInt16 val) |
| virtual void | write (agx::Int32 val) |
| virtual void | write (agx::UInt32 val) |
| virtual void | write (agx::Int64 val) |
| virtual void | write (agx::UInt64 val) |
| virtual void | write (float val) |
| virtual void | write (double val) |
| virtual void | write (const std::string &val) |
| virtual void | write (const agx::String &val) |
| virtual void | write (const agx::Name &val) |
| virtual void | write (const agx::Uuid &val) |
| void | write (const agx::RangeReal &val) |
| void | write (const agx::Vec2f &val) |
| void | write (const agx::Vec2d &val) |
| void | write (const agx::Vec2i32 &val) |
| void | write (const agx::Vec2i64 &val) |
| void | write (const agx::Vec3f &val) |
| void | write (const agx::Vec3d &val) |
| void | write (const agx::Vec3i32 &val) |
| void | write (const agx::Vec3i64 &val) |
| void | write (const agx::Vec4f &val) |
| void | write (const agx::Vec4d &val) |
| void | write (const agx::Quat &val) |
| void | write (const agx::SPDMatrix3x3 &val) |
| void | write (const agx::Matrix3x3d &val) |
| void | write (const agx::Matrix3x3f &val) |
| void | write (const agx::AffineMatrix4x4f &val) |
| void | write (const agx::AffineMatrix4x4d &val) |
| void | write (const Serializable *serializable, StorageMode mode) |
| void | write (const Serializable &serializable, StorageMode mode) |
| virtual void | write (const void *buf, size_t len) |
| This method will write raw data into the archive. More... | |
| template<typename VECTOR_TYPE > | |
| AGXCORE_EXPORT void | write_vector (const agx::String &name, const VECTOR_TYPE &val) |
| Write an array of data. More... | |
| virtual void | writeObjectByRef (const Serializable *obj) |
| virtual void | writeObjectByVal (const Serializable &obj) |
Static Public Member Functions | |
| static void | setUseCurrentDate (bool flag) |
| Specify if the current date (and time) at execution time should be used when creating archive, or if the build date should be used. More... | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Public Attributes | |
| StoreEvent | storeEvent |
Protected Member Functions | |
| OutputArchive () | |
| OutputArchive (const OutputArchive &) | |
| virtual | ~OutputArchive () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
| void | open () |
| OutputArchive & | operator= (const OutputArchive &) |
| virtual void | writeArchiveHeader (const std::string &appName, agx::UInt8 generationVersion, agx::UInt8 majorVersion, agx::UInt8 minorVersion, agx::UInt8 patchVersion, const std::string &revision, agx::UInt16 serializationVersion) |
| void | writeBitSize () |
| virtual void | writeHeaderData (agx::UInt32 magic, const std::string &appName, agx::UInt8 generationVersion, agx::UInt8 majorVersion, agx::UInt8 minorVersion, agx::UInt8 patchVersion, const std::string &revision, agx::UInt16 serializationVersion) |
| virtual void | writeObjectHeader (StorageMode mode, StorageAgent *agent) |
| virtual void | writeTypeHeader (StorageAgent *agent) |
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 | |
| ObjectToIdMap | m_defaultCache |
| bool | m_isOpen |
| Mutex | m_mutex |
| int | m_numObjectsSkipped |
| int | m_numObjectsWritten |
| ObjectToIdMap & | m_objectToIdMap |
| ObserverContainer | m_observers |
| std::ostream & | m_outputStream |
| AtomicValue | m_refCount |
| StorageAgentToIdMap | m_storageAgentToIdMap |
Class for writing serialized data in binary format to a stream.
Definition at line 56 of file OutputArchive.h.
| typedef agx::HashTable< const Serializable*, IdEntry > agxStream::OutputArchive::ObjectToIdMap |
Definition at line 68 of file OutputArchive.h.
| typedef agx::HashTable< StorageAgent*, agx::UInt32 > agxStream::OutputArchive::StorageAgentToIdMap |
Definition at line 69 of file OutputArchive.h.
| typedef agx::Event2<const Serializable *, agx::UInt32> agxStream::OutputArchive::StoreEvent |
Definition at line 59 of file OutputArchive.h.
| agxStream::OutputArchive::OutputArchive | ( | std::ostream & | outputStream | ) |
Create and associate an OutputArchive for writing to an open stream.
| agxStream::OutputArchive::OutputArchive | ( | std::ostream & | outputStream, |
| ObjectToIdMap & | cache | ||
| ) |
|
protected |
|
protectedvirtual |
Destructor.
|
protected |
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
Referenced by agxStream::StoreObjects< T >::~StoreObjects().
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
| bool agxStream::OutputArchive::addModification | ( | const char * | str | ) |
Add a modification string that will be stored in the archive.
This method need to be called before the open method (because thats when the header is written).
|
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 |
|
inlineoverridevirtual |
Implements agxStream::Archive.
Reimplemented in agxStream::XMLOutputArchive.
Definition at line 191 of file OutputArchive.h.
Referenced by agxStream::StoreObjects< T >::~StoreObjects().
|
overridevirtual |
Call flush.
Reimplemented from agxStream::Archive.
Reimplemented in agxStream::XMLOutputArchive.
Referenced by agxStream::XMLOutputArchive::close().
|
protectedinherited |
|
inlineoverridevirtual |
Implements agxStream::Archive.
Reimplemented in agxStream::XMLOutputArchive.
Definition at line 192 of file OutputArchive.h.
Referenced by agxStream::StoreObjects< T >::~StoreObjects().
| void agxStream::OutputArchive::flush | ( | ) |
Make sure all data in buffer is written to associated stream.
|
inlineinherited |
|
staticprotectedinherited |
|
inline |
Definition at line 187 of file OutputArchive.h.
|
inline |
Definition at line 100 of file OutputArchive.h.
|
inline |
Definition at line 93 of file OutputArchive.h.
| const ObjectToIdMap& agxStream::OutputArchive::getObjectToIdMap | ( | ) | const |
|
inherited |
|
inline |
Return a reference to the output stream.
Definition at line 80 of file OutputArchive.h.
| bool agxStream::OutputArchive::getUseCurrentDate | ( | ) |
Return if the current date (and time) at execution time should be used when creating archive, or if the build date should be used.
| agx::UInt32 agxStream::OutputArchive::getWriteBufferSize | ( | ) | const |
| bool agxStream::OutputArchive::hasModification | ( | const agx::String & | modification | ) | const |
modification hash
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
|
inlineinherited |
|
inlinevirtualinherited |
| void agxStream::OutputArchive::open | ( | const std::string & | appName | ) |
Open a new stream and write an archive header with some version information.
|
inlineprotectedinherited |
|
protected |
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().
|
inlineinherited |
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
| void agxStream::OutputArchive::setObjectToIdMap | ( | const ObjectToIdMap & | map | ) |
|
static |
Specify if the current date (and time) at execution time should be used when creating archive, or if the build date should be used.
Default is enabled.
| void agxStream::OutputArchive::setWriteBufferSize | ( | agx::UInt32 | bufferSize | ) |
Specify a new buffer size for the write buffer.
Default = 8192 bytes A call to this method will flush the buffer to the stream if bufferSize is less than the current size
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 |
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Reimplemented in agxStream::XMLOutputArchive.
|
virtual |
Definition at line 139 of file OutputArchive.h.
References agxStream::write().
Reimplemented in agxStream::XMLOutputArchive.
| void agxStream::OutputArchive::write | ( | const agx::RangeReal & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec2f & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec2d & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec2i32 & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec2i64 & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec3f & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec3d & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec3i32 & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec3i64 & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec4f & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Vec4d & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::SPDMatrix3x3 & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Matrix3x3d & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::Matrix3x3f & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::AffineMatrix4x4f & | val | ) |
| void agxStream::OutputArchive::write | ( | const agx::AffineMatrix4x4d & | val | ) |
| void agxStream::OutputArchive::write | ( | const Serializable * | serializable, |
| StorageMode | mode | ||
| ) |
| void agxStream::OutputArchive::write | ( | const Serializable & | serializable, |
| StorageMode | mode | ||
| ) |
This method will write raw data into the archive.
Notice that you should always have called beginSection() prior to calling this method. Otherwise it is not compatible with XML output.
| buf | - Pointer to the data to be written |
| len | - Number of bytes to write |
Reimplemented in agxStream::XMLOutputArchive.
| AGXCORE_EXPORT void agxStream::OutputArchive::write_vector | ( | const agx::String & | name, |
| const VECTOR_TYPE & | val | ||
| ) |
Write an array of data.
Only works for agx::VectorPOD<> types.
| name | - name of the vector data |
| val | - The array data to be written. |
|
protectedvirtual |
|
protected |
|
protectedvirtual |
|
virtual |
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
|
protected |
Definition at line 277 of file OutputArchive.h.
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
protected |
Definition at line 283 of file OutputArchive.h.
|
protected |
Definition at line 282 of file OutputArchive.h.
|
protected |
Definition at line 278 of file OutputArchive.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
protected |
Definition at line 276 of file OutputArchive.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
protected |
Definition at line 279 of file OutputArchive.h.
| StoreEvent agxStream::OutputArchive::storeEvent |
Definition at line 60 of file OutputArchive.h.