92 std::ostream&
getStream() {
return m_outputStream; }
97 void open(
const std::string& appName);
103 return m_numObjectsWritten;
110 return m_numObjectsSkipped;
146 virtual void write(
const std::string& val);
193 virtual void addAttribute(
const char *name,
size_t value) { addAttribute(name, (
agx::UInt64)value); }
197 return m_endianMatch == 1;
214 virtual void write(
const void* buf,
size_t len);
248 template<
typename VECTOR_TYPE>
263 const std::string& appName,
268 const std::string& revision,
276 const std::string& revision,
304 void addModifications();
305 void writeModificationData();
306 bool m_hasAddedModifications;
307 static bool s_useCurrentDate;
314 template <
typename T>
347 template <
typename T>
359#define DECLARE_OUTPUT_BASIC_TYPE(TYPE) \
360 AGXCORE_EXPORT inline agxStream::OutputArchive& operator<<( OutputArchive& out, OutputVal<TYPE> val ) \
362 out.beginSection(val.m_name); \
363 out.write( val.m_obj ); \
364 out.endSection(val.m_name); \
367 AGXCORE_EXPORT inline OutputVal<TYPE> out(const char *name, TYPE obj) { return OutputVal<TYPE>(name, obj); }
423 template <
typename T>
427 template <
typename T>
436 template <
typename T>
#define DECLARE_OUTPUT_BASIC_TYPE(TYPE)
Abstract base class for input/output storage of Serializable classes.
Class for writing serialized data in binary format to a stream.
virtual void write(char val)
virtual void write(agx::UInt64 val)
virtual void write(agx::UInt32 val)
virtual void beginSection(const char *) override
void write(const agx::Vec4d &val)
virtual void write(agx::Int16 val)
virtual void write(float val)
OutputArchive(const OutputArchive &)
AGXCORE_EXPORT void write_vector(const agx::String &name, const VECTOR_TYPE &val)
Write an array of data.
bool getEndianMatch() const
virtual void write(agx::UInt16 val)
virtual void write(bool val)
virtual void write(const agx::Name &val)
void write(const agx::Vec2f &val)
bool addModification(const char *str)
Add a modification string that will be stored in the archive.
ObjectToIdMapContext m_defaultCache
ObjectToIdMapContext & m_objectToIdMap
int getNumObjectsWritten() const
void write(const agx::AffineMatrix4x4f &val)
OutputArchive(std::ostream &outputStream, ObjectToIdMapContext &cache)
void open(const std::string &appName)
Open a new stream and write an archive header with some version information.
OutputArchive & operator=(const OutputArchive &)
virtual void write(const agx::String &val)
virtual void write(double val)
void flush()
Make sure all data in buffer is written to associated stream.
virtual void write(const std::string &val)
virtual void write(agx::Int8 val)
virtual void write(agx::Int64 val)
virtual void writeObjectByRef(const Serializable *obj)
agx::UInt32 getWriteBufferSize() const
OutputArchive(std::ostream &outputStream)
Create and associate an OutputArchive for writing to an open stream.
virtual void addAttribute(const char *name, agx::Int8 value)
void write(const agx::Matrix3x3d &val)
void close() override
Call flush.
void write(const agx::AffineMatrix4x4d &val)
virtual void writeObjectHeader(StorageMode mode, StorageAgent *agent)
virtual void writeObjectByVal(const Serializable &obj)
void write(const agx::Vec2i64 &val)
void write(const agx::Matrix3x3f &val)
agx::HashTable< const Serializable *, IdEntry > ObjectToIdMap
static void setUseCurrentDate(bool flag)
Specify if the current date (and time) at execution time should be used when creating archive,...
void write(const agx::Quat &val)
virtual ~OutputArchive()
Destructor.
virtual void write(const agx::Uuid &val)
virtual void write(agx::UInt8 val)
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 addAttribute(const char *name, agx::UInt16 value)
virtual void writeTypeHeader(StorageAgent *agent)
virtual void addAttribute(const char *name, agx::UInt64 value)
virtual void addAttribute(const char *name, agx::UInt8 value)
StorageAgentToIdMap m_storageAgentToIdMap
void write(const agx::Vec4f &val)
virtual void endSection(const char *) override
agx::Event2< const Serializable *, agx::UInt32 > StoreEvent
virtual void addAttribute(const char *name, const char *value)
void write(const Serializable *serializable, StorageMode mode)
void write(const agx::Vec3f &val)
std::ostream & getStream()
Return a reference to the output stream.
virtual void addAttribute(const char *name, float value)
bool hasModification(const agx::String &modification) const
void write(const agx::Vec3d &val)
void write(const agx::Vec3i32 &val)
void write(const Serializable &serializable, StorageMode mode)
agx::HashTable< StorageAgent *, agx::UInt32 > StorageAgentToIdMap
virtual void addAttribute(const char *name, bool value)
void write(const agx::Vec2i32 &val)
virtual void addAttribute(const char *name, agx::Int32 value)
void write(const agx::RangeReal &val)
void setWriteBufferSize(agx::UInt32 bufferSize)
Specify a new buffer size for the write buffer.
virtual void addAttribute(const char *name, char value)
virtual void write(agx::Int32 val)
void write(const agx::Vec2d &val)
bool getUseCurrentDate()
Return if the current date (and time) at execution time should be used when creating archive,...
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)
virtual void write(const void *buf, size_t len)
This method will write raw data into the archive.
virtual void addAttribute(const char *name, const agx::Uuid &value)
void write(const agx::SPDMatrix3x3 &val)
std::ostream & m_outputStream
int getNumObjectsSkipped() const
virtual void addAttribute(const char *name, agx::UInt32 value)
virtual void addAttribute(const char *name, double value)
void write(const agx::Vec3i64 &val)
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Matrix class for rigid transformations (translation, rotation).
An event with two arguments.
Inheritance with partial specialization due to bug with ref_ptr containers.
Inheritance with partial specialization due to bug with ref_ptr containers.
Representation of a name string.
Specialized type of matrices for holding symmetric positive definite matrices.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
A class holding 4 dimensional vectors and providing basic arithmetic.
Smart pointer for handling referenced counted objects.
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
agx::ref_ptr< OutputArchive > OutputArchiveRef
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 write(const std::string &filename, const agxStream::Serializable *data)
Write a Serializable object to a file.
OutputArchive & operator<<(OutputArchive &out, OutputRef< T > val)
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
IdEntry(agx::UInt32 _id=agx::InvalidIndex)
This struct is used to handle id-collisions when using incremental journal.
OutputRef & operator=(const OutputRef &other)
OutputRef(const char *name, const T &obj, StorageMode mode)
OutputRef(const char *name, const T *obj, StorageMode mode)
OutputVal & operator=(const OutputVal &other)
OutputVal(const char *name, const T obj)