VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
DtSnapshotManager Class Reference

Classes

class  DtSaveScenarioJob
 
class  DtWriteSnapshotJob
 

Public Member Functions

 DtSnapshotManager (DtCgf *cgf)
 
virtual ~DtSnapshotManager ()
 
virtual bool init ()
 
virtual void tick ()
 
virtual void setSimTime (double)
 
virtual void setSnapshotsEnabled (bool flag)
 
virtual bool snapshotsEnabled () const
 
virtual void setSnapshotPeriod (double period)
 
virtual double snapshotPeriod () const
 
virtual void setCheckpointPeriod (double period)
 
virtual double checkpointPeriod () const
 
virtual void setNumberOfSnapshotsToKeep (int)
 
virtual int numberOfSnapshotsToKeep () const
 
virtual void setPauseCleanup (bool)
 
bool pauseCleanup () const
 
virtual void clear (bool allButBase=false)
 
virtual bool isBaseSnapshot (DtInMemorySnapshotPtr) const
 
virtual bool findScenarioFragment (const DtString &scenarioName, const DtString &runId, double simTime, DtScenario &scenario) const
 
virtual DtInMemorySnapshotPtr takeSnapshot (bool isPeriodic=false, bool makeBase=false)
 
virtual void saveCheckpoint (DtInMemorySnapshotPtr ptr)
 
virtual void rollbackToSimTime (double simTime)
 
virtual void rollbackTo (DtInMemorySnapshotPtr, const DtUUID &scenarioRunId=DtUUID::nullUUID())
 
virtual void clearOutStaleSnapshots ()
 
virtual DtInMemorySnapshotPtr snapshotFor (int id) const
 
virtual void setSnapshotHeartbeatTime (double d)
 
virtual double snapshotHeartbeatTime () const
 
virtual void setCheckpointsEnabled (bool)
 
virtual bool checkpointsEnabled () const
 
virtual void sendCurrentSnapshots ()
 
virtual bool saveSnapshot (const DtFilename &saveFolder, DtCompressedFileTransporter &tr, DtIfSaveScenario *msg, const DtScenario *currentScenario, const DtSimulationAddress &requestor)
 
virtual DtInMemorySnapshotPtr snapshotClosestToSimTime (double simTime, const DtString &checkpointName="", const DtString &runId="") const
 
virtual void removeSnapshotsAfter (double simTime)
 
virtual bool hasSnapshots () const
 
virtual void clearAllSnapshots ()
 
DtCgf * cgf () const
 
virtual unsigned int numberOfSaveJobsQueued () const
 
virtual unsigned int maxQueuedSaveJobsBeforeSkip () const
 
virtual void setMaxQueuedSaveJobsBeforeSkip (unsigned int)
 

Protected Types

typedef std::map< int,
DtInMemorySnapshotPtr > 
Snapshots
 
typedef std::map< int,
DtVrfCallbackQueue::CallbackInterface::Ptr > 
SavingSnapshots
 

Protected Member Functions

virtual void processSettings (const DtPeriodicSnapshotSettings *)
 
virtual void processCheckpointOperation (DtSimMessage *)
 
virtual void processSnapshotsRequest (DtSimMessage *)
 
virtual void processCheckpointFilesRequest (DtSimMessage *)
 
virtual void processRollbackToSnapshot (DtSimMessage *)
 
virtual void finishSavingSnapshots ()
 
virtual void deleteCheckpoint (const DtString &scenarioName, const DtString &runId, double simTime)
 
virtual void setMetaDataToCheckpoint (const DtString &scenarioName, const DtString &runId, const std::map< DtString, DtString > &displayName)
 
virtual void checkpointCount (const DtString &scenarioName, const DtString &runId, unsigned long requestId)
 
virtual void sendCheckpointRun (unsigned long)
 
virtual DtFilename scenarioFilenameFromScenario (const DtScenario &scenario) const
 
virtual DtFilename strippedPath (const DtFilename &fullName) const
 

Static Protected Member Functions

static void clearAllSnapshotsCallback (DtSimMessage *, void *)
 
