VAPoR
3.0.0
|
Nodes with state in Xml tree representation. More...
#include <ParamsBase.h>
Public Types | |
typedef int | ParamsBaseType |
Public Member Functions | |
ParamsBase (XmlNode *parent, const string &name) | |
ParamsBase (const string &name) | |
Default constructor. More... | |
ParamsBase (const ParamsBase &pbase) | |
Copy constructor. More... | |
virtual | ~ParamsBase () |
destructor..destroys the xml tree based at the root node. More... | |
ParamNode * | GetRootNode () const |
const string | GetName () const |
virtual long | GetValueLong (const string &tag, const vector< long > &defaultVal=_emptyLongVec) |
virtual double | GetValueDouble (const string &tag, const vector< double > &defaultVal=_emptyDoubleVec) |
virtual const string | GetValueString (const string &tag, const string &defaultVal=_emptyString) |
virtual const vector< long > | GetValueLongVec (const string &tag, const vector< long > &defaultVal=_emptyLongVec) |
virtual const vector< double > | GetValueDoubleVec (const string &tag, const vector< double > &defaultVal=_emptyDoubleVec) |
virtual void | GetValueStringVec (const string &tag, vector< string > &vec, const vector< string > &defaultVal=_emptyStringVec) |
virtual int | SetValueLong (string tag, const char *description, long value, Params *p) |
virtual int | SetValueLong (string tag, const char *description, const vector< long > &value, Params *p) |
virtual int | SetValueDouble (string tag, const char *description, double value, Params *p) |
virtual int | SetValueDouble (string tag, const char *description, const vector< double > &value, Params *p) |
virtual int | SetValueString (string tag, const char *description, const string &value, Params *p) |
virtual int | SetValueStringVec (string tag, const char *description, const vector< string > &value, Params *p) |
ParamsBaseType | GetParamsBaseTypeId () |
virtual void | SetRootParamNode (ParamNode *pn) |
ParamsBase * | GetParamsBase (const vector< string > &path) const |
int | SetParamsBase (const vector< string > &path, ParamsBase *pbase) |
int | RemoveParamsBase (const vector< string > &path, ParamsBase *pbase) |
Internal | |
Internal methods not intended for general use | |
void | SetParent (XmlNode *parent) |
virtual bool | elementStartHandler (ExpatParseMgr *pm, int depth, string &tag, const char **attribs) |
virtual bool | elementEndHandler (ExpatParseMgr *pm, int depth, string &tag) |
virtual ParamNode * | buildNode () |
ParamNode * | GetCurrentNode () |
ParamNode * | Push (string &tag, ParamsBase *pBase=0) |
ParamNode * | Pop () |
void | Remove (const string &name) |
const map< string, string > & | GetAttributes () |
void | Clear () |
Static Public Member Functions | |
static ParamsBaseType | GetTypeFromTag (const string &tag) |
static const string | GetTagFromType (ParamsBaseType t) |
static ParamsBase * | CreateDefaultParamsBase (int pType) |
static ParamsBase * | CreateDefaultParamsBase (const string &tag) |
static int | RegisterParamsBaseClass (const string &tag, BaseCreateFcn fcn, bool isParams) |
static int | ReregisterParamsBaseClass (const string &tag, const string &newtag, bool isParams) |
static int | GetNumParamsClasses () |
static int | GetNumBasicParamsClasses () |
static bool | IsParamsTag (const string &tag) |
Nodes with state in Xml tree representation.
This is abstract parent of Params and related classes with state kept in an xml node. Used with the ParamNode class to support user-defined Params classes as well as other classes such as the TransferFunction class.
Definition at line 90 of file ParamsBase.h.
typedef int VAPoR::ParamsBase::ParamsBaseType |
Definition at line 99 of file ParamsBase.h.
VAPoR::ParamsBase::ParamsBase | ( | XmlNode * | parent, |
const string & | name | ||
) |
|
inline |
Default constructor.
Definition at line 101 of file ParamsBase.h.
VAPoR::ParamsBase::ParamsBase | ( | const ParamsBase & | pbase | ) |
Copy constructor.
|
virtual |
destructor..destroys the xml tree based at the root node.
|
virtual |
Method to build an xml node from state. This only needs to be implemented if the state of the ParamsBase is not specified by the root ParamNode
node | ParamNode representing the current ParamsBase instance |
void VAPoR::ParamsBase::Clear | ( | ) |
Remove (undefine) all parameters
This method deletes any and all paramters contained in the base class as well as deleting any tree branches.
|
inlinestatic |
Static method for constructing a default instance of a ParamsBase class based on the typeId.
[in] | pType | TypeId of the ParamsBase instance to be created. |
instance | newly created ParamsBase instance |
Definition at line 352 of file ParamsBase.h.
|
static |
Static method for constructing a default instance of a ParamsBase class based on the Tag.
[in] | tag | XML tag of the ParamsBase instance to be created. |
instance | newly created ParamsBase instance |
|
virtual |
Xml end tag parsing method
This method is called to handle parsing of an XML file. The contents of the file will replace any current parameter settings. The method is virtual so that derived classes may receive notification when an object instance has finished reseting state from an XML file. Override the default method if the class is not based on a hierarchy of ParamNode objects representing the XML representation of the class
status | False indicates parse error |
|
virtual |
Xml start tag parsing method
This method is called to handle parsing of an XML file. The contents of the file will replace any current parameter settings. The method is virtual so that derived classes may receive notification when an object instance is reseting state from an XML file
Override this method if you are not using the ParamNode API to specify the state in terms of the xml representation of the class
status | False indicates parse error |
const map<string, string>& VAPoR::ParamsBase::GetAttributes | ( | ) |
Return the attributes associated with the current branch
map | attribute mapping |
|
inline |
Return the current node in the parameter node tree
This method returns the current node in the parameter node tree.
node | Current ParamNode |
Definition at line 504 of file ParamsBase.h.
|
inline |
Method for obtaining the name and/or tag associated with the instance
Definition at line 184 of file ParamsBase.h.
Referenced by VAPoR::Command::CaptureEnd().
|
inlinestatic |
Static method to determine how many of the Basic Params classes are registered, ie. the number of Global params that are not associated with a tab.
count | Number of UndoRedo Params classes |
Definition at line 401 of file ParamsBase.h.
|
inlinestatic |
Static method to determine how many Params classes are registered
count | Number of registered Params classes |
Definition at line 395 of file ParamsBase.h.
ParamsBase* VAPoR::ParamsBase::GetParamsBase | ( | const vector< string > & | path | ) | const |
Obtain the ParamsBase instance at specified path from this root node.
[in] | vector<string> | sequence of tags to specified ParamsBase, starting at the root node of the ParamsBase (or Params) containing the requested ParamsBase instance. |
ParamsBase* | instance at specified path, or NULL if does not exist. |
|
inline |
Method for obtaining the type Id associated with a ParamsBase instance
int | ParamsBase TypeID for ParamsBase instance |
Definition at line 332 of file ParamsBase.h.
|
inline |
Return the top (root) of the parameter node tree
This method returns the top node in the parameter node tree
Definition at line 177 of file ParamsBase.h.
Referenced by VAPoR::Command::CaptureEnd().
|
static |
Static method for converting a ParamsBase typeID to a Tag
string | Tag (Name) associated with ParamsBase TypeID |
|
static |
Static method for converting a Tag to a ParamsBase typeID
int | ParamsBase TypeID for Tag |
|
inlinevirtual |
Obtain a single value of type double associated with a tag. Optionally specify a vector of doubles whose first element is the default value if the value has not been assigned.
[in] | tag | XML tag associated with the desired long parameter |
[in] | defaultVal | (optional) const vector<double> to be assigned if specified element does not exist. |
long | value associated with the named parameter |
Definition at line 205 of file ParamsBase.h.
|
inlinevirtual |
Obtain a vector of values of type double associated with a tag. Optionally specify a vector of doubles which is the default value if the value has not been assigned.
[in] | tag | XML tag associated with the desired double parameter |
[in] | defaultVal | (optional) const vector<double>& to be assigned if specified element does not exist. |
const | vector<double> value associated with the named parameter |
Definition at line 235 of file ParamsBase.h.
|
inlinevirtual |
Obtain a single value of type long associated with a tag. Optionally specify a vector of longs whose first element is the default value if the value has not been assigned.
[in] | tag | XML tag associated with the desired long parameter |
[in] | defaultVal | (optional) const vector<long> to be assigned if specified element does not exist. |
long | value associated with the named parameter |
Definition at line 193 of file ParamsBase.h.
|
inlinevirtual |
Obtain a vector of values of type long associated with a tag. Optionally specify a vector of longs as the default value if the value has not been assigned.
[in] | tag | XML tag associated with the desired long parameter |
[in] | defaultVal | (optional) const vector<long> to be assigned if specified element does not exist. |
const | vector<long>& value associated with the named parameter |
Definition at line 225 of file ParamsBase.h.
|
inlinevirtual |
Obtain a single value of type std::string associated with a tag. Optionally specify a string which will be the default value if the value has not been assigned.
[in] | tag | XML tag associated with the desired string parameter |
[in] | defaultVal | (optional) const string to be assigned if specified element does not exist. |
const | string value associated with the named parameter |
Definition at line 215 of file ParamsBase.h.
|
inlinevirtual |
Obtain a vector of values of type string associated with a tag. Optionally specify a vector of string which is the default value if the value has not been assigned.
[in] | tag | XML tag associated with the desired double parameter |
[out] | vector<string>& | vec string vector to which the strings will be assigned. |
[in] | defaultVal | (optional) const vector<double>& to be assigned if specified element does not exist. |
Definition at line 245 of file ParamsBase.h.
|
inlinestatic |
Static method to determine if a ParamsBase class is a Params class
[in] | tag | XML tag associated with ParamsBase class |
status | True if the specified class is a Params class |
Definition at line 407 of file ParamsBase.h.
ParamNode* VAPoR::ParamsBase::Pop | ( | ) |
Move up one level in the paramter tree
This method move back up the tree hierarchy by one level. Moving up past the root of the tree is prohibited and will silenty fail with no ill effects.
node | Returns the new current node |
ParamNode* VAPoR::ParamsBase::Push | ( | string & | tag, |
ParamsBase * | pBase = 0 |
||
) |
Move down a level in the parameter tree
The underlying storage model for parameter data is a hierarchical tree. By default the hierarchy is flat. This method can be used to add and navigate branches of the tree. Invoking this method makes the branch named by name
the current branch (node). If the branch name
does not exist it will be created with the name provided. Subsequent set and get methods will operate relative to the current branch. User-specific subtrees can be provided by extending this method
[in] | tag | The name of the branch |
[in] | pBase | optional ParamsBase object to be associated with ParamNode |
node | Returns the new current node |
|
static |
Static method for registering a ParamsBase class. This calls CreateDefaultInstance on the class.
[in] | tag | Tag of class to be registered |
[in] | fcn | Method that creates default instance of ParamsBase class |
[in] | isParams | set true if the ParamsBase class is derived from Params |
classID | Returns the ParamsBaseClassId, or 0 on failure |
void VAPoR::ParamsBase::Remove | ( | const string & | name | ) |
Delete the named branch.
This method deletes the named child, and all decendents, of the current destroying it's contents in the process. The named node must be a child of the current node. If the named node does not exist the result is a no-op.
[in] | name | The name of the branch |
int VAPoR::ParamsBase::RemoveParamsBase | ( | const vector< string > & | path, |
ParamsBase * | pbase | ||
) |
Following method is to be used to remove a ParamsBase instance that is inside a Params (or ParamsBase) instance, The path from the root node as well as the ParamsBase instance must be specified. This will remove (and delete) the existing ParamsBase instance at specified path.
[in] | vector<string> | sequence of tags to specified ParamsBase, starting at the root node of the ParamsBase (or Params) containing the requested ParamsBase instance. |
[in] | ParamsBase* | pbase class instance to be set |
0 | if successful, -1 otherwise |
|
static |
Static method for registering a tag for an already registered ParamsBaseClass. This is needed for backwards compatibility when a tag is changed. The class must first be registered with the new tag.
[in] | tag | Tag of class to be registered |
[in] | newtag | Previously registered tag (new name of class) |
[in] | isParams | set true if the ParamsBase class is derived from Params |
classID | Returns the ParamsBaseClassId, or 0 on failure |
int VAPoR::ParamsBase::SetParamsBase | ( | const vector< string > & | path, |
ParamsBase * | pbase | ||
) |
Following method is to be used to specify a ParamsBase instance that will be inside a Params (or ParamsBase) instance, or to replace an existing ParamsBase instance. This is for example useful for inserting and/or replacing a Box or a Viewpoint in a Params instance. The path from the root node as well as the ParamsBase instance must be specified. This will replace (and delete) any existing ParamsBase instance at specified path. If there is no pre-existing node at the specified path, a new child is added as the last child of its parent. Constructs path to specified ParamsBase if it does not already exist.
[in] | vector<string> | sequence of tags to specified ParamsBase, starting at the root node of the ParamsBase (or Params) containing the requested ParamsBase instance. |
[in] | ParamsBase* | pbase class instance to be set |
0 | if successful, -1 otherwise |
void VAPoR::ParamsBase::SetParent | ( | XmlNode * | parent | ) |
Set the parent node of the XmlNode tree.
Sets a new parent node for the XmlNode tree parameter data base. The parent node, parent
, must have been previously initialized by passing it as an argument to the class constructor ParamBase(). This method permits wholesale changing of the entire parameter database.
[in] | parent | Parent XmlNode. |
|
inlinevirtual |
Specify the Root ParamNode of a ParamsBase instance
[in] | pn | ParamNode of new root |
Definition at line 390 of file ParamsBase.h.
|
virtual |
Method for setting a single double value associated with a tag. This will capture the state of the Params argument before the value is set, then set the values, then Validate(), and finally capture the state of the Params after the Validate() Returns 0 if successful, -1 if the value cannot be set
[in] | string | tag |
[in] | char* | description |
[in] | double | value |
[in] | Params* | instance that contains the change; usually p is the invoker of this method |
int | zero if successful -1 if not |
|
virtual |
Method for making a Set of double values associated with a tag. This will capture the state of the Params argument before the value is set, then set the values, then Validate(), and finally capture the state of the Params after the Validate() Returns 0 if successful, -1 if the value cannot be set
[in] | string | tag |
[in] | char* | description |
[in] | vector<double> | value |
[in] | Params* | instance that contains the change; usually p is the invoker of this method |
int | zero if successful, -1 if not |
|
virtual |
Method for setting a single long value associated with a tag. This will capture the state of the Params argument before the value is set, then set the values, then Validate(), and captures the state of the Params after the Validate() in the Undo/Redo queue Returns 0 if successful, -1 if the value cannot be set
[in] | string | tag |
[char*] | description | |
[in] | long | value |
[in] | Params* | instance that contains the change; usually p = (Params*)this. |
int | zero if successful, -1 if not |
|
virtual |
Method for setting long values associated with a tag. This will capture the state of the Params argument before the value is set, then set the values, then Validate(), and finally capture the state of the Params after the Validate() Returns 0 if successful, -1 if the value cannot be set
[in] | string | tag |
[in] | char* | description |
[in] | vector<long> | value |
[in] | Params* | instance that contains the change; usually p = (Params*)this. |
int | zero if successful, -1 if not |
|
virtual |
Method for making a Set of a single string value associated with a tag. This will capture the state of the Params argument before the value is set, then set the value, then Validate(), and finally capture the state of the Params after the Validate() Returns 0 if successful, -1 if the value cannot be set
[in] | string | tag |
[in] | char* | description |
[in] | string | value |
[in] | Params* | instance that contains the change; usually p is the invoker |
int | zero if successful, -1 if not |
|
virtual |
Method for making a Set of string values associated with a tag. This will capture the state of the Params argument before the value is set, then set the values, then Validate(), and finally capture the state of the Params after the Validate() Returns 0 if successful, -1 if the value cannot be set
[in] | string | tag |
[in] | char* | description |
[in] | vector<string> | value |
[in] | Params* | instance that contains the change; usually p is the invoker |
int | zero if successful, -1 if not |