SessionManager Class Reference
[Services]

Provides interfaces for saving and restoring the session and for creating a new session. More...

#include <SessionManager.h>

Inheritance diagram for SessionManager:

Inheritance graph

List of all members.

Public Types

enum  SerializationStatusEnum { SUCCESS, PARTIAL_SUCCESS, LOCKED, FAILURE }
typedef EnumWrapper
< SerializationStatusEnum
SerializationStatus

Public Member Functions

virtual std::string getName () const =0
virtual std::pair
< SerializationStatus,
std::vector< std::pair
< SessionItem *, std::string > > > 
serialize (const std::string &filename, Progress *pProgress)=0
virtual SessionItemgetSessionItem (const std::string &id)=0
virtual bool isSessionSaving () const =0
virtual bool isSessionLoading () const =0
virtual bool isSessionSaveLocked () const =0

Static Public Member Functions

static SessionSaveType getSettingQueryForSave ()
static bool hasSettingQueryForSave ()
static void setSettingQueryForSave (SessionSaveType newValue, bool setIfSame=false)
static std::string getSettingQueryForSaveKey ()
static bool getSettingAutoSaveEnabled ()
static bool hasSettingAutoSaveEnabled ()
static void setSettingAutoSaveEnabled (bool newValue, bool setIfSame=false)
static std::string getSettingAutoSaveEnabledKey ()
static unsigned int getSettingAutoSaveInterval ()
static bool hasSettingAutoSaveInterval ()
static void setSettingAutoSaveInterval (unsigned int newValue, bool setIfSame=false)
static std::string getSettingAutoSaveIntervalKey ()
static const std::string & signalAboutToSaveSession ()
static const std::string & signalAboutToRestore ()
static const std::string & signalSessionRestored ()
static const std::string & signalSessionSaved ()
static const std::string & signalClosed ()

Protected Member Functions

virtual ~SessionManager ()
virtual void lockSessionSave ()=0
virtual void unlockSessionSave ()=0


Detailed Description

Provides interfaces for saving and restoring the session and for creating a new session.

The session-save process is as follows: 1) The session manager retrieves a pointer to each SessionItem, including: a) Data Elements b) Windows c) Views d) Layers e) PlotSets f) Plot Widgets g) Animation Controllers i) Animations j) Modules k) PlugIn Descriptors l) PlugIn instances 2) The session directory is created, if necessary 3) The session directory is cleared of obsolete SessionItem files 4) For each SessionItem, it creates a SessionItemSerializer and calls SessionItem::serialize() 5) The Session index file is written.

This subclass of Subject will notify upon the following conditions:

See also:
SessionItem, SessionItemSerializer

Definition at line 54 of file SessionManager.h.


Member Typedef Documentation

The EnumWrapper contains a given enum value and provides a isValid() method which returns true if the contained enum value is valid.

Please see How To Use EnumWrapper for more information. The wrapped enum values are SessionManager::SerializationStatusEnum.

Definition at line 71 of file SessionManager.h.


Member Enumeration Documentation

Specifies the success of an attempt to serialize the session.

Enumerator:
SUCCESS  All session items were successfully saved.
PARTIAL_SUCCESS  Some session items were successfully saved.
LOCKED  Session saving has been temporarily locked.
FAILURE  No session items were successfully saved.

Definition at line 60 of file SessionManager.h.


Constructor & Destructor Documentation

virtual SessionManager::~SessionManager (  )  [protected, virtual]

This will be cleaned up during application close.

Plug-ins do not need to destroy it.

Definition at line 300 of file SessionManager.h.


Member Function Documentation

static SessionSaveType SessionManager::getSettingQueryForSave (  )  [static]

Returns the current value for this setting.

If this setting does not exist in ConfigurationSettings, a verification error will be logged to the message log and potentially a verification error message box will be displayed to the user.

Please see Settings Macros for more details

Returns:
the current value for this setting.

Definition at line 83 of file SessionManager.h.

static bool SessionManager::hasSettingQueryForSave (  )  [static]

Returns true if this setting exists and has a value in ConfigurationSettings.

Please see Settings Macros for more details

Returns:
true if this setting exists, false otherwise.

Definition at line 90 of file SessionManager.h.

static void SessionManager::setSettingQueryForSave ( SessionSaveType  newValue,
bool  setIfSame = false 
) [static]

Changes the current value of this setting to the new value.

Please see Settings Macros for more details

Parameters:
newValue the new value for this setting.
setIfSame If true, the value will be set into ConfigurationSettings even if the newValue and existing value are the same. This has the side-effect of making the value a per-user setting and stored in the user's configuration file. If false, this value will only be set if the newValue and existing value are different. Therefore the value will only be stored in the user's configuration file if the newValue is unique to the user.

Definition at line 106 of file SessionManager.h.

static std::string SessionManager::getSettingQueryForSaveKey (  )  [static]

Returns the key for this setting that could be passed to ConfigurationSettings::getSetting() or ConfigurationSettings::setSetting().

Please see Settings Macros for more details

Returns:
the key used for this setting.

Definition at line 114 of file SessionManager.h.

static bool SessionManager::getSettingAutoSaveEnabled (  )  [static]

Returns the current value for this setting.

If this setting does not exist in ConfigurationSettings, a verification error will be logged to the message log and potentially a verification error message box will be displayed to the user.

Please see Settings Macros for more details

Returns:
the current value for this setting.

Definition at line 125 of file SessionManager.h.

static bool SessionManager::hasSettingAutoSaveEnabled (  )  [static]

Returns true if this setting exists and has a value in ConfigurationSettings.

Please see Settings Macros for more details

Returns:
true if this setting exists, false otherwise.

Definition at line 132 of file SessionManager.h.

