AGX Dynamics 2.37.3.3
Loading...
Searching...
No Matches
agxStream Namespace Reference

This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serialization). More...

Namespaces

namespace  ElementTypes
 

Classes

class  Archive
 Abstract base class for input/output storage of Serializable classes. More...
 
class  ArchiveEofException
 
class  ArchiveException
 
struct  ClassInformation
 Class that extracts namespace, class name and method name when called with the AGX_FUNCTION macro. More...
 
class  EndOfArchiveException
 
class  InputArchive
 Class for reading a binary stream of serialized data. More...
 
struct  InputRef
 
struct  InputVal
 
class  OutputArchive
 Class for writing serialized data in binary format to a stream. More...
 
struct  OutputRef
 
struct  OutputVal
 
class  RestoreListener
 Class for listening to the restore of Serializable objects. More...
 
class  RestoreObjects
 
class  Serializable
 This class is an abstract base class for all classes that can be stored and retrieved from an Archive. More...
 
class  SerializablePtrVector
 
class  StorageStream
 Abstract base class for storing/restoring a line/drums with version control. More...
 
class  StoreObjects
 
class  XMLInputArchive
 XML version of an input archive for restoring data written with the XMLOutputArchive. More...
 
class  XMLOutputArchive
 XML version of an OutputArchive (for storing serialized objects). More...
 

Typedefs

typedef agx::ref_ptr< ArchiveArchiveRef
 
typedef agx::ref_ptr< InputArchiveInputArchiveRef
 
typedef agx::ref_ptr< OutputArchiveOutputArchiveRef
 
typedef agx::ref_ptr< RestoreListenerRestoreListenerRef
 
typedef agx::ref_ptr< XMLInputArchiveXMLInputArchiveRef
 
typedef agx::ref_ptr< XMLOutputArchiveXMLOutputArchiveRef
 

Enumerations

enum  HeaderTag { OBJECT_TAG = 0x1 , CLASS_TAG = 0x2 }
 
enum  StorageMode { STORE_BY_VALUE = 0x4 , STORE_BY_REF = 0x8 , STORE_NULL_POINTER = 0x10 }
 

Functions

template<typename T >
InputRef< T > in (const char *name, T &obj)
 Create an object with a name and a reference to the object that should be restored (usually a pointer).
 
template<typename T >
InputVal< T > in_val (const char *name, T &obj)
 Create an object with a name and a reference to the object that should be restored.
 
char littleEndian ()
 
template<typename T >
OutputArchiveoperator<< (OutputArchive &out, OutputRef< T > val)
 
template<typename T >
OutputArchiveoperator<< (OutputArchive &out, OutputVal< T > val)
 
AGXPHYSICS_EXPORT std::ostream & operator<< (std::ostream &str, StorageStream &storage)
 
StorageStreamoperator<< (StorageStream &out, agx::UInt16 val)
 
StorageStreamoperator<< (StorageStream &out, agx::UInt8 val)
 
StorageStreamoperator<< (StorageStream &out, bool val)
 
StorageStreamoperator<< (StorageStream &out, char val)
 
StorageStreamoperator<< (StorageStream &out, const agx::AffineMatrix4x4d &v)
 
StorageStreamoperator<< (StorageStream &out, const agx::AffineMatrix4x4f &v)
 
StorageStreamoperator<< (StorageStream &out, const agx::Quat32 &q)
 
StorageStreamoperator<< (StorageStream &out, const agx::Quat64 &q)
 
StorageStreamoperator<< (StorageStream &out, const agx::RigidBody *rb)
 
StorageStreamoperator<< (StorageStream &out, const agx::Vec3d &v)
 
StorageStreamoperator<< (StorageStream &out, const agx::Vec3f &v)
 
StorageStreamoperator<< (StorageStream &out, const agxCollide::Geometry *geometry)
 
StorageStreamoperator<< (StorageStream &out, const agxWire::Node *node)
 
StorageStreamoperator<< (StorageStream &out, const std::string &val)
 
StorageStreamoperator<< (StorageStream &out, double val)
 
StorageStreamoperator<< (StorageStream &out, float val)
 
StorageStreamoperator<< (StorageStream &out, int val)
 
StorageStreamoperator<< (StorageStream &out, size_t val)
 
template<typename T >
InputArchiveoperator>> (InputArchive &in, InputRef< T > val)
 
