77 OutputArchive( std::ostream& outputStream, ObjectToIdMap& cache );
80 std::ostream&
getStream() {
return m_outputStream; }
85 void open(
const std::string& appName);
87 const ObjectToIdMap& getObjectToIdMap()
const;
88 void setObjectToIdMap(
const ObjectToIdMap& map);
94 return m_numObjectsWritten;
101 return m_numObjectsSkipped;
108 static void setUseCurrentDate(
bool flag);
114 bool getUseCurrentDate();
116 virtual void write(
char val);
117 virtual void write(
bool val);
134 virtual void write(
float val);
135 virtual void write(
double val);
137 virtual void write(
const std::string& val);
170 virtual void addAttribute(
const char *name,
bool value);
171 virtual void addAttribute(
const char *name,
const char* value);
172 virtual void addAttribute(
const char *name,
char value);
173 virtual void addAttribute(
const char *name,
agx::Int8 value);
174 virtual void addAttribute(
const char *name,
agx::UInt8 value);
175 virtual void addAttribute(
const char *name,
agx::UInt16 value);
176 virtual void addAttribute(
const char *name,
agx::Int32 value);
177 virtual void addAttribute(
const char *name,
agx::UInt32 value);
178 virtual void addAttribute(
const char *name,
agx::UInt64 value);
179 virtual void addAttribute(
const char *name,
float value);
180 virtual void addAttribute(
const char *name,
double value);
181 virtual void addAttribute(
const char *name,
const agx::Uuid& value);
184 virtual void addAttribute(
const char *name,
size_t value) { addAttribute(name, (
agx::UInt64)value); }
188 return m_endianMatch == 1;
205 virtual void write(
const void* buf,
size_t len);
211 void close()
override;
227 bool addModification(
const char *str);
232 bool hasModification(
const agx::String& modification)
const;
239 template<
typename VECTOR_TYPE>
254 const std::string& appName,
259 const std::string& revision,
262 virtual void writeArchiveHeader(
const std::string& appName,
267 const std::string& revision,
270 virtual void writeObjectHeader(
StorageMode mode, StorageAgent* agent);
271 virtual void writeTypeHeader(StorageAgent* agent);
295 void addModifications();
296 void writeModificationData();
297 bool m_hasAddedModifications;
298 static bool s_useCurrentDate;
305 template <
typename T>
338 template <
typename T>
350 #define DECLARE_OUTPUT_BASIC_TYPE(TYPE) \ 351 AGXCORE_EXPORT inline agxStream::OutputArchive& operator<<( OutputArchive& out, OutputVal<TYPE> val ) \ 353 out.beginSection(val.m_name); \ 354 out.write( val.m_obj ); \ 355 out.endSection(val.m_name); \ 358 AGXCORE_EXPORT inline OutputVal<TYPE> out(const char *name, TYPE obj) { return OutputVal<TYPE>(name, obj); } 414 template <
typename T>
418 template <
typename T>
421 out.beginSection(val.m_name);
422 out.write(val.m_obj, val.m_mode);
423 out.endSection(val.m_name);
427 template <
typename T>
430 out.beginSection(val.m_name);
431 out.write(val.m_obj);
432 out.endSection(val.m_name);
Inheritance with partial specialization due to bug with ref_ptr containers.
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...
ObjectToIdMap & m_objectToIdMap
A class holding 4 dimensional vectors and providing basic arithmetic.
OutputRef(const char *name, const T &obj, StorageMode mode)
StorageAgentToIdMap m_storageAgentToIdMap
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
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...
Representation of a name string.
agx::Event2< const Serializable *, agx::UInt32 > StoreEvent
#define DECLARE_OUTPUT_BASIC_TYPE(TYPE)
agx::HashTable< StorageAgent *, agx::UInt32 > StorageAgentToIdMap
OutputVal & operator=(const OutputVal &other)
Namespace agx contains the dynamics/math part of the AGX Dynamics API.
virtual void write(const agx::Name &val)
Matrix class for rigid transformations (translation, rotation).
Specialized type of matrices for holding symmetric positive definite matrices.
int getNumObjectsSkipped() const
Abstract base class for input/output storage of Serializable classes.
bool AGXPHYSICS_EXPORT write(const std::string &filename, const agxStream::Serializable *data)
Write a Serializable object to a file.
ObjectToIdMap m_defaultCache
std::ostream & getStream()
Return a reference to the output stream.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
bool getEndianMatch() const
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Class for writing serialized data in binary format to a stream.
IdEntry(agx::UInt32 _id=agx::InvalidIndex)
OutputRef & operator=(const OutputRef &other)
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
OutputRef(const char *name, const T *obj, StorageMode mode)
Inheritance with partial specialization due to bug with ref_ptr containers.
virtual void beginSection(const char *) override
agx::ref_ptr< OutputArchive > OutputArchiveRef
virtual void endSection(const char *) override
int getNumObjectsWritten() const
std::ostream & m_outputStream
OutputVal(const char *name, const T obj)
agx::HashTable< const Serializable *, IdEntry > ObjectToIdMap