static void SessionManager::setSettingAutoSaveEnabled ( bool  newValue,
bool  setIfSame = false 
) [static]

Changes the current value of this setting to the new value.

Please see Settings Macros for more details

Parameters:
newValue the new value for this setting.
setIfSame If true, the value will be set into ConfigurationSettings even if the newValue and existing value are the same. This has the side-effect of making the value a per-user setting and stored in the user's configuration file. If false, this value will only be set if the newValue and existing value are different. Therefore the value will only be stored in the user's configuration file if the newValue is unique to the user.

Definition at line 148 of file SessionManager.h.

static std::string SessionManager::getSettingAutoSaveEnabledKey (  )  [static]

Returns the key for this setting that could be passed to ConfigurationSettings::getSetting() or ConfigurationSettings::setSetting().

Please see Settings Macros for more details

Returns:
the key used for this setting.

Definition at line 156 of file SessionManager.h.

static unsigned int SessionManager::getSettingAutoSaveInterval (  )  [static]

Returns the current value for this setting.

If this setting does not exist in ConfigurationSettings, a verification error will be logged to the message log and potentially a verification error message box will be displayed to the user.

Please see Settings Macros for more details

Returns:
the current value for this setting.

Definition at line 167 of file SessionManager.h.

static bool SessionManager::hasSettingAutoSaveInterval (  )  [static]

Returns true if this setting exists and has a value in ConfigurationSettings.

Please see Settings Macros for more details

Returns:
true if this setting exists, false otherwise.

Definition at line 174 of file SessionManager.h.

static void SessionManager::setSettingAutoSaveInterval ( unsigned int  newValue,
bool  setIfSame = false 
) [static]

Changes the current value of this setting to the new value.

Please see Settings Macros for more details

Parameters:
newValue the new value for this setting.
setIfSame If true, the value will be set into ConfigurationSettings even if the newValue and existing value are the same. This has the side-effect of making the value a per-user setting and stored in the user's configuration file. If false, this value will only be set if the newValue and existing value are different. Therefore the value will only be stored in the user's configuration file if the newValue is unique to the user.

Definition at line 190 of file SessionManager.h.

static std::string SessionManager::getSettingAutoSaveIntervalKey (  )  [static]

Returns the key for this setting that could be passed to ConfigurationSettings::getSetting() or ConfigurationSettings::setSetting().

Please see Settings Macros for more details

Returns:
the key used for this setting.

Definition at line 198 of file SessionManager.h.

static const std::string& SessionManager::signalAboutToSaveSession (  )  [static]

Emitted with a null boost::any just prior to saving a session.

Definition at line 203 of file SessionManager.h.

static const std::string& SessionManager::signalAboutToRestore (  )  [static]

Emitted with a null boost::any just prior to restoring a session.

Definition at line 208 of file SessionManager.h.

static const std::string& SessionManager::signalSessionRestored (  )  [static]

Emitted with a null boost::any when the session has finished restoring itself.

Definition at line 213 of file SessionManager.h.

static const std::string& SessionManager::signalSessionSaved (  )  [static]

Emitted after the session save has finished with a boost::any<std::pair<SerializationStatus, std::string>> containing the status of the serialization and the filename of the saved session.

If the status is FAILURE, the filename string will be empty.

Definition at line 220 of file SessionManager.h.

static const std::string& SessionManager::signalClosed (  )  [static]

Emitted when a session is closed.

The session is still fully created when this signal is emitted.

Definition at line 227 of file SessionManager.h.

virtual std::string SessionManager::getName (  )  const [pure virtual]

Gets the name of the current session.

This method returns the unique name given to the session when it was created. This will be in the form of a UUID.

Returns:
The name of the session.

virtual std::pair<SerializationStatus,std::vector<std::pair<SessionItem*, std::string> > > SessionManager::serialize ( const std::string &  filename,
Progress pProgress 
) [pure virtual]

Saves the current session.

This method saves all data, windows, layers, animations and active plug-ins to disk so they can be restored to the same state later.

Parameters:
filename The full pathname of the file the session is to be saved in.
pProgress If not NULL, progress during session save will be reported to the supplied Progress object.
Returns:
A pair of values indicating the success of the save and, if the session was only partially saved, which session items failed to save. The std::string in the std::pair contains a user readable type of the associated SessionItem. This type should only be used for display to the user and logging.

virtual SessionItem* SessionManager::getSessionItem ( const std::string &  id  )  [pure virtual]

Retrieves a SessionItem during session restore based on its id.

This method retrieves a specified session item during restore. It is only guaranteed to work during session restore.

Parameters:
id The session id of the SessionItem to retrieve
Returns:
The pointer to the corresponding SessionItem, if found or NULL otherwise.

virtual bool SessionManager::isSessionSaving (  )  const [pure virtual]

Is the session currently saving?

Returns:
True if session serialization is in progress, false if it is not.

virtual bool SessionManager::isSessionLoading (  )  const [pure virtual]

Is the session currently loading?

Returns:
True if session deserialization is in progress, false if it is not.

virtual bool SessionManager::isSessionSaveLocked (  )  const [pure virtual]

Is session save locked?

If this returns true, calls to serialize() will fail.

Returns:
True if session save is currently locked, false if it is allowed.

virtual void SessionManager::lockSessionSave (  )  [protected, pure virtual]

Prevent the session from saving.

Locking session save will cause calls to serialize() to fail.

See also:
SessionSaveLock to use this feature.

virtual void SessionManager::unlockSessionSave (  )  [protected, pure virtual]

Unlock session saving.

This reverses a previous call to lockSessionSave(). If multiple calls to lockSessionSave() have been made, this unlocks one of those calls.

See also:
SessionSaveLock to use this feature.


Software Development Kit - Opticks 4.9.0 Build 16218