template<typename T >
InputArchiveoperator>> (InputArchive &in, InputVal< T > val)
 
AGXPHYSICS_EXPORT std::istream & operator>> (std::istream &str, StorageStream &storage)
 
StorageStreamoperator>> (StorageStream &in, agx::AffineMatrix4x4d &val)
 
StorageStreamoperator>> (StorageStream &in, agx::AffineMatrix4x4f &val)
 
StorageStreamoperator>> (StorageStream &in, agx::Quat32 &q)
 
StorageStreamoperator>> (StorageStream &in, agx::Quat64 &q)
 
StorageStreamoperator>> (StorageStream &in, agx::RigidBody **rb)
 
StorageStreamoperator>> (StorageStream &in, agx::UInt16 &val)
 
StorageStreamoperator>> (StorageStream &in, agx::UInt8 &val)
 
StorageStreamoperator>> (StorageStream &in, agx::Vec3d &val)
 
StorageStreamoperator>> (StorageStream &in, agx::Vec3f &val)
 
StorageStreamoperator>> (StorageStream &in, agxCollide::Geometry **geometry)
 
StorageStreamoperator>> (StorageStream &in, agxWire::Node *node)
 
StorageStreamoperator>> (StorageStream &in, bool &val)
 
StorageStreamoperator>> (StorageStream &in, char &val)
 
StorageStreamoperator>> (StorageStream &in, double &val)
 
StorageStreamoperator>> (StorageStream &in, float &val)
 
StorageStreamoperator>> (StorageStream &in, int &val)
 
StorageStreamoperator>> (StorageStream &in, size_t &val)
 
StorageStreamoperator>> (StorageStream &in, std::string &val)
 
OutputRef< Serializableout (const char *name, const Serializable *obj)
 Return an object that contain the name and the object that should be serialized to an archive.
 
template<typename T >
OutputRef< T > out_val (const char *name, const T &obj)
 Return an object that contain the name and the object that should be serialized to an archive.
 
bool AGXPHYSICS_EXPORT read (const std::string &filename, agxStream::SerializablePtrVector &readObjects)
 Open and read serializable objects from a file on disk with previously stored objects.
 
template<typename T >
void restoreObserverPtr (agxStream::InputArchive &in, const char *name, agx::observer_ptr< T > &observerPtr)
 
template<typename T >
void restoreRefPtr (agxStream::InputArchive &in, const char *name, agx::ref_ptr< T > &refPtr)
 
bool AGXPHYSICS_EXPORT write (const std::string &filename, const agxStream::Serializable *data)
 Write a Serializable object to a file.
 
bool AGXPHYSICS_EXPORT write (const std::string &filename, const agxStream::SerializablePtrVector &writeObjects)
 Write a Serializable object to a file.
 

Variables

const agx::UInt32 ARCHIVE_MAGIC = 0xFADDED0
 magic number for archives
 
const agx::UInt16 STORAGESTREAM_VERSION_AMOR_PARALLELIZATION = 4
 
const agx::UInt16 STORAGESTREAM_VERSION_COMBUSTION_ENGINE = 6
 
const agx::UInt16 STORAGESTREAM_VERSION_COMBUSTION_ENGINE_STABILITY_FIX = 9
 
const agx::UInt16 STORAGESTREAM_VERSION_COMBUSTION_ENGINE_STARTER = 8
 
const agx::UInt16 STORAGESTREAM_VERSION_CONSTRAINT_ATTACHMENTS = 3
 
const agx::UInt16 STORAGESTREAM_VERSION_ELECTRIC_MOTOR = 5
 
const agx::UInt16 STORAGESTREAM_VERSION_FRICTION_CONTROLLER = 7
 
const agx::UInt16 STORAGESTREAM_VERSION_FRICTION_CONTROLLER_STATIC_FORCE = 11
 
const agx::UInt16 STORAGESTREAM_VERSION_HINGE_SWING = 1
 
const agx::UInt16 STORAGESTREAM_VERSION_INDEXSET_STATE = 2
 
const agx::UInt16 STORAGESTREAM_VERSION_LINEARIZATION_ON_CONSTRAINT = 12
 
const agx::UInt16 STORAGESTREAM_VERSION_NEW_TORQUE_CONVERTER = 10
 

Detailed Description

This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serialization).

Typedef Documentation

◆ ArchiveRef

Definition at line 124 of file Archive.h.

◆ InputArchiveRef

◆ OutputArchiveRef

