AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agx::Journal Class Reference

#include <Journal.h>

+ Inheritance diagram for agx::Journal:

Classes

struct  SessionHeader
 

Public Types

enum  ArchiveFormat { AUTO , HDF5 , CUSTOM }
 
typedef agx::Callback2< Journal *, std::exception & > ExceptionHandler
 
typedef agx::Event1< Journal * > FoundIncrementalArchiveEvent
 
typedef agx::Event1< Journal * > FrameJumpEvent
 
enum  Mode { INVALID = -1 , RECORD , PLAYBACK }
 
typedef agx::Event1< UInt > ProgressEvent
 
typedef Callback2< agxSDK::Assembly *, bool > RenderLoaderCallback
 
typedef Callback1< const agx::String & > SceneLoaderCallback
 A callback that will be called when starting playback from a recording.
 
typedef agx::Event1< SessionHeader > SessionEvent
 

Public Member Functions

 Journal (const String &diskPath="Journal.agxJournal", ArchiveFormat archiveFormat=AUTO, bool loadPlotFromJournal=true, bool readOnlyIfExists=false)
 
void addDataBinding (const agx::Object *object, bool recursive=false)
 
void addDataBinding (const agx::Path &path, bool recursive=false)
 Add a data binding to the journal, eg Particle.position will register the buffer to be stored/restored by journal.
 
void attach (agxSDK::Simulation *simulation, Mode mode, agxData::Track *frameCache=nullptr, bool passive=false)
 Attach the journal to a simulation.
 
void clearDataBindings ()
 Remove all data bindings.
 
 Converter ()
 
agxData::JournalArchive::Session * createNewSession ()
 Create a new session within the current Journal archive.
 
agxData::JournalArchive::Session * createNewSession (const Name &name)
 
void detach ()
 Detach from the currently attached simulation.
 
void execute ()
 
void extractScene (const agx::String &sessionName)
 
agxData::JournalArchive::Session * findNewestSession ()
 
void flush (bool force=false)
 Flush the journal.
 
ArchiveFormat getArchiveFormat () const
 
agxData::JournalArchive::Session * getCurrentSession ()
 
const String & getDiskPath () const
 Set the disk path.
 
bool getEnableIncrementalStructure () const
 
agx::Real getEndTime () const
 
const ExceptionHandler & getExceptionHandler () const
 
agx::Bool getExpand () const
 
agxData::JournalArchive * getFileJournal () const
 
agxData::DiskFrameReader * getFileReader ()
 
const agxData::DiskFrameReader * getFileReader () const
 
agxData::DiskFrameWriter * getFileWriter ()
 
const agxData::DiskFrameWriter * getFileWriter () const
 
agx::UInt getFrameStride () const
 
Mode getMode () const
 
const Name & getName () const
 
RenderLoaderCallback getRenderLoader ()
 
bool getSaveSceneToDisk () const
 
agx::UInt16 getSerializationVersion () const
 Find what serialization version a Journal was stored with.
 
agxData::JournalArchive::Session * getSession (const agx::Name &name)
 
const agxData::JournalArchive::SessionTable & getSessions () const
 
agxSDK::Simulation * getSimulation ()
 
const agxSDK::Simulation * getSimulation () const
 
agxSDK::SimulationFrameReader * getSimulationReader ()
 
const agxSDK::SimulationFrameReader * getSimulationReader () const
 
agxSDK::SimulationFrameWriter * getSimulationWriter ()
 
const agxSDK::SimulationFrameWriter * getSimulationWriter () const
 
const agx::String & getSourcePath () const
 
agx::Real getStartTime () const
 
ArchiveFormat getTargetFormat () const
 
const agx::String & getTargetPath () const
 
agxData::Track * getTrack ()
 
const agxData::Track * getTrack () const
 
bool isJumping () const
 
bool jumpToFrame (agx::UInt frameIndex)
 Jump to a specified frame during playback.
 
bool jumpToTime (agx::Real time)
 Jump to a specified time during playback.
 
bool loadConfiguration (const String &configurationFilePath)
 Load data bindings from a configuration file.
 
