VAPoR  0.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
VAPoR::ParamsBase Class Reference

Nodes with state in Xml tree representation. More...

#include <ParamsBase.h>

Inheritance diagram for VAPoR::ParamsBase:
VAPoR::ParsedXml VAPoR::Box VAPoR::MapperFunctionBase VAPoR::Params VAPoR::MapperFunction VAPoR::AnimationParams VAPoR::RegionParams VAPoR::RenderParams VAPoR::ViewpointParams VAPoR::IsoControl VAPoR::TransferFunction

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 ()
 
virtual ParamsBasedeepCopy (ParamNode *newRoot=0)
 
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)
 
ParamNodeGetRootNode ()
 
virtual ParamNodebuildNode ()
 
void SetFlagDirty (const string &flag)
 
const string & GetName ()
 
ParamsBaseType GetParamsBaseTypeId ()
 
virtual void SetRootParamNode (ParamNode *pn)
 
- Public Member Functions inherited from VAPoR::ParsedXml
virtual ~ParsedXml ()
 
virtual bool elementStartHandler (ExpatParseMgr *, int, std::string &, const char **)=0
 
virtual bool elementEndHandler (ExpatParseMgr *, int, std::string &)=0
 
virtual bool charHandler (ExpatParseMgr *, const XML_Char *, int)
 

Static Public Member Functions

static ParamsBaseType GetTypeFromTag (const string &tag)
 
static const string & GetTagFromType (ParamsBaseType t)
 
static ParamsBaseCreateDefaultParamsBase (int pType)
 