◆ RestoreListenerRef

◆ XMLInputArchiveRef

◆ XMLOutputArchiveRef

Enumeration Type Documentation

◆ HeaderTag

Enumerator
OBJECT_TAG 
CLASS_TAG 

Definition at line 38 of file Archive.h.

◆ StorageMode

Enumerator
STORE_BY_VALUE 
STORE_BY_REF 
STORE_NULL_POINTER 

Definition at line 45 of file Archive.h.

Function Documentation

◆ in()

template<typename T >
InputRef< T > agxStream::in ( const char *  name,
T &  obj 
)

Create an object with a name and a reference to the object that should be restored (usually a pointer).

This should be used for restoring pointers to Serializable objects.

Parameters
name- name of the object requested to be restored.
obj- reference to the object to be restored
Returns
an object containing the reference to an object that will be restored (usually a pointer).

Definition at line 400 of file InputArchive.h.

Referenced by agxStream::RestoreObjects< T >::RestoreObjects(), operator>>(), agxModel::Deformable1DRadiusGeometryFactory< T >::restore(), restoreObserverPtr(), and restoreRefPtr().

◆ in_val()

template<typename T >
InputVal< T > agxStream::in_val ( const char *  name,
T &  obj 
)

Create an object with a name and a reference to the object that should be restored.

This should be used for restoring by value. For double, float, Vec3 and references to Serializable objects.

Parameters
name- name of the object requested to be restored.
obj- reference to the object to be restored
Returns
an object containing the reference to an object that will be restored by value.

Definition at line 411 of file InputArchive.h.

◆ littleEndian()

char agxStream::littleEndian ( )
inline

Definition at line 28 of file Archive.h.

◆ operator<<() [1/21]

template<typename T >
OutputArchive & agxStream::operator<< ( OutputArchive out,
OutputRef< T >  val 
)
inline

◆ operator<<() [2/21]

template<typename T >
OutputArchive & agxStream::operator<< ( OutputArchive out,
OutputVal< T >  val 
)
inline

◆ operator<<() [3/21]

AGXPHYSICS_EXPORT std::ostream & agxStream::operator<< ( std::ostream &  str,
StorageStream storage 
)

◆ operator<<() [4/21]

StorageStream & agxStream::operator<< ( StorageStream out,
agx::UInt16  val 
)
inline

Definition at line 545 of file StorageStream.h.

References out().

◆ operator<<() [5/21]

StorageStream & agxStream::operator<< ( StorageStream out,
agx::UInt8  val 
)
inline

Definition at line 539 of file StorageStream.h.

References out().

◆ operator<<() [6/21]

StorageStream & agxStream::operator<< ( StorageStream out,
bool  val 
)
inline

Definition at line 558 of file StorageStream.h.

References out().

◆ operator<<() [7/21]

StorageStream & agxStream::operator<< ( StorageStream out,
char  val 
)
inline

Definition at line 552 of file StorageStream.h.

References out().

◆ operator<<() [8/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::AffineMatrix4x4d v 
)
inline

Definition at line 621 of file StorageStream.h.

References out().

◆ operator<<() [9/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::AffineMatrix4x4f v 
)
inline

Definition at line 615 of file StorageStream.h.

References out().

◆ operator<<() [10/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::Quat32 q 
)
inline

Definition at line 645 of file StorageStream.h.

References out().

◆ operator<<() [11/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::Quat64 q 
)
inline

Definition at line 639 of file StorageStream.h.

References out().

◆ operator<<() [12/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::RigidBody rb 
)
inline

Definition at line 603 of file StorageStream.h.

References out().

◆ operator<<() [13/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::Vec3d v 
)
inline

Definition at line 627 of file StorageStream.h.

References out().

◆ operator<<() [14/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agx::Vec3f v 
)
inline

Definition at line 633 of file StorageStream.h.

References out().

◆ operator<<() [15/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agxCollide::Geometry geometry 
)
inline

Definition at line 609 of file StorageStream.h.

References out().

◆ operator<<() [16/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const agxWire::Node node 
)
inline

Definition at line 651 of file StorageStream.h.

References out().

◆ operator<<() [17/21]

StorageStream & agxStream::operator<< ( StorageStream out,
const std::string &  val 
)
inline

Definition at line 597 of file StorageStream.h.

References out().

◆ operator<<() [18/21]

StorageStream & agxStream::operator<< ( StorageStream out,
double  val 
)
inline