agxData::JournalArchive::Session * loadNewestSession ()
 Load the most recent session.
 
agxData::FrameRef readFrameAtTime (agx::Real time)
 Explicitly read a frame from the journal.
 
agxData::FrameRef readFrameWithIndex (agx::UInt index)
 Explicitly read a frame from the journal.
 
bool removeDataBinding (const agx::Object *object)
 
bool removeDataBinding (const agx::Path &path)
 Remove a data binding from the journal.
 
bool removeSession (const agx::Name &sessionName)
 Remove a session from the journal.
 
bool renameCurrentSession (const agx::String &newName)
 Change the name of the current session.
 
bool sanityCheck (const agxSDK::Simulation *simulation, agxData::JournalArchive::Session *session) const
 
void saveScene ()
 Save the scene state, normally done automatically.
 
void setCurrentSession (agxData::JournalArchive::Session *session, bool saveSceneOnNextPreTick=true)
 Change the active session to the given session.
 
agxData::JournalArchive::Session * setCurrentSession (const agx::Name &sessionName, bool saveSceneOnNextPreTick=true)
 Change the active session to the session with the given name.
 
void setEnableIncrementalStructure (bool flag)
 Enable/disable incremental simulation structure recording.
 
void setEndTime (agx::Real endTime)
 
void setExceptionHandler (const ExceptionHandler &handler)
 Specify an exception handler.
 
void setExpand (agx::Bool expand)
 
void setFrameStride (agx::UInt stride)
 
void setMode (Mode mode)
 Set the journal mode, RECORD or PLAYBACK.
 
void setRenderLoader (RenderLoaderCallback loader)
 
void setSaveSceneToDisk (bool flag)
 Specifies if the simulation serialization should be temporary stored to disk or to memory when creating the journal.
 
void setSceneLoader (SceneLoaderCallback loader)
 
void setSourcePath (const agx::String &path)
 
void setStartTime (agx::Real startTime)
 
void setTargetFormat (ArchiveFormat format)
 
void setTargetPath (const agx::String &path)
 
void startRecordingAtTime (agx::Real time)
 Specify time stamp when journal recording should begin.
 
void triggerFrame ()
 
- 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 void convert (const String &targetPath, const String &sourcePath, ArchiveFormat targetFormat, bool expand=false)
 Convert journal from one format to another.
 
static bool findNewestSession (const agx::String &diskPath, agx::JournalRef &journal, agxData::JournalArchive::SessionRef &session)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Public Attributes

FoundIncrementalArchiveEvent foundIncrementalArchiveEvent
 
FrameJumpEvent journalFrameJumpEvent
 
ProgressEvent progressEvent
 
SessionEvent sessionEndEvent
 
SessionEvent sessionStartEvent
 

Protected Member Functions

virtual ~Journal ()
 
- 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

Definition at line 46 of file Journal.h.

Member Typedef Documentation

◆ ExceptionHandler

Definition at line 65 of file Journal.h.

◆ FoundIncrementalArchiveEvent

◆ FrameJumpEvent

Definition at line 66 of file Journal.h.

◆ ProgressEvent

Definition at line 409 of file Journal.h.

◆ RenderLoaderCallback

Definition at line 293 of file Journal.h.

◆ SceneLoaderCallback

A callback that will be called when starting playback from a recording.

Definition at line 290 of file Journal.h.

◆ SessionEvent

Definition at line 412 of file Journal.h.

Member Enumeration Documentation

◆ ArchiveFormat

Enumerator
AUTO 
HDF5 
CUSTOM 

AGX has to be built with HDF5-support to use this.

Definition at line 57 of file Journal.h.

◆ Mode

Enumerator
INVALID 
RECORD 
PLAYBACK 

Definition at line 50 of file Journal.h.

Constructor & Destructor Documentation

◆ Journal()

agx::Journal::Journal ( const String &  diskPath = "Journal.agxJournal",
ArchiveFormat  archiveFormat = AUTO,
bool  loadPlotFromJournal = true,
bool  readOnlyIfExists = false 
)

◆ ~Journal()

virtual agx::Journal::~Journal ( )
protectedvirtual

