The parameter container class This is the base class of all classes handle parameter. More...
#include <Parameter.h>
Public Member Functions | |
const char * | GetGroupName (void) const |
returns the name | |
void | NotifyAll () |
Notifies all observers for all entries except of sub-groups. | |
copy and insertation | |
void | copyTo (Base::Reference< ParameterGrp >) |
make a deep copy to the other group | |
void | exportTo (const char *FileName) |
export this group to a file | |
void | importFrom (const char *FileName) |
import from a file to this group | |
void | insert (const char *FileName) |
insert from a file to this group, overwrite only the similar | |
void | insertTo (Base::Reference< ParameterGrp >) |
overwrite everithing similar, leaf the others allone | |
methods for String handling | |
std::string | GetASCII (const char *Name, const char *pPreset=NULL) const |
read a string values | |
std::vector< std::pair < std::string, std::string > > | GetASCIIMap (const char *sFilter=NULL) const |
Same as GetASCIIs() but with key,value map. | |
std::vector< std::string > | GetASCIIs (const char *sFilter=NULL) const |
Return all string elements in this group as a vector of strings Its also possible to set a filter criteria. | |
void | RemoveASCII (const char *Name) |
remove a string value from this group | |
void | SetASCII (const char *Name, const char *sValue) |
set a string value | |
methods for Blob handling (not implemented yet) | |
void | GetBlob (const char *Name, void *pBuf, long lMaxLength, void *pPreset=NULL) const |
read blob values or give default | |
void | RemoveBlob (const char *Name) |
remove a blob value from this group | |
void | SetBlob (const char *Name, void *pValue, long lLength) |
set a blob value | |
methods for bool handling | |
bool | GetBool (const char *Name, bool bPreset=false) const |
read bool values or give default | |
std::vector< std::pair < std::string, bool > > | GetBoolMap (const char *sFilter=NULL) const |
get a map with all bool values and the keys of this group | |
std::vector< bool > | GetBools (const char *sFilter=NULL) const |
get a vector of all bool values in this group | |
void | RemoveBool (const char *Name) |
remove a bool value from this group | |
void | SetBool (const char *Name, bool bValue) |
set a bool value | |
methods for Float handling | |
double | GetFloat (const char *Name, double dPreset=0.0) const |
set a float value | |
std::vector< std::pair < std::string, double > > | GetFloatMap (const char *sFilter=NULL) const |
get a map with all float values and the keys of this group | |
std::vector< double > | GetFloats (const char *sFilter=NULL) const |
get a vector of all float values in this group | |
void | RemoveFloat (const char *Name) |
remove a float value from this group | |
void | SetFloat (const char *Name, double dValue) |
read float values or give default | |
methods for Int handling | |
long | GetInt (const char *Name, long lPreset=0) const |
read bool values or give default | |
std::vector< std::pair < std::string, long > > | GetIntMap (const char *sFilter=NULL) const |
get a map with all int values and the keys of this group | |
std::vector< long > | GetInts (const char *sFilter=NULL) const |
get a vector of all int values in this group | |
void | RemoveInt (const char *Name) |
remove a int value from this group | |
void | SetInt (const char *Name, long lValue) |
set a int value | |
methods for Unsigned Int handling | |
unsigned long | GetUnsigned (const char *Name, unsigned long lPreset=0) const |
read uint values or give default | |
std::vector< std::pair < std::string, unsigned long > > | GetUnsignedMap (const char *sFilter=NULL) const |
get a map with all uint values and the keys of this group | |
std::vector< unsigned long > | GetUnsigneds (const char *sFilter=NULL) const |
get a vector of all uint values in this group | |
void | RemoveUnsigned (const char *Name) |
remove a uint value from this group | |
void | SetUnsigned (const char *Name, unsigned long lValue) |
set a uint value | |
Static Public Member Functions | |
static void | Init (void) |
Protected Member Functions | |
Base::Reference< ParameterGrp > | _GetGroup (const char *Name) |
helper function for GetGroup | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | FindElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char *Type, const char *Name=0L) const |
Find an element specified by Type and Name Search in the parent element Start for the first occourrence of an element of Type and with the attribute Name=Name. | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | FindNextElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *Prev, const char *Type) const |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | FindOrCreateElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char *Type, const char *Name) const |
Find an element specified by Type and Name or create it if not found Search in the parent element Start for the first occourrence of an element of Type and with the attribute Name=Name. | |
ParameterGrp (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *GroupNode=0L, const char *sName=0L) | |
constructor is protected (handle concept) | |
~ParameterGrp () | |
destructor is protected (handle concept) | |
Protected Attributes | |
std::string | _cName |
the own name | |
std::map< std::string,Base::Reference < ParameterGrp > > | _GroupMap |
map of already exported groups | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | _pGroupNode |
DOM Node of the Base node of this group. | |
Friends | |
class | ParameterManager |
methods for group handling | |
| |
typedef Base::Reference < ParameterGrp > | handle |
type of the handle | |
void | Clear (void) |
clears everithing in this group (all types) | |
Base::Reference< ParameterGrp > | GetGroup (const char *Name) |
get a handle to a sub group or creat one | |
std::vector< Base::Reference < ParameterGrp > > | GetGroups (void) |
get a vector of all sub groups in this group | |
bool | HasGroup (const char *Name) const |
test if a special sub group is in this group | |
bool | IsEmpty (void) const |
test if this group is emty | |
void | RemoveGrp (const char *Name) |
remove a sub group from this group |
The parameter container class This is the base class of all classes handle parameter.
The class contains a map of key-value pairs in a grouping structure, not unlike the windows registry. It allows the user to set and retrieve values of the type float, long and string. Also it handles importing and exporting groups of parameters and enables streaming to a persistent medium via XML.
Definition at line 82 of file Parameter.h.
type of the handle
Definition at line 112 of file Parameter.h.
ParameterGrp::ParameterGrp | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | GroupNode = 0L , |
|
const char * | sName = 0L | |||
) | [protected] |
constructor is protected (handle concept)
Defauld construction Does not much.
Definition at line 199 of file Parameter.cpp.
References _cName.
Referenced by _GetGroup(), and GetGroups().
ParameterGrp::~ParameterGrp | ( | ) | [protected] |
destructor is protected (handle concept)
Destruction complete destruction of the object.
Definition at line 209 of file Parameter.cpp.
Base::Reference< ParameterGrp > ParameterGrp::_GetGroup | ( | const char * | Name | ) | [protected] |
helper function for GetGroup
Definition at line 331 of file Parameter.cpp.
References _GroupMap, _pGroupNode, FindOrCreateElement(), and ParameterGrp().
Referenced by GetGroup().
void ParameterGrp::Clear | ( | void | ) |
clears everithing in this group (all types)
Definition at line 848 of file Parameter.cpp.
References _GroupMap, _pGroupNode, Base::Console(), Base::Subject< const char * >::Notify(), and Base::ConsoleSingleton::Warning().
void ParameterGrp::copyTo | ( | Base::Reference< ParameterGrp > | Grp | ) |
make a deep copy to the other group
Definition at line 216 of file Parameter.cpp.
References insertTo().
void ParameterGrp::exportTo | ( | const char * | FileName | ) |
export this group to a file
Definition at line 264 of file Parameter.cpp.
References ParameterManager::CreateDocument(), GetGroup(), insertTo(), and ParameterManager::SaveDocument().
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * ParameterGrp::FindElement | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | Start, | |
const char * | Type, | |||
const char * | Name = 0L | |||
) | const [protected] |
Find an element specified by Type and Name Search in the parent element Start for the first occourrence of an element of Type and with the attribute Name=Name.
On success it returns the pointer to that element, otherwise NULL If the names not given he returns the first occourence fo Type.
Definition at line 879 of file Parameter.cpp.
Referenced by FindOrCreateElement(), GetASCII(), GetASCIIMap(), GetASCIIs(), GetBool(), GetBoolMap(), GetBools(), GetFloat(), GetFloatMap(), GetFloats(), GetGroups(), GetInt(), GetIntMap(), GetInts(), GetUnsigned(), GetUnsignedMap(), GetUnsigneds(), HasGroup(), ParameterManager::LoadDocument(), RemoveASCII(), RemoveBool(), RemoveFloat(), RemoveGrp(), RemoveInt(), and RemoveUnsigned().
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * ParameterGrp::FindNextElement | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * | Prev, | |
const char * | Type | |||
) | const [protected] |
Definition at line 900 of file Parameter.cpp.
References RobotExample::l.
Referenced by GetASCIIMap(), GetASCIIs(), GetBoolMap(), GetBools(), GetFloatMap(), GetFloats(), GetGroups(), GetIntMap(), GetInts(), GetUnsignedMap(), and GetUnsigneds().
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * ParameterGrp::FindOrCreateElement | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | Start, | |
const char * | Type, | |||
const char * | Name | |||
) | const [protected] |
Find an element specified by Type and Name or create it if not found Search in the parent element Start for the first occourrence of an element of Type and with the attribute Name=Name.
On success it returns the pointer to that element, otherwise it creates the element and returns the pointer.
Definition at line 916 of file Parameter.cpp.
References _pGroupNode, and FindElement().
Referenced by _GetGroup(), SetASCII(), SetBool(), SetFloat(), SetInt(), and SetUnsigned().
std::string ParameterGrp::GetASCII | ( | const char * | Name, | |
const char * | pPreset = NULL | |||
) | const |
read a string values
Definition at line 680 of file Parameter.cpp.
References _pGroupNode, and FindElement().
Referenced by Gui::View3DInventor::OnChange(), Gui::SplitView3DInventor::OnChange(), and Gui::DockWnd::ReportOutput::OnChange().
std::vector< std::pair< std::string, std::string > > ParameterGrp::GetASCIIMap | ( | const char * | sFilter = NULL |
) | const |
Same as GetASCIIs() but with key,value map.
Definition at line 724 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
Referenced by insertTo(), and NotifyAll().
std::vector< std::string > ParameterGrp::GetASCIIs | ( | const char * | sFilter = NULL |
) | const |
Return all string elements in this group as a vector of strings Its also possible to set a filter criteria.
sFilter | only strings which name includes sFilter are put in the vector |
Definition at line 702 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
void ParameterGrp::GetBlob | ( | const char * | Name, | |
void * | pBuf, | |||
long | lMaxLength, | |||
void * | pPreset = NULL | |||
) | const |
read blob values or give default
Definition at line 655 of file Parameter.cpp.
bool ParameterGrp::GetBool | ( | const char * | Name, | |
bool | bPreset = false | |||
) | const |
read bool values or give default
Definition at line 397 of file Parameter.cpp.
References _pGroupNode, and FindElement().
Referenced by Gui::View3DInventor::OnChange(), Gui::SplitView3DInventor::OnChange(), and Gui::DockWnd::ReportOutput::OnChange().
std::vector< std::pair< std::string, bool > > ParameterGrp::GetBoolMap | ( | const char * | sFilter = NULL |
) | const |
get a map with all bool values and the keys of this group
Definition at line 442 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
Referenced by insertTo(), and NotifyAll().
std::vector< bool > ParameterGrp::GetBools | ( | const char * | sFilter = NULL |
) | const |
get a vector of all bool values in this group
Definition at line 420 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
double ParameterGrp::GetFloat | ( | const char * | Name, | |
double | dPreset = 0.0 | |||
) | const |
set a float value
Definition at line 586 of file Parameter.cpp.
References _pGroupNode, and FindElement().
Referenced by Gui::View3DInventor::OnChange(), and Gui::SplitView3DInventor::OnChange().
std::vector< std::pair< std::string, double > > ParameterGrp::GetFloatMap | ( | const char * | sFilter = NULL |
) | const |
get a map with all float values and the keys of this group
Definition at line 627 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
Referenced by insertTo(), and NotifyAll().
std::vector< double > ParameterGrp::GetFloats | ( | const char * | sFilter = NULL |
) | const |
get a vector of all float values in this group
Definition at line 608 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
Base::Reference< ParameterGrp > ParameterGrp::GetGroup | ( | const char * | Name | ) |
get a handle to a sub group or creat one
Definition at line 296 of file Parameter.cpp.
References _GetGroup(), and RobotExample::pos.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated(), Gui::Application::Application(), Gui::Dialog::DlgParameterImp::closeEvent(), Gui::MainWindow::event(), exportTo(), Gui::WindowParameter::getDefaultParameter(), Gui::FileDialog::getWorkingDirectory(), importFrom(), initPart(), insert(), PartGui::DlgSettingsGeneral::loadSettings(), Gui::Dialog::DlgParameterImp::onChangeParameterSet(), Gui::ToolBarManager::restoreState(), PartGui::DlgSettingsGeneral::saveSettings(), Gui::ToolBarManager::saveState(), Gui::DockWindowManager::saveState(), Gui::ToolBarManager::setup(), Gui::DockWindowManager::setup(), Gui::FileDialog::setWorkingDirectory(), Gui::Dialog::DlgParameterImp::showEvent(), Gui::MainWindow::showTipOfTheDay(), and Gui::MainWindow::startSplasher().
const char* ParameterGrp::GetGroupName | ( | void | ) | const [inline] |
std::vector< Base::Reference< ParameterGrp > > ParameterGrp::GetGroups | ( | void | ) |
get a vector of all sub groups in this group
Definition at line 352 of file Parameter.cpp.
References _GroupMap, _pGroupNode, FindElement(), FindNextElement(), and ParameterGrp().
Referenced by insertTo(), and Gui::Dialog::DlgParameterImp::onChangeParameterSet().
long ParameterGrp::GetInt | ( | const char * | Name, | |
long | lPreset = 0 | |||
) | const |
read bool values or give default
Definition at line 464 of file Parameter.cpp.
References _pGroupNode, and FindElement().
Referenced by Gui::View3DInventor::OnChange(), Gui::SplitView3DInventor::OnChange(), and Gui::DockWnd::ReportOutput::OnChange().
std::vector< std::pair< std::string, long > > ParameterGrp::GetIntMap | ( | const char * | sFilter = NULL |
) | const |
get a map with all int values and the keys of this group
Definition at line 505 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
Referenced by insertTo(), and NotifyAll().
std::vector< long > ParameterGrp::GetInts | ( | const char * | sFilter = NULL |
) | const |
get a vector of all int values in this group
Definition at line 486 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
unsigned long ParameterGrp::GetUnsigned | ( | const char * | Name, | |
unsigned long | lPreset = 0 | |||
) | const |
read uint values or give default
Definition at line 525 of file Parameter.cpp.
References _pGroupNode, and FindElement().
Referenced by Gui::View3DInventor::OnChange(), Gui::SplitView3DInventor::OnChange(), Gui::DockWnd::ReportOutput::OnChange(), and Gui::StatusBarObserver::OnChange().
std::vector< std::pair< std::string, unsigned long > > ParameterGrp::GetUnsignedMap | ( | const char * | sFilter = NULL |
) | const |
get a map with all uint values and the keys of this group
Definition at line 566 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
Referenced by insertTo(), and NotifyAll().
std::vector< unsigned long > ParameterGrp::GetUnsigneds | ( | const char * | sFilter = NULL |
) | const |
get a vector of all uint values in this group
Definition at line 547 of file Parameter.cpp.
References _pGroupNode, FindElement(), and FindNextElement().
bool ParameterGrp::HasGroup | ( | const char * | Name | ) | const |
test if a special sub group is in this group
Definition at line 386 of file Parameter.cpp.
References _GroupMap, _pGroupNode, and FindElement().
void ParameterGrp::importFrom | ( | const char * | FileName | ) |
import from a file to this group
Definition at line 276 of file Parameter.cpp.
References GetGroup(), and ParameterManager::LoadDocument().
static void ParameterGrp::Init | ( | void | ) | [static] |
Reimplemented in ParameterManager.
void ParameterGrp::insert | ( | const char * | FileName | ) |
insert from a file to this group, overwrite only the similar
Definition at line 286 of file Parameter.cpp.
References GetGroup(), and ParameterManager::LoadDocument().
void ParameterGrp::insertTo | ( | Base::Reference< ParameterGrp > | Grp | ) |
overwrite everithing similar, leaf the others allone
Definition at line 225 of file Parameter.cpp.
References GetASCIIMap(), GetBoolMap(), GetFloatMap(), GetGroups(), GetIntMap(), and GetUnsignedMap().
Referenced by copyTo(), and exportTo().
bool ParameterGrp::IsEmpty | ( | void | ) | const |
void ParameterGrp::NotifyAll | ( | ) |
Notifies all observers for all entries except of sub-groups.
Definition at line 932 of file Parameter.cpp.
References GetASCIIMap(), GetBoolMap(), GetFloatMap(), GetIntMap(), GetUnsignedMap(), and Base::Subject< const char * >::Notify().
void ParameterGrp::RemoveASCII | ( | const char * | Name | ) |
remove a string value from this group
Definition at line 765 of file Parameter.cpp.
References _pGroupNode, FindElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::RemoveBlob | ( | const char * | Name | ) |
remove a blob value from this group
Definition at line 793 of file Parameter.cpp.
void ParameterGrp::RemoveBool | ( | const char * | Name | ) |
remove a bool value from this group
Definition at line 779 of file Parameter.cpp.
References _pGroupNode, FindElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::RemoveFloat | ( | const char * | Name | ) |
remove a float value from this group
Definition at line 806 of file Parameter.cpp.
References _pGroupNode, FindElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::RemoveGrp | ( | const char * | Name | ) |
remove a sub group from this group
Definition at line 749 of file Parameter.cpp.
References _GroupMap, _pGroupNode, FindElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::RemoveInt | ( | const char * | Name | ) |
remove a int value from this group
Definition at line 820 of file Parameter.cpp.
References _pGroupNode, FindElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::RemoveUnsigned | ( | const char * | Name | ) |
remove a uint value from this group
Definition at line 834 of file Parameter.cpp.
References _pGroupNode, FindElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::SetASCII | ( | const char * | Name, | |
const char * | sValue | |||
) |
set a string value
Definition at line 661 of file Parameter.cpp.
References _pGroupNode, FindOrCreateElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::SetBlob | ( | const char * | Name, | |
void * | pValue, | |||
long | lLength | |||
) |
set a blob value
Definition at line 649 of file Parameter.cpp.
void ParameterGrp::SetBool | ( | const char * | Name, | |
bool | bValue | |||
) |
set a bool value
Definition at line 410 of file Parameter.cpp.
References _pGroupNode, FindOrCreateElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::SetFloat | ( | const char * | Name, | |
double | dValue | |||
) |
read float values or give default
Definition at line 596 of file Parameter.cpp.
References _pGroupNode, FindOrCreateElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::SetInt | ( | const char * | Name, | |
long | lValue | |||
) |
set a int value
Definition at line 474 of file Parameter.cpp.
References _pGroupNode, FindOrCreateElement(), and Base::Subject< const char * >::Notify().
void ParameterGrp::SetUnsigned | ( | const char * | Name, | |
unsigned long | lValue | |||
) |
set a uint value
Definition at line 535 of file Parameter.cpp.
References _pGroupNode, FindOrCreateElement(), and Base::Subject< const char * >::Notify().
friend class ParameterManager [friend] |
Definition at line 209 of file Parameter.h.
std::string ParameterGrp::_cName [protected] |
the own name
Definition at line 249 of file Parameter.h.
Referenced by GetGroupName(), and ParameterGrp().
std::map<std::string ,Base::Reference<ParameterGrp> > ParameterGrp::_GroupMap [protected] |
map of already exported groups
Definition at line 251 of file Parameter.h.
Referenced by _GetGroup(), Clear(), GetGroups(), HasGroup(), and RemoveGrp().
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* ParameterGrp::_pGroupNode [protected] |
DOM Node of the Base node of this group.
Definition at line 247 of file Parameter.h.
Referenced by _GetGroup(), Clear(), ParameterManager::CreateDocument(), FindOrCreateElement(), GetASCII(), GetASCIIMap(), GetASCIIs(), GetBool(), GetBoolMap(), GetBools(), GetFloat(), GetFloatMap(), GetFloats(), GetGroups(), GetInt(), GetIntMap(), GetInts(), GetUnsigned(), GetUnsignedMap(), GetUnsigneds(), HasGroup(), IsEmpty(), ParameterManager::LoadDocument(), RemoveASCII(), RemoveBool(), RemoveFloat(), RemoveGrp(), RemoveInt(), RemoveUnsigned(), SetASCII(), SetBool(), SetFloat(), SetInt(), and SetUnsigned().