Definition at line 591 of file StorageStream.h.

References out().

◆ operator<<() [19/21]

StorageStream & agxStream::operator<< ( StorageStream out,
float  val 
)
inline

Definition at line 585 of file StorageStream.h.

References out().

◆ operator<<() [20/21]

StorageStream & agxStream::operator<< ( StorageStream out,
int  val 
)
inline

Definition at line 565 of file StorageStream.h.

References out().

◆ operator<<() [21/21]

StorageStream & agxStream::operator<< ( StorageStream out,
size_t  val 
)
inline

Definition at line 571 of file StorageStream.h.

References out().

◆ operator>>() [1/21]

template<typename T >
InputArchive & agxStream::operator>> ( InputArchive in,
InputRef< T >  val 
)
inline

◆ operator>>() [2/21]

template<typename T >
InputArchive & agxStream::operator>> ( InputArchive in,
InputVal< T >  val 
)
inline

◆ operator>>() [3/21]

AGXPHYSICS_EXPORT std::istream & agxStream::operator>> ( std::istream &  str,
StorageStream storage 
)

◆ operator>>() [4/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::AffineMatrix4x4d val 
)
inline

Definition at line 520 of file StorageStream.h.

References in().

◆ operator>>() [5/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::AffineMatrix4x4f val 
)
inline

Definition at line 526 of file StorageStream.h.

References in().

◆ operator>>() [6/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::Quat32 q 
)
inline

Definition at line 514 of file StorageStream.h.

References in().

◆ operator>>() [7/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::Quat64 q 
)
inline

Definition at line 508 of file StorageStream.h.

References in().

◆ operator>>() [8/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::RigidBody **  rb 
)
inline

Definition at line 484 of file StorageStream.h.

References in().

◆ operator>>() [9/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::UInt16 val 
)
inline

Definition at line 422 of file StorageStream.h.

References in().

◆ operator>>() [10/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::UInt8 val 
)
inline

Definition at line 416 of file StorageStream.h.

References in().

◆ operator>>() [11/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::Vec3d val 
)
inline

Definition at line 496 of file StorageStream.h.

References in().

◆ operator>>() [12/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agx::Vec3f val 
)
inline

Definition at line 502 of file StorageStream.h.

References in().

◆ operator>>() [13/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agxCollide::Geometry **  geometry 
)
inline

Definition at line 490 of file StorageStream.h.

References in().

◆ operator>>() [14/21]

StorageStream & agxStream::operator>> ( StorageStream in,
agxWire::Node node 
)
inline

Definition at line 532 of file StorageStream.h.

References in().

◆ operator>>() [15/21]

StorageStream & agxStream::operator>> ( StorageStream in,
bool &  val 
)
inline

Definition at line 434 of file StorageStream.h.

References in().

◆ operator>>() [16/21]

StorageStream & agxStream::operator>> ( StorageStream in,
char &  val 
)
inline

Definition at line 428 of file StorageStream.h.

References in().

◆ operator>>() [17/21]

StorageStream & agxStream::operator>> ( StorageStream in,
double &  val 
)
inline

Definition at line 472 of file StorageStream.h.

References in().

◆ operator>>() [18/21]

StorageStream & agxStream::operator>> ( StorageStream in,
float &  val 
)
inline

Definition at line 466 of file StorageStream.h.

References in().

◆ operator>>() [19/21]

StorageStream & agxStream::operator>> ( StorageStream in,
int &  val 
)
inline

Definition at line 440 of file StorageStream.h.

References in().

◆ operator>>() [20/21]

StorageStream & agxStream::operator>> ( StorageStream in,
size_t &  val 
)
inline

Definition at line 448 of file StorageStream.h.

References in().

◆ operator>>() [21/21]

StorageStream & agxStream::operator>> ( StorageStream in,
std::string &  val 
)
inline

Definition at line 478 of file StorageStream.h.

References in().

◆ out()

OutputRef< Serializable > agxStream::out ( const char *  name,
const Serializable obj 
)
inline

Return an object that contain the name and the object that should be serialized to an archive.

This should be used for pointers to Serializable objects.

Parameters
name- name of the object/data
obj- Pointer to a Serializable object

Definition at line 412 of file OutputArchive.h.

References STORE_BY_REF.

Referenced by agxStream::StoreObjects< T >::~StoreObjects(), operator<<(), and agxModel::Deformable1DRadiusGeometryFactory< T >::store().

