174 virtual std::ostream&
write(std::ostream& str);
180 virtual std::istream&
read(std::istream& str);
182 inline Mode getMode()
const;
197 virtual void read(
float& val,
bool readAsFloat =
false);
199 virtual void read(
double& val,
bool readAsFloat =
false);
201 virtual void read(std::string& val);
237 virtual void write(
const std::string& val);
295 const char* m_blockName;
336 StorageStack(std::shared_ptr<std::stringstream> root);
340 virtual ~StorageStack();
343 std::string name()
const;
346 std::shared_ptr<std::stringstream> top();
348 std::shared_ptr<const std::stringstream> top()
const;
351 uint32_t size() {
return uint32_t(m_stack.size()); }
354 void push(
const std::string& blockName, std::shared_ptr<std::stringstream>);
360 void clear(std::shared_ptr <std::stringstream> root);
364 std::shared_ptr<std::stringstream> getNewStream();
371 void writeBuffer(
const char* data,
size_t numBytes, std::stringstream* stream);
373 typedef std::stack<std::pair<std::string, std::shared_ptr<std::stringstream> > > StreamStack;
375 std::shared_ptr<std::stringstream> m_root;
376 std::stack<std::shared_ptr<std::stringstream> > m_streamPool;
390 agx::UInt8 m_generation, m_major, m_minor, m_patch;
397 std::shared_ptr<std::stringstream> m_data;
400 StorageStack m_stack;
450 uint64_t readVal = 0;
452 val = size_t(readVal);
459 uint64_t readVal = 0;
567 out.write(int32_t(val));
573 out.write(uint64_t(val));
580 out.write(uint64_t(val));
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Ties a beginBlock/endBlock pair to a scope.
ScopedBlock(StorageStream &stream, const char *blockName)
The data pointed to by 'blockName' is not copied.
Abstract base class for storing/restoring a line/drums with version control.
void readHeader(std::istream &str)
virtual void read(agx::UInt64 &val)
@ ERROR_READING_FROM_DATASTREAM
@ ERROR_WRITING_TO_OUTSTREAM
@ ERROR_WRITING_TO_DATASTREAM
@ ERROR_READING_FROM_INSTREAM
virtual void write(const agx::Vec3f &val, FloatMode writeAsFloat=AS_DOUBLE)
writeAsFloat there to make this method compatible with write( double, bool ), it WILL be written as f...
StorageStream(Mode mode, bool useBlocks=false)
virtual void read(agx::Quat64 &val, bool readAsFloat=false)
If readAsFloat==true, then this Vec3 will be read from the stream as a 3 floats.
virtual void read(agx::Vec3d &val, bool readAsFloat=false)
If readAsFloat==true, then this Vec3 will be read from the stream as a 3 floats.
agx::UInt16 getStorageStreamVersion() const
virtual void write(char val)
virtual void write(double val, FloatMode writeAsFloat=AS_DOUBLE)
If writeAsFloat==true, then this variable will be written to the stream as a float.
virtual void write(const agx::Vec3d &val, FloatMode writeAsFloat=AS_DOUBLE)
If writeAsFloat==true, then this vector will be written to the stream as 3*float.
void setEnableMD5(bool flag)
Enable/Disable the MD5 check of the data.
virtual void read(bool &val)
AGXPHYSICS_EXPORT friend std::istream & operator>>(std::istream &str, StorageStream &storage)
virtual void write(const agx::Quat64 &val, FloatMode writeAsFloat=AS_DOUBLE)
If writeAsFloat==true, then this vector will be written to the stream as 3*float.
agx::UInt32 getVersion() const
agx::UInt16 getSerializationVersion() const
virtual ~StorageStream()
Destructor.
const std::stringstream & getStream() const
virtual std::istream & read(std::istream &str)
Method that will read data from a stream into this object.Derive your own if you want to read any loc...
void clear()
Re-initialize the stream so it has no data stored, just as it was when it was created initially.
virtual void write(const std::string &val)
virtual void read(agx::Vec3f &val, bool readAsFloat=false)
readAsFloat there to make this method compatible with write( double, bool ), it will always be read a...
AGXPHYSICS_EXPORT friend std::ostream & operator<<(std::ostream &str, StorageStream &storage)
virtual void write(agx::UInt8 val)
virtual void write(agx::UInt16 val)
void writeHeader(std::ostream &str, const char *data)
virtual void read(std::string &val)
virtual void write(const agx::AffineMatrix4x4f &val, FloatMode writeAsFloat=AS_DOUBLE)
writeAsFloat there to make this method compatible with write( double, bool ), it WILL be written as f...
StorageStream(const StorageStream &)
virtual void read(agx::UInt16 &val)
bool endBlock(const char *blockName)
End the block started by the corresponding beginBlock.
virtual void write(float val, FloatMode writeAsFloat=AS_FLOAT)
writeAsFloat there to make this method compatible with write( double, bool ), it WILL be written as f...
void beginBlock(const char *blockName)
Begin a new logical block within the stream.
bool write(agx::Vector< char > &buffer)
Write data from the stream into the buffer for external storage.
virtual void read(agx::AffineMatrix4x4f &val, bool readAsFloat=false)
readAsFloat there to make this method compatible with write( double, bool ), it will always be read a...
virtual void write(agx::Int32 val)
virtual void write(const agx::Quat32 &val, FloatMode writeAsFloat=AS_DOUBLE)
writeAsFloat there to make this method compatible with write( double, bool ), it WILL be written as f...
std::stringstream & getStream()
Return a direct reference to the current block stream, use with caution.
virtual void read(agx::AffineMatrix4x4d &val, bool readAsFloat=false)
If readAsFloat==true, then this matrix will be read from the stream as a 16 floats.
bool getEnableMD5() const
virtual void read(float &val, bool readAsFloat=false)
readAsFloat there to make this method compatible with write( double, bool ), it will be read as float...
virtual void read(char &val)
virtual void write(const agx::AffineMatrix4x4d &val, FloatMode writeAsFloat=AS_DOUBLE)
If writeAsFloat==true, then this Matrix will be written to the stream as 12*float.
virtual void read(agx::Quat32 &val, bool readAsFloat=false)
readAsFloat there to make this method compatible with write( double, bool ), it will always be read a...
virtual void write(agx::UInt64 val)
bool read(const agx::Vector< char > &buffer)
Read data from the buffer into the stream for restore.
virtual void read(agx::Int32 &val)
void checkMode(Mode newMode)
virtual void read(agx::UInt8 &val)
virtual void write(bool val)
virtual void read(double &val, bool readAsFloat=false)
If readAsFloat==true, then this variable will be read from the stream as a float.
virtual std::ostream & write(std::ostream &str)
Method that will write this object to an output stream, derive your own if you want to write any loca...
void skipBlock(const char *blockName)
Class defining a node that is part of a wire.
Matrix class for rigid transformations (translation, rotation).
The object holding quaternions and providing operations on these.
The rigid body class, combining a geometric model and a frame of reference.
A class holding 3 dimensional vectors and providing basic arithmetic.
Vector containing 'raw' data.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
bool AGXPHYSICS_EXPORT write(const std::string &filename, const agxStream::Serializable *data)
Write a Serializable object to a file.
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...
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.
OutputArchive & operator<<(OutputArchive &out, OutputRef< T > val)
InputArchive & operator>>(InputArchive &in, InputVal< 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.
AGXTERRAIN_EXPORT void clear()
Implements a Wire model with adaptive resolution.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.