static void settingConsumerCallback (const DtSettingsObject *settingsObject, void *usr)
 
static void checkpointOperationCallback (DtSimMessage *, void *)
 
static void requestSnapshots (DtSimMessage *, void *)
 
static void requestCheckpointFiles (DtSimMessage *, void *)
 
static void rollbackToSnapshot (DtSimMessage *, void *)
 

Protected Attributes

DtCgf * myCgf
 
bool myPeriodicSnapshotsEnabled
 
double mySnapshotPeriod
 
double myLastSnapshotHeartbeat
 
double mySnapshotHeartbeatTime
 
int myNumberOfSnapshotsToKeep
 
int myNextSnapshotId
 
int myLastSnapshotStep
 
Snapshots mySnapshots
 
Snapshots myPeriodicSnapshots
 
bool mySnapshotsModified
 
DtIfSnapshotsResponse myCurrentSnapshots
 
bool myPauseCleanup
 
SavingSnapshots myCheckpointing
 
DtVrfCallbackQueue * myFileWriterJobQueue
 
DtConsoleCommand * mySnapshotCommand
 
DtConsoleCommand * myCheckpointCommand
 
DtVrfCallbackQueue * myScenarioSaveJobQueue
 
bool myCheckpointsEnabled
 
double myCheckpointPeriod
 
int myLastCheckpointStep
 
int myMaxQueuedSaveJobsBeforeSkip = 10
 

Private Member Functions

 DtSnapshotManager (const DtSnapshotManager &)
 
DtSnapshotManager & operator= (const DtSnapshotManager &)
 

Member Typedef Documentation

Constructor & Destructor Documentation

DtSnapshotManager::DtSnapshotManager ( const DtSnapshotManager &  )
private

Not implemented.

DtSnapshotManager::DtSnapshotManager ( DtCgf *  cgf)
virtual DtSnapshotManager::~DtSnapshotManager ( )
virtual

Member Function Documentation

DtSnapshotManager& DtSnapshotManager::operator= ( const DtSnapshotManager &  )
private

Not implemented.

virtual bool DtSnapshotManager::init ( )
virtual
virtual void DtSnapshotManager::tick ( )
virtual
virtual void DtSnapshotManager::setSimTime ( double  )
virtual

Sets current simulation time so internal variable for heartbeat and snapshot can be initialized appropriately.

virtual void DtSnapshotManager::setSnapshotsEnabled ( bool  flag)
virtual

Default is disabled.

virtual bool DtSnapshotManager::snapshotsEnabled ( ) const
virtual
virtual void DtSnapshotManager::setSnapshotPeriod ( double  period)
virtual

Default is 1 second.

virtual double DtSnapshotManager::snapshotPeriod ( ) const
virtual
virtual void DtSnapshotManager::setCheckpointPeriod ( double  period)
virtual

Default is 30 seconds.

virtual double DtSnapshotManager::checkpointPeriod ( ) const
virtual
virtual void DtSnapshotManager::setNumberOfSnapshotsToKeep ( int  )
virtual

Number of periodic snapshots to keep around. 0 means keep all.

virtual int DtSnapshotManager::numberOfSnapshotsToKeep ( ) const
virtual
virtual void DtSnapshotManager::setPauseCleanup ( bool  )
virtual

Pauses cleanup of snapshotss. Use when rolling back just to be sure the rollback snapshot is not mistakenly cleaned up.

bool DtSnapshotManager::pauseCleanup ( ) const
inline
virtual void DtSnapshotManager::clear ( bool  allButBase = false)
virtual
virtual bool DtSnapshotManager::isBaseSnapshot ( DtInMemorySnapshotPtr  ) const
virtual

Returns true if this is the base snapshot.

virtual bool DtSnapshotManager::findScenarioFragment ( const DtString &  scenarioName,
const DtString &  runId,
double  simTime,
DtScenario &  scenario 
) const
virtual

Given the name and run id and sim time, find a scenario that closely matches. If no run id is given will use the most reccent run id under that scenario name.

virtual DtInMemorySnapshotPtr DtSnapshotManager::takeSnapshot ( bool  isPeriodic = false,
bool  makeBase = false 
)
virtual

