AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agxData::FileJournal Class Reference

The FileJournal provides a way to inspect and manipulate a journal created by the FileFrameWriter and stored on disk. More...

#include <FileJournal.h>

+ Inheritance diagram for agxData::FileJournal:

Public Types

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
 
- Public Types inherited from agxData::JournalArchive
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

 FileJournal (const agx::String &diskPath)
 Open a journal on disk.
 
virtual DiskFrameReader * createFrameReader (JournalArchive::Session *session) override
 
virtual DiskFrameWriter * createFrameWriter (JournalArchive::Session *session) override
 
virtual JournalArchive::Session * createNewSession (const agx::Name &name) override
 Create a new session within the journal.
 
virtual agx::String getCustomFilesPath (bool create=true) const override
 
virtual agx::String getCustomFilesPath (const agx::Name &sessionName, bool create=true) const override
 
agxData::FileJournal::Session * getFileSession (const agx::Name &name)
 
virtual bool removeSession (agxData::JournalArchive::Session *session) override
 Remove the given session from the journal.
 
virtual bool renameSession (agxData::JournalArchive::Session *session, const agx::Name &newName) override
 Rename the given session, including data movement on disk.
 
- Public Member Functions inherited from agxData::JournalArchive
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
 
- Public Member Functions inherited from agx::Referenced
 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 bool isFileJournal (const agx::String &path)
 
static bool parseSessionPath (const agx::String &fullPath, agx::String &journalPath, agx::String &sessionName)
 Split the given session path into the path to the path to the journal and the name of the session.
 
- Static Public Member Functions inherited from agxData::JournalArchive
static agx::String generateNameFromCurrentDate ()
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~FileJournal ()
 
virtual agxData::JournalArchive::Session * makeCopy (agxData::JournalArchive::Session *session) override
 Create a copy of the given session. The copy will have its disk data stored in the current JournalArchive.
 
- Protected Member Functions inherited from agxData::JournalArchive
 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.
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

The FileJournal provides a way to inspect and manipulate a journal created by the FileFrameWriter and stored on disk.

Definition at line 39 of file FileJournal.h.

Member Typedef Documentation

◆ SessionConstObserver

◆ SessionConstRef

Definition at line 46 of file FileJournal.h.

◆ SessionObserver

◆ SessionRef

Definition at line 46 of file FileJournal.h.

Constructor & Destructor Documentation

◆ FileJournal()

agxData::FileJournal::FileJournal ( const agx::String &  diskPath)

Open a journal on disk.

Parameters
diskPathThe disk path to a directory which is a journal.

◆ ~FileJournal()

virtual agxData::FileJournal::~FileJournal ( )
protectedvirtual

Member Function Documentation

◆ createFrameReader()

virtual DiskFrameReader * agxData::FileJournal::createFrameReader ( JournalArchive::Session *  session)
overridevirtual

◆ createFrameWriter()

virtual DiskFrameWriter * agxData::FileJournal::createFrameWriter ( JournalArchive::Session *  session)
overridevirtual

◆ createNewSession()

virtual JournalArchive::Session * agxData::FileJournal::createNewSession ( const agx::Name &  name)
overridevirtual

Create a new session within the journal.

Will return nullptr if a session with the given name already exists.

Parameters
nameThe name of the new session.
Returns
The newly created session, or nullptr on error.

Implements agxData::JournalArchive.

◆ getCustomFilesPath() [1/2]

virtual agx::String agxData::FileJournal::getCustomFilesPath ( bool  create = true) const
overridevirtual
Returns
Path to a directory on disk where the current FileJournal stores its files.

Implements agxData::JournalArchive.

◆ getCustomFilesPath() [2/2]

virtual agx::String agxData::FileJournal::getCustomFilesPath ( const agx::Name &  sessionName,
bool  create = true 
) const
overridevirtual
Returns
Path to a directory on disk that belong to the session with the given name. Will return a path even if the FileJournal doesn't contain a session with the given name.

Implements agxData::JournalArchive.

◆ getFileSession()

agxData::FileJournal::Session * agxData::FileJournal::getFileSession ( const agx::Name &  name)
Returns
The session with the given name.

◆ isFileJournal()

static bool agxData::FileJournal::isFileJournal ( const agx::String &  path)
static

◆ makeCopy()

virtual agxData::JournalArchive::Session * agxData::FileJournal::makeCopy ( agxData::JournalArchive::Session *  session)
overrideprotectedvirtual

Create a copy of the given session. The copy will have its disk data stored in the current JournalArchive.

Implements agxData::JournalArchive.

◆ parseSessionPath()

static bool agxData::FileJournal::parseSessionPath ( const agx::String &  fullPath,
agx::String &  journalPath,
agx::String &  sessionName 
)
static

Split the given session path into the path to the path to the journal and the name of the session.

Parameters
fullPathDisk path to a session.
[out]journalPathWill be filled with the path of the journal, or the empty string on error.
[out]sessionNameWill be filled with the name of the session, or the empty string on error.

◆ removeSession()

virtual bool agxData::FileJournal::removeSession ( agxData::JournalArchive::Session *  session)
overridevirtual

Remove the given session from the journal.

Implements agxData::JournalArchive.

◆ renameSession()

virtual bool agxData::FileJournal::renameSession ( agxData::JournalArchive::Session *  session,
const agx::Name &  newName 
)
overridevirtual

Rename the given session, including data movement on disk.

Implements agxData::JournalArchive.


The documentation for this class was generated from the following file: