VAPOR3 3.9.4
Classes | Public Member Functions | Static Public Member Functions | List of all members
VAPoR::ParamsMgr Class Reference

A singleton class for managing Params instances. More...

#include <ParamsMgr.h>

Inheritance diagram for VAPoR::ParamsMgr:
Wasp::MyBase

Public Member Functions

 ParamsMgr (std::vector< string > appParamNames=std::vector< string >(), std::vector< string > appRenderParamNames=std::vector< string >())
 
virtual ~ParamsMgr ()
 
virtual void LoadState ()
 
virtual void LoadState (const XmlNode *node)
 
virtual int LoadState (string stateFile)
 
void AddDataMgr (string dataSetName, DataMgr *dataMgr)
 
void RemoveVisualizer (string winName)
 
void RemoveDataMgr (string dataSetName)
 
vector< string > GetDataMgrNames () const
 
ViewpointParamsCreateVisualizerParamsInstance (string winName)
 
void RemoveVisualizerParamsInstance (string winName)
 
RenderParamsCreateRenderParamsInstance (string winName, string dataSetName, string classType, string instName)
 
RenderParamsCreateRenderParamsInstance (string winName, string dataSetName, string instName, const RenderParams *rp)
 
void RemoveRenderParamsInstance (string winName, string dataSetName, string classType, string instName)
 
RenderParamsGetRenderParams (string winName, string dataSetName, string classType, string instName) const
 
void GetRenderParams (string winName, string dataSetName, vector< RenderParams * > &rParams) const
 
void GetRenderParams (string winName, vector< RenderParams * > &rParams) const
 
void GetRenderParams (vector< RenderParams * > &rParams) const
 
void GetRenderParamNames (string winName, string dataSetName, string classType, vector< string > &instNames) const
 
void GetRenderParamNames (string winName, string dataSetName, vector< string > &instNames) const
 
void GetRenderParamNames (string winName, vector< string > &instNames) const
 
void GetRenderParamNames (vector< string > &instNames) const
 
bool RenderParamsLookup (string instName, string &winName, string &dataSetName, string &className) const
 
vector< string > GetVisualizerNames () const
 
vector< string > GetRenderParamsClassNames (string winName) const
 
vector< string > GetRenderParamsClassNames (string winName, string dataSetName) const
 
vector< string > GetRenderParamInstances (string winName, string dataSetName, string classType) const
 
vector< string > GetRenderParamInstances (string winName, string classType) const
 
ViewpointParamsGetViewpointParams (string winName) const
 
RegionParamsGetRegionParams (string winName) const
 
AnnotationParamsGetAnnotationParams (string winName) const
 
DatasetsParamsGetDatasetsParams () const
 
ParamsBaseGetParams (string classType)
 
RenderParamsGetAppRenderParams (string dataSetName, string classType)
 
void GetAppRenderParams (string dataSetName, vector< RenderParams * > &appRenderParams) const
 
int SaveToFile (string path) const
 
void BeginSaveStateGroup (string description)
 
void EndSaveStateGroup ()
 
void IntermediateChange ()
 
void SetSaveStateEnabled (bool enabled)
 
bool GetSaveStateEnabled () const
 
void SetSaveStateUndoEnabled (bool enabled)
 
bool GetSaveStateUndoEnabled () const
 Get whether updating the undo list is enabled.
 
bool Undo ()
 
bool Redo ()
 
void UndoRedoClear ()
 
string GetTopUndoDesc () const
 Return description string for event at top of undo stack.
 
string GetTopRedoDesc () const
 Return description string for event at top of redo stack.
 
size_t UndoSize () const
 
size_t RedoSize () const
 
void RegisterStateChangeFlag (bool *flag)
 
void RegisterStateChangeCB (std::function< void()> callback)
 
void RegisterIntermediateStateChangeCB (std::function< void()> callback)
 
void RebaseStateSave ()
 
const XmlNodeGetXMLRoot () const
 
bool StateChanged ()
 
- Public Member Functions inherited from Wasp::MyBase
 MyBase ()
 
const string & getClassName () const
 

Static Public Member Functions

static vector< string > GetRenderParamsClassNamesAvail ()
 
- Static Public Member Functions inherited from Wasp::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message.
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code.
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code.
 
static int GetErrCode ()
 Retrieve the current error code.
 
static void SetErrMsgCB (ErrMsgCB_T cb)
 
static ErrMsgCB_T GetErrMsgCB ()
 
static void SetErrMsgFilePtr (FILE *fp)
 
static const FILE * SetErrMsgFilePtr ()
 
static void SetDiagMsg (const char *format,...)
 Record a formatted diagnostic message.
 
static const char * GetDiagMsg ()
 
static void SetDiagMsgCB (DiagMsgCB_T cb)
 
static DiagMsgCB_T GetDiagMsgCB ()
 
static void SetDiagMsgFilePtr (FILE *fp)
 
static bool EnableErrMsg (bool enable)
 
static bool GetEnableErrMsg ()
 

Additional Inherited Members

- Public Types inherited from Wasp::MyBase
typedef void(* ErrMsgCB_T) (const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T) (const char *msg)
 
- Static Public Attributes inherited from Wasp::MyBase
static char * ErrMsg
 
static int ErrCode
 
static int ErrMsgSize
 
static FILE * ErrMsgFilePtr
 
static ErrMsgCB_T ErrMsgCB
 
static char * DiagMsg
 
static int DiagMsgSize
 
static FILE * DiagMsgFilePtr
 
static DiagMsgCB_T DiagMsgCB
 
static bool Enabled
 
- Protected Member Functions inherited from Wasp::MyBase
void SetClassName (const string &name)
 

Detailed Description

A singleton class for managing Params instances.

Author
Alan Norton
Version
3.0
Date
February 2016

Definition at line 53 of file ParamsMgr.h.

Constructor & Destructor Documentation

◆ ParamsMgr()

VAPoR::ParamsMgr::ParamsMgr ( std::vector< string >  appParamNames = std::vector< string >(),
std::vector< string >  appRenderParamNames = std::vector< string >() 
)

ParamsMgr constructor

Parameters
[in]appParamsNamesA vector of unique ParamsBase class names previously registered with ParamsRegistrar(). The ParamsMgr will construct these application-defined classes as needed. If any of the class names in appParamsNames were not previously registered via ParamsRegistrar() they will be ignored.
[in]appRenderParamsNamesA vector of unique RenderParams class names previously registered with RenParamsRegistrar(). The ParamsMgr will construct these application-defined render params classes as needed. If any of the class names in appRenderParamsNames were not previously registered via RenParamsRegistrar() they will be ignored.
See also
ParamsRegistrar()

◆ ~ParamsMgr()

virtual VAPoR::ParamsMgr::~ParamsMgr ( )
virtual

Destroy object

Member Function Documentation

◆ AddDataMgr()

void VAPoR::ParamsMgr::AddDataMgr ( string  dataSetName,
DataMgr dataMgr 
)

Add a DataMgr to the ParamsMgr class

This method associates a data set name dataSetName with a DataMgr dataMgr. Methods on this class that take a data set name as an argument can not be invoked until the data set name is bound to a DataMgr instance.

◆ BeginSaveStateGroup()

void VAPoR::ParamsMgr::BeginSaveStateGroup ( string  description)
inline

Begin state save group

Changes in state can be undone (redone) one at a time using Undo() and Redo(), or can be grouped to together into a collection. This method announces the start of such a collection group. The group will be completed when EndSaveStateGroup() is called. When a subsequent call to Undo() or Redo() is made all of the state changes made within the group are undone (redone) at once. Groups may be nested, in which case the outermost group prevails.

Parameters
[in]descriptionA descriptive name for the group
See also
EndSaveStateGroup()

Definition at line 434 of file ParamsMgr.h.

◆ CreateRenderParamsInstance() [1/2]

RenderParams * VAPoR::ParamsMgr::CreateRenderParamsInstance ( string  winName,
string  dataSetName,
string  classType,
string  instName 
)

Create a new rendering params instances

This method will create a new instance of an object derived from the RenderParams class. The object will be created with the RenParamsFactory and its type must have been registered with RenParamsRegistrar. The new RenderParams instance will be associated with the window named by winName.

Parameters
[in]winNameWindow name to associate the new RenderParams object with.
[in]classTypeClass name used to register the derived RenderParams object with.
[in]instNameName to associate with the new object.
Return values
ptrReturns a pointer to the newly created object on success, and NULL on failure. This method will fail if the data set dataSetName was not previously bound with AddDataMgr() exist, or if classType does not refer to a valid RenderParams derived class.
See also
RenParamsRegistrar, RenParamsFactory, AddDataMgr(), GetRenderParams(), AddDataMgr()
RemoveRenderParamsInstance()

◆ CreateRenderParamsInstance() [2/2]

RenderParams * VAPoR::ParamsMgr::CreateRenderParamsInstance ( string  winName,
string  dataSetName,
string  instName,
const RenderParams rp 
)

Create a render params instance from an existing one

Copies the RenderParams instance rp into the hierarchy and associates it with the visualizer winName and gives it the name instName. If a RenderParams instance is already associated with winName and instName the existing RenderParams instance is destroyed.

Parameters
[in]winNameWindow name to associate the new RenderParams object with.
[in]instNameName to associate with the new object.
[in]rpPointer to a valid RenderParams instance to insert
Return values
pointerPointer to the newly created RenderParams instance

◆ CreateVisualizerParamsInstance()

ViewpointParams * VAPoR::ParamsMgr::CreateVisualizerParamsInstance ( string  winName)

Create a new ViewpointParams instances

This method will create a new ViewpointParams instance

Parameters
[in]winNameWindow name to associate the new RenderParams object with.
Return values
ptrReturns a pointer to the newly created object on success, and NULL on failure.
See also
RenParamsRegistrar, RenParamsFactory GetRenderParams()

◆ EndSaveStateGroup()

void VAPoR::ParamsMgr::EndSaveStateGroup ( )
inline

End state save group

See also
BeginSaveStateGroup()

Definition at line 439 of file ParamsMgr.h.

◆ GetAnnotationParams()

AnnotationParams * VAPoR::ParamsMgr::GetAnnotationParams ( string  winName) const
inline

Obtain the AnnotationParams that are applicable in a particular Visualizer window.

Return the AnnotationParams instance associated with the window named by winName in the current session state

Return values
ptrAnnotationParams instance that is applicable.

Definition at line 351 of file ParamsMgr.h.

◆ GetAppRenderParams() [1/2]

RenderParams * VAPoR::ParamsMgr::GetAppRenderParams ( string  dataSetName,
string  classType 
)
inline

Optain any render paramers registered by the application

This method returns params that have been registered on the ParamsMgr via RegisterAppParams() for the data set named by dataSetName;

Parameters
[in]dataSetName
[in]classType
Return values
paramsPointer to requested params on success, or NULL on failure. Fails if classType was not registred with the constructor or RenParamsRegistrar
See also
ParamsMgr()

Definition at line 389 of file ParamsMgr.h.

◆ GetAppRenderParams() [2/2]

void VAPoR::ParamsMgr::GetAppRenderParams ( string  dataSetName,
vector< RenderParams * > &  appRenderParams 
) const

Optain any render paramers registered by the application for a given data set

This method returns params that have been registered on the ParamsMgr via RegisterAppParams() for the data set named by dataSetName;

Parameters
[in]dataSetName
[out]appRenderParamsa vector of application render params associated with dataSetName
See also
ParamsMgr()

◆ GetDataMgrNames()

vector< string > VAPoR::ParamsMgr::GetDataMgrNames ( ) const

Return list of all DataMgr names

Return a list of all DataMgr names bound with AddDataMgr()

◆ GetDatasetsParams()

DatasetsParams * VAPoR::ParamsMgr::GetDatasetsParams ( ) const
inline

Obtain the DatasetsParams that are applicable in a particular Visualizer window.

Return values
ptrDatasetsParams instance that is applicable.

Definition at line 358 of file ParamsMgr.h.

◆ GetParams()

ParamsBase * VAPoR::ParamsMgr::GetParams ( string  classType)
inline

Optain any paramers registered by the application

This method returns params that have been registered on the ParamsMgr via the constructor

Return values
paramsPointer to requested params on success, or NULL on failure. Fails if classType was not registred with the constructor or ParamsRegistrar
See also
ParamsMgr()

Definition at line 371 of file ParamsMgr.h.

Referenced by EventRouter::GetAnimationParams(), EventRouter::GetCurrentTimeStep(), and EventRouter::GetStateParams().

◆ GetRegionParams()

RegionParams * VAPoR::ParamsMgr::GetRegionParams ( string  winName) const
inline

Obtain the RegionParams that are applicable in a particular Visualizer window.

Return the RegionParams instance associated with the window named by winName in the current session state

Return values
ptrRegionParams instance that is applicable.

Definition at line 341 of file ParamsMgr.h.

◆ GetRenderParamInstances() [1/2]

vector< string > VAPoR::ParamsMgr::GetRenderParamInstances ( string  winName,
string  classType 
) const

◆ GetRenderParamInstances() [2/2]

vector< string > VAPoR::ParamsMgr::GetRenderParamInstances ( string  winName,
string  dataSetName,
string  classType 
) const

Returns renderer instance names defined on window winName for renderer type classname

This method returns the instance names of all RenderParams of type classType that are associated with the window winName in the current session state.

See also
CreateRenderParamsInstance()
RenParamsRegistrar, RenParamsFactory

◆ GetRenderParamNames() [1/4]

void VAPoR::ParamsMgr::GetRenderParamNames ( string  winName,
string  dataSetName,
string  classType,
vector< string > &  instNames 
) const

Return all render param instance names

Return all of the RenderParam instance names associated with the visualizer (window) named winName, the data set named dataSetName, and the Params class type classType

The returned names are guaranteed to be unique.

◆ GetRenderParamNames() [2/4]

void VAPoR::ParamsMgr::GetRenderParamNames ( string  winName,
string  dataSetName,
vector< string > &  instNames 
) const

◆ GetRenderParamNames() [3/4]

void VAPoR::ParamsMgr::GetRenderParamNames ( string  winName,
vector< string > &  instNames 
) const

◆ GetRenderParamNames() [4/4]

void VAPoR::ParamsMgr::GetRenderParamNames ( vector< string > &  instNames) const

◆ GetRenderParams() [1/4]

RenderParams * VAPoR::ParamsMgr::GetRenderParams ( string  winName,
string  dataSetName,
string  classType,
string  instName 
) const

Return a previously created RenderParams instance

This method returns from the session state a previously created RenderParams instance. If the identified RenderParams instance does not exist this A NULL is returned, but no error is generated.

\params [in] winName Window name that the RenderParams instance is associated with.

Parameters
[in]classTypeClass name used to register the derived RenderParams object with.
[in]instNameName associated with the object to destroy.
See also
RenParamsRegistrar, RenParamsFactory, AddDataMgr(), GetRenderParams()
CreateRenderParamsInstance()
Return values
ptrIf the identified RenderParams instance exists in the session state it is returned, otherwise NULL is returned. The latter case does not generate an error

◆ GetRenderParams() [2/4]

void VAPoR::ParamsMgr::GetRenderParams ( string  winName,
string  dataSetName,
vector< RenderParams * > &  rParams 
) const

◆ GetRenderParams() [3/4]

void VAPoR::ParamsMgr::GetRenderParams ( string  winName,
vector< RenderParams * > &  rParams 
) const

◆ GetRenderParams() [4/4]

void VAPoR::ParamsMgr::GetRenderParams ( vector< RenderParams * > &  rParams) const

◆ GetRenderParamsClassNames() [1/2]

vector< string > VAPoR::ParamsMgr::GetRenderParamsClassNames ( string  winName) const

Returns renderer types (aka class names) defined for window winName

This method returns a list of all RenderParams types associated with the window winName in the session state

See also
CreateRenderParamsInstance()
RenParamsRegistrar, RenParamsFactory

◆ GetRenderParamsClassNames() [2/2]

vector< string > VAPoR::ParamsMgr::GetRenderParamsClassNames ( string  winName,
string  dataSetName 
) const