Member Function Documentation

◆ addDataBinding() [1/2]

void agx::Journal::addDataBinding ( const agx::Object *  object,
bool  recursive = false 
)

◆ addDataBinding() [2/2]

void agx::Journal::addDataBinding ( const agx::Path &  path,
bool  recursive = false 
)

Add a data binding to the journal, eg Particle.position will register the buffer to be stored/restored by journal.

◆ attach()

void agx::Journal::attach ( agxSDK::Simulation *  simulation,
Mode  mode,
agxData::Track *  frameCache = nullptr,
bool  passive = false 
)

Attach the journal to a simulation.

Parameters
simulationThe simulation
modeRECORD or PLAYBACK
frameCacheAn existing track to load cached frames from
passiveTrue if simulation should not be made aware of this journal, must be true if more than one journal is attached

◆ clearDataBindings()

void agx::Journal::clearDataBindings ( )

Remove all data bindings.

◆ convert()

static void agx::Journal::convert ( const String &  targetPath,
const String &  sourcePath,
ArchiveFormat  targetFormat,
bool  expand = false 
)
static

Convert journal from one format to another.

◆ Converter()

agx::Journal::Converter ( )

◆ createNewSession() [1/2]

agxData::JournalArchive::Session * agx::Journal::createNewSession ( )

Create a new session within the current Journal archive.

Will make the newly created session the active session.

◆ createNewSession() [2/2]

agxData::JournalArchive::Session * agx::Journal::createNewSession ( const Name &  name)

◆ detach()

void agx::Journal::detach ( )

Detach from the currently attached simulation.

◆ execute()

void agx::Journal::execute ( )

◆ extractScene()

void agx::Journal::extractScene ( const agx::String &  sessionName)

◆ findNewestSession() [1/2]

agxData::JournalArchive::Session * agx::Journal::findNewestSession ( )
Returns
The most recent session

◆ findNewestSession() [2/2]

static bool agx::Journal::findNewestSession ( const agx::String &  diskPath,
agx::JournalRef &  journal,
agxData::JournalArchive::SessionRef &  session 
)
static
Returns
The name of the sessions with the highest date in its header. The empty string is returned if there are no sessions in the journal.

◆ flush()

void agx::Journal::flush ( bool  force = false)

Flush the journal.

Parameters
forceDoes not wait for output thread to completed if true.

◆ getArchiveFormat()

ArchiveFormat agx::Journal::getArchiveFormat ( ) const
Returns
The journal archive format.

◆ getCurrentSession()

agxData::JournalArchive::Session * agx::Journal::getCurrentSession ( )

Definition at line 469 of file Journal.h.

◆ getDiskPath()

const String & agx::Journal::getDiskPath ( ) const

Set the disk path.

Returns
The disk path to the archive where the journal data is located.

Definition at line 464 of file Journal.h.

◆ getEnableIncrementalStructure()

bool agx::Journal::getEnableIncrementalStructure ( ) const
Returns
True if incremental structure recording is enabled.

◆ getEndTime()

agx::Real agx::Journal::getEndTime ( ) const

◆ getExceptionHandler()

const ExceptionHandler & agx::Journal::getExceptionHandler ( ) const
Returns
The current exception handler.

◆ getExpand()

agx::Bool agx::Journal::getExpand ( ) const

◆ getFileJournal()

agxData::JournalArchive * agx::Journal::getFileJournal ( ) const
Returns
The JournalArchive that frames are being read from or written to.

◆ getFileReader() [1/2]

agxData::DiskFrameReader * agx::Journal::getFileReader ( )

Definition at line 475 of file Journal.h.

◆ getFileReader() [2/2]

const agxData::DiskFrameReader * agx::Journal::getFileReader ( ) const

Definition at line 482 of file Journal.h.

◆ getFileWriter() [1/2]

agxData::DiskFrameWriter * agx::Journal::getFileWriter ( )

Definition at line 476 of file Journal.h.

◆ getFileWriter() [2/2]

const agxData::DiskFrameWriter * agx::Journal::getFileWriter ( ) const

Definition at line 483 of file Journal.h.

◆ getFrameStride()