static ParamsBaseCreateDefaultParamsBase (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 bool IsParamsTag (const string &tag)
 

Protected Member Functions

virtual ParamNodegetCurrentParamNode ()
 
virtual void setCurrentParamNode (ParamNode *pn)
 
ParamNodeGetCurrentNode ()
 
ParamNodePush (string &tag, ParamsBase *pBase=0)
 
ParamNodePop ()
 
void Remove (const string &name)
 
const map< string, string > & GetAttributes ()
 
void Clear ()
 

Protected Attributes

string _paramsBaseName
 
int _parseDepth
 

Static Protected Attributes

static vector< ParamsBase * > dummyParamsBaseInstances
 
static const string _emptyString
 
static map< string, int > classIdFromTagMap
 
static map< int, string > tagFromClassIdMap
 
static map< int, BaseCreateFcn > createDefaultFcnMap
 
static int numParamsClasses
 
static int numEmbedClasses
 
- Static Protected Attributes inherited from VAPoR::ParsedXml
static const string _stringType
 
static const string _longType
 
static const string _doubleType
 
static const string _typeAttr
 

Additional Inherited Members

- Public Attributes inherited from VAPoR::ParsedXml
ParsedXmlpreviousClass
 

Detailed Description

Nodes with state in Xml tree representation.

Author
John Clyne
Version
$Revision$
Date
$Date$

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.

Users can extend ParamsBase classes to include arbitrary child (sub) nodes, by support parsing of such nodes.

Definition at line 57 of file ParamsBase.h.

Member Typedef Documentation

Definition at line 66 of file ParamsBase.h.

Constructor & Destructor Documentation

VAPoR::ParamsBase::ParamsBase ( XmlNode parent,
const string &  name 
)
VAPoR::ParamsBase::ParamsBase ( const string &  name)
inline

Default constructor.

Definition at line 68 of file ParamsBase.h.

VAPoR::ParamsBase::ParamsBase ( const ParamsBase pbase)

Copy constructor.

virtual VAPoR::ParamsBase::~ParamsBase ( )
virtual

Member Function Documentation

virtual ParamNode* VAPoR::ParamsBase::buildNode ( )
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

Return values
nodeParamNode representing the current ParamsBase instance

Reimplemented in VAPoR::MapperFunctionBase, VAPoR::IsoControl, and VAPoR::TransferFunction.

void VAPoR::ParamsBase::Clear ( )
protected

Remove (undefine) all parameters

This method deletes any and all paramters contained in the base class as well as deleting any tree branches.

static ParamsBase* VAPoR::ParamsBase::CreateDefaultParamsBase ( int  pType)
inlinestatic

Static method for constructing a default instance of a ParamsBase class based on the typeId.

Parameters
[in]pTypeTypeId of the ParamsBase instance to be created.
Return values
instancenewly created ParamsBase instance

Definition at line 184 of file ParamsBase.h.

static ParamsBase* VAPoR::ParamsBase::CreateDefaultParamsBase ( const string &  tag)
static

Static method for constructing a default instance of a ParamsBase class based on the Tag.

Parameters
[in]tagXML tag of the ParamsBase instance to be created.
Return values
instancenewly created ParamsBase instance
virtual ParamsBase* VAPoR::ParamsBase::deepCopy ( ParamNode newRoot = 0)
virtual

Make a copy of a ParamBase that optionally uses specified clone of the ParamNode as its root node. If the root is null, the copy ignores any ParamNodes. The default implementation is sufficient for ParamsBase classes that are built from a ParamNode hierarchy.

Parameters
[in]newRootRoot of cloned ParamsBase instance
Return values
instancePointer to cloned instance

Reimplemented in VAPoR::Params, VAPoR::TransferFunction, VAPoR::IsoControl, and VAPoR::MapperFunction.

virtual bool VAPoR::ParamsBase::elementEndHandler ( ExpatParseMgr pm,
int  depth,
string &  tag 
)
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

See also
elementStartHandler
Return values
statusFalse indicates parse error
virtual bool VAPoR::ParamsBase::elementStartHandler ( ExpatParseMgr pm,
int  depth,
string &  tag,
const char **  attribs 
)
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

See also
elementEndHandler
Return values
statusFalse indicates parse error
const map<string, string>& VAPoR::ParamsBase::GetAttributes ( )
protected

Return the attributes associated with the current branch

Return values
mapattribute mapping
ParamNode* VAPoR::ParamsBase::GetCurrentNode ( )
inlineprotected

Return the current node in the parameter node tree

This method returns the current node in the parameter node tree.

See also
Push(), Pop()
Return values
nodeCurrent ParamNode

Definition at line 274 of file ParamsBase.h.

virtual ParamNode* VAPoR::ParamsBase::getCurrentParamNode ( )
inlineprotectedvirtual

Definition at line 250 of file ParamsBase.h.

const string& VAPoR::ParamsBase::GetName ( )
inline

Method for obtaining the name and/or tag associated with the instance

Definition at line 158 of file ParamsBase.h.

static int VAPoR::ParamsBase::GetNumParamsClasses ( )
inlinestatic

Static method to determine how many Params classes are registered

Return values
countNumber of registered Params classes

Definition at line 227 of file ParamsBase.h.

ParamsBaseType VAPoR::ParamsBase::GetParamsBaseTypeId ( )
inline

Method for obtaining the type Id associated with a ParamsBase instance

Return values
intParamsBase TypeID for ParamsBase instance

Definition at line 164 of file ParamsBase.h.

ParamNode* VAPoR::ParamsBase::GetRootNode ( )
inline

Return the top (root) of the parameter node tree

This method returns the top node in the parameter node tree

Definition at line 138 of file ParamsBase.h.

static const string& VAPoR::ParamsBase::GetTagFromType ( ParamsBaseType  t)
static

Static method for converting a ParamsBase typeID to a Tag

Return values
stringTag (Name) associated with ParamsBase TypeID
static ParamsBaseType VAPoR::ParamsBase::GetTypeFromTag ( const string &  tag)
static

Static method for converting a Tag to a ParamsBase typeID

Return values
intParamsBase TypeID for Tag

Referenced by VAPoR::VizWinMgr::getApplicableParams(), and VAPoR::VizWinMgr::getEventRouter().

static bool VAPoR::ParamsBase::IsParamsTag ( const string &  tag)
inlinestatic

Static method to determine if a ParamsBase class is a Params class

Parameters
[in]tagXML tag associated with ParamsBase class
Return values
statusTrue if the specified class is a Params class

Definition at line 233 of file ParamsBase.h.

ParamNode* VAPoR::ParamsBase::Pop ( )
protected

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.

Return values
nodeReturns the new current node
See also
Pop(), Delete()
ParamNode* VAPoR::ParamsBase::Push ( string &  tag,
ParamsBase pBase = 0 
)
protected

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

Parameters
[in]tagThe name of the branch
[in]pBaseoptional ParamsBase object to be associated with ParamNode
Return values
nodeReturns the new current node
See also
Pop(), Delete(), GetCurrentNode()
static int VAPoR::ParamsBase::RegisterParamsBaseClass ( const string &  tag,
BaseCreateFcn  fcn,
bool  isParams 
)
static

Static method for registering a ParamsBase class. This calls CreateDefaultInstance on the class.

Parameters
[in]tagTag of class to be registered
[in]fcnMethod that creates default instance of ParamsBase class
[in]isParamsset true if the ParamsBase class is derived from Params
Return values
classIDReturns the ParamsBaseClassId, or 0 on failure
void VAPoR::ParamsBase::Remove ( const string &  name)
protected

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.

Parameters
[in]nameThe name of the branch
static int VAPoR::ParamsBase::ReregisterParamsBaseClass ( const string &  tag,
const string &  newtag,
bool  isParams 
)
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.

Parameters
[in]tagTag of class to be registered
[in]newtagPreviously registered tag (new name of class)
[in]isParamsset true if the ParamsBase class is derived from Params
Return values
classIDReturns the ParamsBaseClassId, or 0 on failure
virtual void VAPoR::ParamsBase::setCurrentParamNode ( ParamNode pn)
inlineprotectedvirtual

Definition at line 252 of file ParamsBase.h.

void VAPoR::ParamsBase::SetFlagDirty ( const string &  flag)

Method for manual setting of node flags

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.

Parameters
[in]parentParent XmlNode.
virtual void VAPoR::ParamsBase::SetRootParamNode ( ParamNode pn)
inlinevirtual

Specify the Root ParamNode of a ParamsBase instance

Parameters
[in]pnParamNode of new root

Definition at line 222 of file ParamsBase.h.

Referenced by VAPoR::MapperFunction::deepCopy(), VAPoR::IsoControl::deepCopy(), and VAPoR::TransferFunction::deepCopy().

Member Data Documentation

const string VAPoR::ParamsBase::_emptyString
staticprotected

Definition at line 249 of file ParamsBase.h.

string VAPoR::ParamsBase::_paramsBaseName
protected

Definition at line 260 of file ParamsBase.h.

int VAPoR::ParamsBase::_parseDepth
protected

Definition at line 261 of file ParamsBase.h.

map<string,int> VAPoR::ParamsBase::classIdFromTagMap
staticprotected

Definition at line 256 of file ParamsBase.h.

map<int,BaseCreateFcn> VAPoR::ParamsBase::createDefaultFcnMap
staticprotected

Definition at line 258 of file ParamsBase.h.

vector<ParamsBase*> VAPoR::ParamsBase::dummyParamsBaseInstances
staticprotected

Definition at line 248 of file ParamsBase.h.

int VAPoR::ParamsBase::numEmbedClasses
staticprotected

Definition at line 263 of file ParamsBase.h.

int VAPoR::ParamsBase::numParamsClasses
staticprotected

Definition at line 262 of file ParamsBase.h.

map<int,string> VAPoR::ParamsBase::tagFromClassIdMap
staticprotected

Definition at line 257 of file ParamsBase.h.


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