Returns renderer types (aka class names) defined for window winName associated with a data set named by dataSetName. This method returns a list of all RenderParams types associated with the window winName in the session state

See also
CreateRenderParamsInstance()
RenParamsRegistrar, RenParamsFactory

◆ GetRenderParamsClassNamesAvail()

static vector< string > VAPoR::ParamsMgr::GetRenderParamsClassNamesAvail ( )
inlinestatic

Returns available renderer types (aka class names)

This method returns a list of all registered RenderParams types (class names)

See also
CreateRenderParamsInstance()
RenParamsRegistrar, RenParamsFactory

Definition at line 307 of file ParamsMgr.h.

◆ GetSaveStateEnabled()

bool VAPoR::ParamsMgr::GetSaveStateEnabled ( ) const
inline

Definition at line 447 of file ParamsMgr.h.

◆ GetSaveStateUndoEnabled()

bool VAPoR::ParamsMgr::GetSaveStateUndoEnabled ( ) const
inline

Get whether updating the undo list is enabled.

Definition at line 456 of file ParamsMgr.h.

◆ GetTopRedoDesc()

string VAPoR::ParamsMgr::GetTopRedoDesc ( ) const

Return description string for event at top of redo stack.

◆ GetTopUndoDesc()

string VAPoR::ParamsMgr::GetTopUndoDesc ( ) const

Return description string for event at top of undo stack.

◆ GetViewpointParams()

ViewpointParams * VAPoR::ParamsMgr::GetViewpointParams ( string  winName) const

Obtain the ViewpointParams that are applicable in a particular Visualizer window.

Return the ViewpointParams instance associated with the window named by winName in the current session state

Return values
ptrViewpointParams instance that is applicable.

◆ GetVisualizerNames()

vector< string > VAPoR::ParamsMgr::GetVisualizerNames ( ) const

Returns all defined window (aka visualizer names).

This method will return all defined window names in the session state

Return values
namesA vector of window names, possibly an empty vector if none exist.
See also
CreateRenderParamsInstance()

◆ GetXMLRoot()

const XmlNode * VAPoR::ParamsMgr::GetXMLRoot ( ) const
inline

Definition at line 516 of file ParamsMgr.h.

◆ IntermediateChange()

void VAPoR::ParamsMgr::IntermediateChange ( )
inline

Call callbacks registered for intermediate changes. These are changes inside of Save State Groups that the rendering should still be updated to show.

Definition at line 443 of file ParamsMgr.h.

◆ LoadState() [1/3]

virtual void VAPoR::ParamsMgr::LoadState ( )
virtual

Load the default state

This method resets the entire parameter state to the default values.

◆ LoadState() [2/3]

virtual void VAPoR::ParamsMgr::LoadState ( const XmlNode node)
virtual

Load the parameter state from an XmlNode tree

This method resets the entire parameter state to the state specified by the XmlNode tree whose root is node. Any unrecognized nodes in node will be ignored.

◆ LoadState() [3/3]

virtual int VAPoR::ParamsMgr::LoadState ( string  stateFile)
virtual

Load the parameter state from a file

This method resets the entire parameter state to the state specified by the file named by stateFile. Any unrecognized nodes in stateFile will be ignored.

◆ RebaseStateSave()

void VAPoR::ParamsMgr::RebaseStateSave ( )
inline

Reinit state saving

Definition at line 514 of file ParamsMgr.h.

◆ Redo()

bool VAPoR::ParamsMgr::Redo ( )

Restore state to state that existed prior to the last Undo()

Return values
statusReturns true on success, false if the state is unchanged
See also
BeginSaveStateGroup()

◆ RedoSize()

size_t VAPoR::ParamsMgr::RedoSize ( ) const
inline

Definition at line 486 of file ParamsMgr.h.

◆ RegisterIntermediateStateChangeCB()

void VAPoR::ParamsMgr::RegisterIntermediateStateChangeCB ( std::function< void()>  callback)
inline

Intermediate changes are changes inside of Save State Groups that the rendering should still be updated to show.

Definition at line 509 of file ParamsMgr.h.

◆ RegisterStateChangeCB()

void VAPoR::ParamsMgr::RegisterStateChangeCB ( std::function< void()>  callback)
inline