Snapshots at the current point. Will not effect the periodic snapshot timing. If makeBase is true makes this snapshot the new "base" snapshot (which is one the front-end can rewind to by a single click). If makeBase is true and periodic is also true, periodic will be turned to non-periodic.

virtual void DtSnapshotManager::saveCheckpoint ( DtInMemorySnapshotPtr  ptr)
virtual
virtual void DtSnapshotManager::rollbackToSimTime ( double  simTime)
virtual

Rolls back the snapshot to the current simulation time. Note that this is only good for this cgf. In a multiple cgf environment calling this method will have unpredictable, and possibly buggy, results.

virtual void DtSnapshotManager::rollbackTo ( DtInMemorySnapshotPtr  ,
const DtUUID &  scenarioRunId = DtUUID::nullUUID() 
)
virtual

Rolls back to the given in memory snapshot. If supplied, the new scenario run id.

virtual void DtSnapshotManager::clearOutStaleSnapshots ( )
virtual

Clears out snapshots that are not within the window of snapshot keeping.

virtual DtInMemorySnapshotPtr DtSnapshotManager::snapshotFor ( int  id) const
virtual

Returns the in memory snapshot for this id.

virtual void DtSnapshotManager::setSnapshotHeartbeatTime ( double  d)
virtual

Sets the tim to send out all the snapshots. Default is 2 seconds or the periodic snapshot time, whichever is greater.

virtual double DtSnapshotManager::snapshotHeartbeatTime ( ) const
virtual
virtual void DtSnapshotManager::setCheckpointsEnabled ( bool  )
virtual
virtual bool DtSnapshotManager::checkpointsEnabled ( ) const
virtual
virtual void DtSnapshotManager::sendCurrentSnapshots ( )
virtual

Sends the current snapshots out.

virtual bool DtSnapshotManager::saveSnapshot ( const DtFilename &  saveFolder,
DtCompressedFileTransporter &  tr,
DtIfSaveScenario *  msg,
const DtScenario *  currentScenario,
const DtSimulationAddress &  requestor 
)
virtual

Saves the closest snapshot of the given sim time to save. If none exists returns false.

virtual DtInMemorySnapshotPtr DtSnapshotManager::snapshotClosestToSimTime ( double  simTime,
const DtString &  checkpointName = "",
const DtString &  runId = "" 
) const
virtual

Returns the snapshot closest to the given sim time. If checkpointName is given (and optional runId) will return a new in memory snapshot of the file on disk.

virtual void DtSnapshotManager::removeSnapshotsAfter ( double  simTime)
virtual

Removes all snapshots after the given simulation time.

virtual bool DtSnapshotManager::hasSnapshots ( ) const
virtual

Returns true if there are snapshots in the manager.

virtual void DtSnapshotManager::clearAllSnapshots ( )
virtual

Clears out all snapshots. If there is no scenario loaded also closes terrain.

DtCgf* DtSnapshotManager::cgf ( ) const
inline
virtual unsigned int DtSnapshotManager::numberOfSaveJobsQueued ( ) const
virtual
virtual unsigned int DtSnapshotManager::maxQueuedSaveJobsBeforeSkip ( ) const
virtual
virtual void DtSnapshotManager::setMaxQueuedSaveJobsBeforeSkip ( unsigned  int)
virtual

Keep at 0 to allow all jobs to be queued. Default is 10.

static void DtSnapshotManager::clearAllSnapshotsCallback ( DtSimMessage *  ,
void *   
)
staticprotected

Will tell all locally vrf simulated object so be ready for reinitialize, delete all the objects.