◆ out_val()

template<typename T >
OutputRef< T > agxStream::out_val ( const char *  name,
const T &  obj 
)

Return an object that contain the name and the object that should be serialized to an archive.

This should be used for serializing objects by value.

Parameters
name- name of the object/data
obj- Reference to a Serializable object or a basic type (double, Vec3, RangeReal etc.)

Definition at line 424 of file OutputArchive.h.

References STORE_BY_VALUE.

◆ read()

bool AGXPHYSICS_EXPORT agxStream::read ( const std::string &  filename,
agxStream::SerializablePtrVector readObjects 
)

Open and read serializable objects from a file on disk with previously stored objects.

The type of file (binary/ascii) is determined from the file type.

The vector readObjects contain pointers to restored objects, and it is the caller of this functions responsibility to handle the allocated memory.

Parameters
filename- The exact path to the file where data will be written, it will not be searched for using agxIO::Environment.
readObjects- Vector containing pointers to restored objects.
Returns
true if no error occurred during restoration.

Referenced by agxStream::InputArchive::read().

◆ restoreObserverPtr()

template<typename T >
void agxStream::restoreObserverPtr ( agxStream::InputArchive in,
const char *  name,
agx::observer_ptr< T > &  observerPtr 
)

Definition at line 489 of file InputArchive.h.

References in().

◆ restoreRefPtr()

template<typename T >
void agxStream::restoreRefPtr ( agxStream::InputArchive in,
const char *  name,
agx::ref_ptr< T > &  refPtr 
)

Definition at line 481 of file InputArchive.h.

References in().

◆ write() [1/2]

bool AGXPHYSICS_EXPORT agxStream::write ( const std::string &  filename,
const agxStream::Serializable data 
)

Write a Serializable object to a file.

The type of file (binary/ascii) is determined from the file type.

Parameters
filename- The path to the file where data will be param.
data- Pointer to the serializable data that will be stored.
Returns
true if writing to disk was successful.

Referenced by agxStream::OutputArchive::write().

◆ write() [2/2]

bool AGXPHYSICS_EXPORT agxStream::write ( const std::string &  filename,
const agxStream::SerializablePtrVector writeObjects 
)

Write a Serializable object to a file.

The type of file (binary/ascii) is determined from the file type.

Parameters
filename- The path to the file where data will be written.
writeObjects- Vector containing pointers to serializable objects that will be stored.
Returns
true if writing to disk was successful.

Variable Documentation

◆ ARCHIVE_MAGIC

const agx::UInt32 agxStream::ARCHIVE_MAGIC = 0xFADDED0

magic number for archives

Definition at line 35 of file Archive.h.

◆ STORAGESTREAM_VERSION_AMOR_PARALLELIZATION

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_AMOR_PARALLELIZATION = 4

Definition at line 27 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_COMBUSTION_ENGINE

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_COMBUSTION_ENGINE = 6

Definition at line 29 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_COMBUSTION_ENGINE_STABILITY_FIX

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_COMBUSTION_ENGINE_STABILITY_FIX = 9

Definition at line 32 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_COMBUSTION_ENGINE_STARTER

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_COMBUSTION_ENGINE_STARTER = 8

Definition at line 31 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_CONSTRAINT_ATTACHMENTS

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_CONSTRAINT_ATTACHMENTS = 3

Definition at line 26 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_ELECTRIC_MOTOR

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_ELECTRIC_MOTOR = 5

Definition at line 28 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_FRICTION_CONTROLLER

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_FRICTION_CONTROLLER = 7

Definition at line 30 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_FRICTION_CONTROLLER_STATIC_FORCE

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_FRICTION_CONTROLLER_STATIC_FORCE = 11

Definition at line 34 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_HINGE_SWING

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_HINGE_SWING = 1

Definition at line 24 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_INDEXSET_STATE

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_INDEXSET_STATE = 2

Definition at line 25 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_LINEARIZATION_ON_CONSTRAINT

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_LINEARIZATION_ON_CONSTRAINT = 12

Definition at line 35 of file StorageStreamVersions.h.

◆ STORAGESTREAM_VERSION_NEW_TORQUE_CONVERTER

const agx::UInt16 agxStream::STORAGESTREAM_VERSION_NEW_TORQUE_CONVERTER = 10

Definition at line 33 of file StorageStreamVersions.h.