Register a state change callback

This method is similar to RegisterStateChangeFlag(). However, instead of setting a boolean flag, the function specified by callback will be invoked on state changes

Definition at line 505 of file ParamsMgr.h.

◆ RegisterStateChangeFlag()

void VAPoR::ParamsMgr::RegisterStateChangeFlag ( bool *  flag)
inline

Register a boolean flag to capture state changes

This method registers the address of boolean flag whose value will be set whenever the parameter state changes. It is the user's responsbility to clear (set to false) the flag. Note, for changes grouped tegoer with BeginSaveStateGroup() the flag will not be set until after EndSaveStateGroup() is called, and in the case of nested groups, not until the last EndSaveStateGroup() invocation.

Definition at line 497 of file ParamsMgr.h.

◆ RemoveDataMgr()

void VAPoR::ParamsMgr::RemoveDataMgr ( string  dataSetName)

Remove a DataMgr instance previously.

This method removes the association of a DataMgr instance with the data set name dataSetName, previously made by AddDataMgr()

◆ RemoveRenderParamsInstance()

void VAPoR::ParamsMgr::RemoveRenderParamsInstance ( string  winName,
string  dataSetName,
string  classType,
string  instName 
)

Remove a previously created RenderParams instance

This method removes from the session state a previously created RenderParams instance. If the identified RenderParams instance does not exist this method is a no-op.

\params [in] winName Window name that the RenderParams instance is associated with.

Parameters
[in]classTypeClass name used to register the derived RenderParams object with.
[in]instNameName associated with the object to destroy.
See also
RenParamsRegistrar, RenParamsFactory GetRenderParams()
CreateRenderParamsInstance()

◆ RemoveVisualizer()

void VAPoR::ParamsMgr::RemoveVisualizer ( string  winName)

Remove a previously created Window instance

Parameters
[in]winNameWindow name to remove

◆ RemoveVisualizerParamsInstance()

void VAPoR::ParamsMgr::RemoveVisualizerParamsInstance ( string  winName)

Remove a previously created ViewpointParams instance

Parameters
[in]winNameWindow name to remove

◆ RenderParamsLookup()

bool VAPoR::ParamsMgr::RenderParamsLookup ( string  instName,
string &  winName,
string &  dataSetName,
string &  className 
) const

Lookup window, data set, and class name from a render instance name

This method returns the window name winName, data set name dataSetName, and render params type className that are associated with the render instance name instName.

Return values
statusTrue on success, false if instName is not a previously defined render instance name
See also
CreateRenderParamsInstance

◆ SaveToFile()

int VAPoR::ParamsMgr::SaveToFile ( string  path) const

Save current state to a file

Save the current state of the parameter database to an XML file

Parameters
[in]pathPath to file

◆ SetSaveStateEnabled()

void VAPoR::ParamsMgr::SetSaveStateEnabled ( bool  enabled)
inline

Definition at line 445 of file ParamsMgr.h.

◆ SetSaveStateUndoEnabled()

void VAPoR::ParamsMgr::SetSaveStateUndoEnabled ( bool  enabled)
inline

Enable/Disable adding params changes to the undo list. When enabled, behaves as normal. When disabled, params are saved as normal, however the undo list is not updated. An example use case is to store a computed value in the params database.

Definition at line 453 of file ParamsMgr.h.

◆ StateChanged()

bool VAPoR::ParamsMgr::StateChanged ( )
inline

Return true if any state changes made since last call

This method returns a boolean indicating whether any changes have been made to the parameter state since the last time the method was called. The first time StateChanged() is called it will return true;

Definition at line 525 of file ParamsMgr.h.

◆ Undo()

bool VAPoR::ParamsMgr::Undo ( )

Restore state to previously saved state

Return values
statusReturns true on success, false if the state is unchanged
See also
BeginSaveStateGroup()

◆ UndoRedoClear()

void VAPoR::ParamsMgr::UndoRedoClear ( )

◆ UndoSize()

size_t VAPoR::ParamsMgr::UndoSize ( ) const
inline

Return number states saved that can be undone with Undo()

Definition at line 484 of file ParamsMgr.h.


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