static void DtSnapshotManager::settingConsumerCallback ( const DtSettingsObject *  settingsObject,
void *  usr 
)
staticprotected
virtual void DtSnapshotManager::processSettings ( const DtPeriodicSnapshotSettings *  )
protectedvirtual
static void DtSnapshotManager::checkpointOperationCallback ( DtSimMessage *  ,
void *   
)
staticprotected
virtual void DtSnapshotManager::processCheckpointOperation ( DtSimMessage *  )
protectedvirtual
static void DtSnapshotManager::requestSnapshots ( DtSimMessage *  ,
void *   
)
staticprotected
virtual void DtSnapshotManager::processSnapshotsRequest ( DtSimMessage *  )
protectedvirtual
static void DtSnapshotManager::requestCheckpointFiles ( DtSimMessage *  ,
void *   
)
staticprotected
virtual void DtSnapshotManager::processCheckpointFilesRequest ( DtSimMessage *  )
protectedvirtual
static void DtSnapshotManager::rollbackToSnapshot ( DtSimMessage *  ,
void *   
)
staticprotected
virtual void DtSnapshotManager::processRollbackToSnapshot ( DtSimMessage *  )
protectedvirtual
virtual void DtSnapshotManager::finishSavingSnapshots ( )
protectedvirtual

Any snapshot runs that are done save here.

virtual void DtSnapshotManager::deleteCheckpoint ( const DtString &  scenarioName,
const DtString &  runId,
double  simTime 
)
protectedvirtual

If the runId is non null and simTime is -1 will delete the entire runId folder. If runId is null will delete the entire scenarioRun folder. If simTime is not -1 will only delete the scenario file that is close to the sim time. This will only delete files in the particular folder for this back-end address. If the directory is empty will delete the directory as well.

virtual void DtSnapshotManager::setMetaDataToCheckpoint ( const DtString &  scenarioName,
const DtString &  runId,
const std::map< DtString, DtString > &  displayName 
)
protectedvirtual

Writes to the meta data file the contents of the reader/writer key value pair – note this will replace and/or add. It will not remove. Quotes will be replaced by a special marker so that the reader/writer reading can proceess correctly.

virtual void DtSnapshotManager::checkpointCount ( const DtString &  scenarioName,
const DtString &  runId,
unsigned long  requestId 
)
protectedvirtual

Sends a message back with the file name the scenario name and data of key FILECOUNT that has the number of checkpoint files. If not files exist will still return count of 0.

virtual void DtSnapshotManager::sendCheckpointRun ( unsigned  long)
protectedvirtual

Sends off checkpoint run information if the checkpointing system for periodic checkpointing is enabled. If not will send off an empty packed.

virtual DtFilename DtSnapshotManager::scenarioFilenameFromScenario ( const DtScenario &  scenario) const
protectedvirtual
virtual DtFilename DtSnapshotManager::strippedPath ( const DtFilename &  fullName) const
protectedvirtual

Member Data Documentation

DtCgf* DtSnapshotManager::myCgf
protected
bool DtSnapshotManager::myPeriodicSnapshotsEnabled
protected
double DtSnapshotManager::mySnapshotPeriod
protected
double DtSnapshotManager::myLastSnapshotHeartbeat
protected
double DtSnapshotManager::mySnapshotHeartbeatTime
protected
int DtSnapshotManager::myNumberOfSnapshotsToKeep
protected
int DtSnapshotManager::myNextSnapshotId
mutableprotected
int DtSnapshotManager::myLastSnapshotStep
protected
Snapshots DtSnapshotManager::mySnapshots
protected
Snapshots DtSnapshotManager::myPeriodicSnapshots
protected
bool DtSnapshotManager::mySnapshotsModified
protected
DtIfSnapshotsResponse DtSnapshotManager::myCurrentSnapshots
protected
bool DtSnapshotManager::myPauseCleanup
protected
SavingSnapshots DtSnapshotManager::myCheckpointing
protected
DtVrfCallbackQueue* DtSnapshotManager::myFileWriterJobQueue
protected
DtConsoleCommand* DtSnapshotManager::mySnapshotCommand
protected
DtConsoleCommand* DtSnapshotManager::myCheckpointCommand
protected
DtVrfCallbackQueue* DtSnapshotManager::myScenarioSaveJobQueue
protected
bool DtSnapshotManager::myCheckpointsEnabled
protected
double DtSnapshotManager::myCheckpointPeriod
protected
int DtSnapshotManager::myLastCheckpointStep
protected
int DtSnapshotManager::myMaxQueuedSaveJobsBeforeSkip = 10
protected

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

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)