![]() |
AGX Dynamics 2.40.1.2
|
The JournalArchive provides an abstract class for inspecting and manipulating the contents of a created journal. More...
#include <JournalArchive.h>
Public Types | |
typedef agxNet::StructuredMessage | PlotData |
typedef agx::ref_ptr< PlotData > | PlotDataRef |
typedef agx::Vector< PlotDataRef > | PlotDataRefVector |
typedef agx::observer_ptr< const Session > | SessionConstObserver |
typedef agx::ref_ptr< const Session > | SessionConstRef |
typedef agx::observer_ptr< Session > | SessionObserver |
typedef agx::ref_ptr< Session > | SessionRef |
typedef agx::HashTable< agx::Name, agxData::JournalArchive::SessionRef > | SessionTable |
Public Member Functions | |
bool | copySession (agxData::JournalArchive::Session *session, agxData::JournalArchive *target) |
Copy the given session from this journal into the given target journal. | |
bool | copyTo (agxData::JournalArchive *target) |
Copy the session to another JournalArchive. | |
virtual DiskFrameReader * | createFrameReader (agxData::JournalArchive::Session *session)=0 |
virtual DiskFrameWriter * | createFrameWriter (agxData::JournalArchive::Session *session)=0 |
virtual agxData::JournalArchive::Session * | createNewSession (const agx::Name &name)=0 |
Create a new session with the given name. | |
virtual void | finalizeHeader ()=0 |
agx::UInt32 | getAgxVersionNumber () const |
const agx::String & | getAgxVersionString () const |
virtual void | getAllPlots (PlotDataRefVector &result)=0 |
agx::Real64 | getComputationTime () const |
virtual agx::String | getCustomFilesPath (bool create=true) const =0 |
Returns the path to a disk directory where custom files related to the journal may be stored. | |
virtual agx::String | getCustomFilesPath (bool create=true) const =0 |
Get the path a disk directory where additional files related to the session may be stored. | |
virtual agx::String | getCustomFilesPath (const agx::Name &sessionName, bool create=true) const =0 |
Returns the path to a disk directory where custom files related to the given session may be stored. | |
const agx::Date * | getDate () const |
agx::UInt64 | getFirstFrameIndex () const |
agx::Real64 | getFirstFrameTimeStamp () const |
virtual agxData::Frame::Header | getFrameHeader (agx::UInt frameIndex) const =0 |
Load the header data for a particular frame. | |
agxData::FrameIO * | getFrameIO () |
agx::UInt64 | getFrameStride () const |
SerializedFrame::HeaderFormat | getHeaderFormat () const |
agxData::JournalArchive * | getJournal () |
const agxData::JournalArchive * | getJournal () const |
agx::UInt64 | getLastFrameIndex () const |
agx::Real64 | getLastFrameTimeStamp () const |
const agx::Name & | getName () const |
const agx::Name & | getName () const |
virtual agx::UInt | getNextFrameIndex (agx::UInt currentFrameIndex, agx::Int offset) const =0 |
agx::UInt64 | getNumFrames () const |
size_t | getNumSessions () const |
const agx::String & | getPath () const |
virtual agx::String | getPath () const =0 |
Returns a format specific string that identifies the location of this session within a journal. | |
virtual PlotData * | getPlot (const agx::String &plotName)=0 |
virtual void | getPlotList (agx::StringVector &result)=0 |
virtual agx::String | getScenePath (bool create=true) const =0 |
Get the path on disk where the .agx file, called the scene file, containing the initial state of the simulation may be stored. | |
agxData::JournalArchive::Session * | getSession (const agx::Name &name) |
const agxData::JournalArchive::Session * | getSession (const agx::Name &name) const |
const SessionTable & | getSessions () const |
agx::Component * | getSimulationHeader () |
agx::Real64 | getTimeStep () const |
bool | is64BitArchitecture () const |
bool | is64BitReal () const |
bool | isLittleEndian () const |
bool | isOwnerOf (const agxData::JournalArchive::Session *session) const |
void | listSessionNames (agx::Vector< agx::Name > &result) const |
Add to the end of the given Vector the names of all the sessions in the Journal. | |
virtual bool | packSceneData (std::istream &sceneData)=0 |
Copy the scene data found in the given stringstream into the journal in some format specific way. | |
virtual bool | packSceneData (std::stringstream &sceneData)=0 |
Copy the scene data found in the given stringstream into the journal in some format specific way. | |
virtual bool | recordExtraData (const agx::String &key, const agx::String &value)=0 |
Store a string key-value pair to the session on disk. | |
bool | recordExtraDataAsJSon (const agx::String &key, const agx::String &value) |
Store a string key-value pair to the session on disk, without ruining the . | |
virtual void | removePlot (const agx::String &plotName)=0 |
virtual bool | removeSession (agxData::JournalArchive::Session *session)=0 |
Remove the given session from the journal. | |
bool | removeSession (const agx::Name &name) |
Remove the session with the given name from the journal. | |
virtual bool | renameSession (agxData::JournalArchive::Session *session, const agx::Name &newName)=0 |
Rename the given session to the given new name. | |
agx::String | retrieveExtraData (const agx::String &key) |
virtual bool | retrieveExtraData (const agx::String &key, agx::String &value)=0 |
Read back the value associated with the key from disk. | |
agx::String | retrieveExtraDataAsJSon (const agx::String &key) |
bool | retrieveExtraDataAsJSon (const agx::String &key, agx::String &value) |
Read back the value associated with the key from disk. | |
virtual void | savePlot (const PlotData *plot)=0 |
void | set64BitArchitecture (bool flag) |
void | set64BitReal (bool flag) |
void | setAgxVersionNumber (const agx::UInt32 version) |
void | setAgxVersionString (const agx::String &version) |
void | setComputationTime (agx::Real64 computationTime) |
void | setDate (agx::Date *date) |
void | setFirstFrameIndex (agx::UInt64 startFrame) |
void | setFirstFrameTimeStamp (agx::Real64 startTime) |
void | setFrameIO (agxData::FrameIO *frameIO) |
void | setFrameStride (agx::UInt64 stride) |
void | setHeaderFormat (SerializedFrame::HeaderFormat format) |
Some journal formats support more than one format for frame metadata. | |
void | setLastFrameIndex (agx::UInt64 endFrame) |
void | setLastFrameTimeStamp (agx::Real64 endTime) |
void | setLittleEndian (bool flag) |
void | setNumFrames (agx::UInt64 numFrames) |
void | setSimulationHeader (agx::Component *header) |
void | setTimeStep (agx::Real64 timeStep) |
bool | transferSession (agxData::JournalArchive::Session *session, agxData::JournalArchive *target) |
Transfer the given session from this journal into the given target. | |
bool | transferTo (agxData::JournalArchive *target) |
Transfer the session to another JournalArchive. The target JournalArchive must be of the same correct type. | |
virtual bool | truncate (agx::UInt firstFrameToRemove)=0 |
Remove all frames from the given index and forward. | |
virtual bool | unpackSceneData (std::ostream &sceneData)=0 |
Copy scene data from the archive, stored in some format specific way, into the given stringstream. | |
virtual bool | unpackSceneData (std::stringstream &sceneData)=0 |
Copy scene data from the archive, stored in some format specific way, into the given stringstream. | |
virtual bool | unpackSceneFile ()=0 |
Ensure that the scene file for the session is available at the location returned by getScenePath. | |
virtual void | writeHeader ()=0 |
![]() | |
Referenced () | |
Default constructor. | |
Referenced (const Referenced &) | |
template<typename T > | |
T * | as () |
Subclass casting. | |
template<typename T > | |
const T * | as () const |
template<typename T > | |
T * | asSafe () |
Safe subclass casting, return nullptr if template type does not match. | |
template<typename T > | |
const T * | asSafe () const |
int | getReferenceCount () const |
template<typename T > | |
bool | is () const |
Subclass test. | |
Referenced & | operator= (const Referenced &) |
Assignment operator. Will increment the number of references to the referenced object. | |
void | reference (void *ptr=nullptr) const |
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
void | unreference (void *ptr=nullptr) const |
Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
void | unreference_nodelete () const |
Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Static Public Member Functions | |
static agx::String | generateNameFromCurrentDate () |
![]() | |
template<typename T > | |
static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
JournalArchive () | |
JournalArchive (const agx::Name &name, const agx::String &path) | |
virtual | ~JournalArchive () |
virtual | ~Session () |
virtual agxData::JournalArchive::Session * | makeCopy (agxData::JournalArchive::Session *session)=0 |
Create a copy of the given session. The copy will have its disk data stored in the current JournalArchive. | |
bool | registerSession (agxData::JournalArchive::Session *newSession) |
Create the Journal <-> Session coupling. | |
bool | rename (const agx::Name &name) |
Session (const agx::Name &name) | |
void | setName (const agx::Name &name) |
void | setPath (const agx::String &path) |
bool | unregisterSession (agxData::JournalArchive::Session *removedSession) |
Remove the Journal <-> Session coupling. | |
bool | updateSessionAndTableWithNewName (agxData::JournalArchive::Session *session, const agx::Name &newName) |
Change the name of the given session. Will ensure that the session table is kept consistent. | |
![]() | |
virtual | ~Referenced () |
Destructor. | |
void | allocateObserverVector () const |
void | deleteUsingDeleteHandler () const |
Additional Inherited Members | |
![]() | |
static DeleteHandler * | getDeleteHandler () |
static void | setDeleteHandler (DeleteHandler *handler) |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
![]() | |
Mutex | m_mutex |
ObserverContainer | m_observers |
AtomicValue | m_refCount |
The JournalArchive provides an abstract class for inspecting and manipulating the contents of a created journal.
Support for the various saved journal formats is provided by classes deriving from this one.
Definition at line 41 of file JournalArchive.h.
Definition at line 316 of file JournalArchive.h.
Definition at line 317 of file JournalArchive.h.
Definition at line 318 of file JournalArchive.h.
typedef agx::observer_ptr< const Session > agxData::JournalArchive::SessionConstObserver |
Definition at line 44 of file JournalArchive.h.
typedef agx::ref_ptr< const Session > agxData::JournalArchive::SessionConstRef |
Definition at line 44 of file JournalArchive.h.
Definition at line 44 of file JournalArchive.h.
Definition at line 44 of file JournalArchive.h.
typedef agx::HashTable<agx::Name, agxData::JournalArchive::SessionRef> agxData::JournalArchive::SessionTable |
Definition at line 47 of file JournalArchive.h.
|
protected |
|
protected |
|
protectedvirtual |
|
protectedvirtual |
bool agxData::JournalArchive::copySession | ( | agxData::JournalArchive::Session * | session, |
agxData::JournalArchive * | target | ||
) |
Copy the given session from this journal into the given target journal.
The session must be owned by the current JournalArchive and the target must be of the same journal type, i.e, use the same disk format.
session | The session to copy. |
target | The journal that should receive the copy. |
bool agxData::JournalArchive::copyTo | ( | agxData::JournalArchive * | target | ) |
Copy the session to another JournalArchive.
The target JournalArchive must be of the same correct type. The result is the same as if "session->getJournal()->copySession(session, target)" had been called.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Create a new session with the given name.
Implemented in agxData::FileJournal.
|
pure virtual |
|
static |
agx::UInt32 agxData::JournalArchive::getAgxVersionNumber | ( | ) | const |
const agx::String & agxData::JournalArchive::getAgxVersionString | ( | ) | const |
|
pure virtual |
agx::Real64 agxData::JournalArchive::getComputationTime | ( | ) | const |
|
pure virtual |
Returns the path to a disk directory where custom files related to the journal may be stored.
The directory, including parents, is created if necessary if the 'create' argument is true.
create | If true then missing directories in the returned path is created. |
Implemented in agxData::FileJournal.
|
pure virtual |
Get the path a disk directory where additional files related to the session may be stored.
Can create the folder structure if it does not yet exist.
create | If true then the returned folder and its parents are created. |
Implemented in agxData::FileJournal.
|
pure virtual |
Returns the path to a disk directory where custom files related to the given session may be stored.
The directory, including parents, is created if necessary if the 'create' parameter is true. The given session name does not need to denote a session that is part of the journal. If not, then the returned path is the path that a sessions with the given name would have if such a session existed.
sessionName | The name of the session whose custom files path is needed. |
Implemented in agxData::FileJournal.
const agx::Date * agxData::JournalArchive::getDate | ( | ) | const |
agx::UInt64 agxData::JournalArchive::getFirstFrameIndex | ( | ) | const |
agx::Real64 agxData::JournalArchive::getFirstFrameTimeStamp | ( | ) | const |
|
pure virtual |
Load the header data for a particular frame.
agxData::FrameIO * agxData::JournalArchive::getFrameIO | ( | ) |
agx::UInt64 agxData::JournalArchive::getFrameStride | ( | ) | const |
SerializedFrame::HeaderFormat agxData::JournalArchive::getHeaderFormat | ( | ) | const |
agxData::JournalArchive * agxData::JournalArchive::getJournal | ( | ) |
const agxData::JournalArchive * agxData::JournalArchive::getJournal | ( | ) | const |
agx::UInt64 agxData::JournalArchive::getLastFrameIndex | ( | ) | const |
agx::Real64 agxData::JournalArchive::getLastFrameTimeStamp | ( | ) | const |
const agx::Name & agxData::JournalArchive::getName | ( | ) | const |
const agx::Name & agxData::JournalArchive::getName | ( | ) | const |
|
pure virtual |
agx::UInt64 agxData::JournalArchive::getNumFrames | ( | ) | const |
size_t agxData::JournalArchive::getNumSessions | ( | ) | const |
const agx::String & agxData::JournalArchive::getPath | ( | ) | const |
|
pure virtual |
Returns a format specific string that identifies the location of this session within a journal.
This may be, for example, a disk or HDF5 path.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Get the path on disk where the .agx file, called the scene file, containing the initial state of the simulation may be stored.
Actual presence of the .agx file depends on if it has been written yet.
If the journal stores the scene data in some internal format, then the unpackSceneFile may be used to copy the initial state from the internal format into a .agx file located at the path returned by this function.
agxData::JournalArchive::Session * agxData::JournalArchive::getSession | ( | const agx::Name & | name | ) |
const agxData::JournalArchive::Session * agxData::JournalArchive::getSession | ( | const agx::Name & | name | ) | const |
const SessionTable & agxData::JournalArchive::getSessions | ( | ) | const |
agx::Component * agxData::JournalArchive::getSimulationHeader | ( | ) |
agx::Real64 agxData::JournalArchive::getTimeStep | ( | ) | const |
bool agxData::JournalArchive::is64BitArchitecture | ( | ) | const |
bool agxData::JournalArchive::is64BitReal | ( | ) | const |
bool agxData::JournalArchive::isLittleEndian | ( | ) | const |
bool agxData::JournalArchive::isOwnerOf | ( | const agxData::JournalArchive::Session * | session | ) | const |
void agxData::JournalArchive::listSessionNames | ( | agx::Vector< agx::Name > & | result | ) | const |
Add to the end of the given Vector the names of all the sessions in the Journal.
|
protectedpure virtual |
Create a copy of the given session. The copy will have its disk data stored in the current JournalArchive.
Implemented in agxData::FileJournal.
|
pure virtual |
Copy the scene data found in the given stringstream into the journal in some format specific way.
The method is intended to be used with a stringstream filled using the agxSDK::Simulation::write method.
|
pure virtual |
Copy the scene data found in the given stringstream into the journal in some format specific way.
The method is intended to be used with a stringstream filled using the agxSDK::Simulation::write method.
|
pure virtual |
Store a string key-value pair to the session on disk.
bool agxData::JournalArchive::recordExtraDataAsJSon | ( | const agx::String & | key, |
const agx::String & | value | ||
) |
Store a string key-value pair to the session on disk, without ruining the .
|
protected |
Create the Journal <-> Session coupling.
Will fail if there already is a session with the given name in the session table.
|
pure virtual |
|
pure virtual |
Remove the given session from the journal.
Implemented in agxData::FileJournal.
bool agxData::JournalArchive::removeSession | ( | const agx::Name & | name | ) |
Remove the session with the given name from the journal.
|
protected |
|
pure virtual |
Rename the given session to the given new name.
session | The session to rename. |
newName | The name that the session should be renamed to. |
Implemented in agxData::FileJournal.
agx::String agxData::JournalArchive::retrieveExtraData | ( | const agx::String & | key | ) |
|
pure virtual |
Read back the value associated with the key from disk.
The value, if found, is stored in 'value'
agx::String agxData::JournalArchive::retrieveExtraDataAsJSon | ( | const agx::String & | key | ) |
bool agxData::JournalArchive::retrieveExtraDataAsJSon | ( | const agx::String & | key, |
agx::String & | value | ||
) |
Read back the value associated with the key from disk.
The value, if found, is stored in 'value'
|
pure virtual |
|
protected |
void agxData::JournalArchive::set64BitArchitecture | ( | bool | flag | ) |
void agxData::JournalArchive::set64BitReal | ( | bool | flag | ) |
void agxData::JournalArchive::setAgxVersionNumber | ( | const agx::UInt32 | version | ) |
void agxData::JournalArchive::setAgxVersionString | ( | const agx::String & | version | ) |
void agxData::JournalArchive::setComputationTime | ( | agx::Real64 | computationTime | ) |
void agxData::JournalArchive::setDate | ( | agx::Date * | date | ) |
void agxData::JournalArchive::setFirstFrameIndex | ( | agx::UInt64 | startFrame | ) |
void agxData::JournalArchive::setFirstFrameTimeStamp | ( | agx::Real64 | startTime | ) |
void agxData::JournalArchive::setFrameIO | ( | agxData::FrameIO * | frameIO | ) |
void agxData::JournalArchive::setFrameStride | ( | agx::UInt64 | stride | ) |
void agxData::JournalArchive::setHeaderFormat | ( | SerializedFrame::HeaderFormat | format | ) |
Some journal formats support more than one format for frame metadata.
It is the responsibility of the agxData::Track reading or writing from/to the session to ensure that the set header format matches the actual format used on disk. In particular, setHeaderFormat cannot be used to change the header format of a session.
void agxData::JournalArchive::setLastFrameIndex | ( | agx::UInt64 | endFrame | ) |
void agxData::JournalArchive::setLastFrameTimeStamp | ( | agx::Real64 | endTime | ) |
void agxData::JournalArchive::setLittleEndian | ( | bool | flag | ) |
|
protected |
void agxData::JournalArchive::setNumFrames | ( | agx::UInt64 | numFrames | ) |
|
protected |
void agxData::JournalArchive::setSimulationHeader | ( | agx::Component * | header | ) |
void agxData::JournalArchive::setTimeStep | ( | agx::Real64 | timeStep | ) |
bool agxData::JournalArchive::transferSession | ( | agxData::JournalArchive::Session * | session, |
agxData::JournalArchive * | target | ||
) |
Transfer the given session from this journal into the given target.
The session must be owned by the current JournalArchive and the target must be of the same journal type, i.e., use the same disk format. It is safe to continue using pointers to the transfered session, then in-memory object is updated rather than recreated.
session | The session to transfer. |
target | The journal that should take over ownership of the session. |
bool agxData::JournalArchive::transferTo | ( | agxData::JournalArchive * | target | ) |
Transfer the session to another JournalArchive. The target JournalArchive must be of the same correct type.
|
pure virtual |
Remove all frames from the given index and forward.
|
pure virtual |
Copy scene data from the archive, stored in some format specific way, into the given stringstream.
The stringstream can then be passed on to the agxSDK::Simulation::read method.
|
pure virtual |
Copy scene data from the archive, stored in some format specific way, into the given stringstream.
The stringstream can then be passed on to the agxSDK::Simulation::read method.
|
pure virtual |
Ensure that the scene file for the session is available at the location returned by getScenePath.
Will overwrite the scene file with the packed version if a file is already present at the path returned by getScenePath.
|
protected |
Remove the Journal <-> Session coupling.
Note that this will do an unreference of the session and may therefore delete the session.
|
protected |
Change the name of the given session. Will ensure that the session table is kept consistent.
|
pure virtual |