agx::UInt agx::Journal::getFrameStride ( ) const

◆ getMode()

Journal::Mode agx::Journal::getMode ( ) const
Returns
The current journal mode.

Definition at line 465 of file Journal.h.

◆ getName()

const Name & agx::Journal::getName ( ) const
Returns
The name of the journal.

Definition at line 463 of file Journal.h.

◆ getRenderLoader()

RenderLoaderCallback agx::Journal::getRenderLoader ( )

◆ getSaveSceneToDisk()

bool agx::Journal::getSaveSceneToDisk ( ) const
Returns
true if simulation scene will be temporarily stored to disk when writing a journal.

◆ getSerializationVersion()

agx::UInt16 agx::Journal::getSerializationVersion ( ) const

Find what serialization version a Journal was stored with.

◆ getSession()

agxData::JournalArchive::Session * agx::Journal::getSession ( const agx::Name &  name)
Returns
The session within the JournalArchive that frames are being read from or written to.

◆ getSessions()

const agxData::JournalArchive::SessionTable & agx::Journal::getSessions ( ) const
Returns
All sessions in the journal archive.

◆ getSimulation() [1/2]

agxSDK::Simulation * agx::Journal::getSimulation ( )
Returns
the attached simulation

Definition at line 466 of file Journal.h.

◆ getSimulation() [2/2]

const agxSDK::Simulation * agx::Journal::getSimulation ( ) const
Returns
the attached simulation

Definition at line 467 of file Journal.h.

◆ getSimulationReader() [1/2]

agxSDK::SimulationFrameReader * agx::Journal::getSimulationReader ( )

Definition at line 472 of file Journal.h.

◆ getSimulationReader() [2/2]

const agxSDK::SimulationFrameReader * agx::Journal::getSimulationReader ( ) const

Definition at line 479 of file Journal.h.

◆ getSimulationWriter() [1/2]

agxSDK::SimulationFrameWriter * agx::Journal::getSimulationWriter ( )

Definition at line 473 of file Journal.h.

◆ getSimulationWriter() [2/2]

const agxSDK::SimulationFrameWriter * agx::Journal::getSimulationWriter ( ) const

Definition at line 480 of file Journal.h.

◆ getSourcePath()

const agx::String & agx::Journal::getSourcePath ( ) const

◆ getStartTime()

agx::Real agx::Journal::getStartTime ( ) const

◆ getTargetFormat()

ArchiveFormat agx::Journal::getTargetFormat ( ) const

◆ getTargetPath()

const agx::String & agx::Journal::getTargetPath ( ) const

◆ getTrack() [1/2]

agxData::Track * agx::Journal::getTrack ( )

Definition at line 471 of file Journal.h.

◆ getTrack() [2/2]

const agxData::Track * agx::Journal::getTrack ( ) const

Definition at line 478 of file Journal.h.

◆ isJumping()

bool agx::Journal::isJumping ( ) const
Returns
True if a jump is in progress.

◆ jumpToFrame()

bool agx::Journal::jumpToFrame ( agx::UInt  frameIndex)

Jump to a specified frame during playback.

Returns
True if successful

◆ jumpToTime()

bool agx::Journal::jumpToTime ( agx::Real  time)

Jump to a specified time during playback.

Returns
True if successful

◆ loadConfiguration()

bool agx::Journal::loadConfiguration ( const String &  configurationFilePath)

Load data bindings from a configuration file.

Returns
true for successful load, otherwise false

◆ loadNewestSession()

agxData::JournalArchive::Session * agx::Journal::loadNewestSession ( )

Load the most recent session.

Returns
nullptr if journal does not exist or does not contain any sessions.

◆ readFrameAtTime()

agxData::FrameRef agx::Journal::readFrameAtTime ( agx::Real  time)

Explicitly read a frame from the journal.

Parameters
timeThe point in time

◆ readFrameWithIndex()

agxData::FrameRef agx::Journal::readFrameWithIndex ( agx::UInt  index)

Explicitly read a frame from the journal.

Parameters
indexThe frame index

◆ removeDataBinding() [1/2]

bool agx::Journal::removeDataBinding ( const agx::Object *  object)

◆ removeDataBinding() [2/2]

bool agx::Journal::removeDataBinding ( const agx::Path &  path)

Remove a data binding from the journal.

◆ removeSession()

bool agx::Journal::removeSession ( const agx::Name &  sessionName)

Remove a session from the journal.

◆ renameCurrentSession()

bool agx::Journal::renameCurrentSession ( const agx::String &  newName)

Change the name of the current session.

◆ sanityCheck()

bool agx::Journal::sanityCheck ( const agxSDK::Simulation *  simulation,
agxData::JournalArchive::Session *  session 
) const

◆ saveScene()

void agx::Journal::saveScene ( )

Save the scene state, normally done automatically.

◆ setCurrentSession() [1/2]

void agx::Journal::setCurrentSession ( agxData::JournalArchive::Session *  session,
bool  saveSceneOnNextPreTick = true 
)

Change the active session to the given session.

The session must be part of the current JournalArchive.

◆ setCurrentSession() [2/2]

agxData::JournalArchive::Session * agx::Journal::setCurrentSession ( const agx::Name &  sessionName,
bool  saveSceneOnNextPreTick = true 
)

Change the active session to the session with the given name.

The session must be part of the current JournalArchive. Will return nullptr if it it didn't exist

◆ setEnableIncrementalStructure()

void agx::Journal::setEnableIncrementalStructure ( bool  flag)

Enable/disable incremental simulation structure recording.

Enabled by default.

◆ setEndTime()

void agx::Journal::setEndTime ( agx::Real  endTime)

◆ setExceptionHandler()

void agx::Journal::setExceptionHandler ( const ExceptionHandler &  handler)

Specify an exception handler.

◆ setExpand()

void agx::Journal::setExpand ( agx::Bool  expand)

◆ setFrameStride()

void agx::Journal::setFrameStride ( agx::UInt  stride)

◆ setMode()

void agx::Journal::setMode ( Mode  mode)

Set the journal mode, RECORD or PLAYBACK.

◆ setRenderLoader()

void agx::Journal::setRenderLoader ( RenderLoaderCallback  loader)

◆ setSaveSceneToDisk()

void agx::Journal::setSaveSceneToDisk ( bool  flag)

Specifies if the simulation serialization should be temporary stored to disk or to memory when creating the journal.

Storing to memory is default. But this might cause problem, as a large continuous memory need to be allocated. For 32bit applications, it might be problematic to allocate 100Mb or more continuous memory, hence storing to disk might be better. And slower.

DEFAULT: store to memory (false)

Parameters
flag- if true, scene will be stored to disk, otherwise to memory before written to journal.

◆ setSceneLoader()

void agx::Journal::setSceneLoader ( SceneLoaderCallback  loader)

◆ setSourcePath()

void agx::Journal::setSourcePath ( const agx::String &  path)

◆ setStartTime()

void agx::Journal::setStartTime ( agx::Real  startTime)

◆ setTargetFormat()

void agx::Journal::setTargetFormat ( ArchiveFormat  format)

◆ setTargetPath()

void agx::Journal::setTargetPath ( const agx::String &  path)

◆ startRecordingAtTime()

void agx::Journal::startRecordingAtTime ( agx::Real  time)

Specify time stamp when journal recording should begin.

◆ triggerFrame()

void agx::Journal::triggerFrame ( )

Member Data Documentation

◆ foundIncrementalArchiveEvent

FoundIncrementalArchiveEvent agx::Journal::foundIncrementalArchiveEvent

Definition at line 70 of file Journal.h.

◆ journalFrameJumpEvent

FrameJumpEvent agx::Journal::journalFrameJumpEvent

Definition at line 69 of file Journal.h.

◆ progressEvent

ProgressEvent agx::Journal::progressEvent

Definition at line 410 of file Journal.h.

◆ sessionEndEvent

SessionEvent agx::Journal::sessionEndEvent

Definition at line 414 of file Journal.h.

◆ sessionStartEvent

SessionEvent agx::Journal::sessionStartEvent

Definition at line 413 of file Journal.h.


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