fw4spl
|
Defines the configuration element class. More...
#include <ConfigurationElement.hpp>
Classes | |
struct | NoSuchAttribute |
Defines the a class for attributes exceptions. More... | |
Public Types | |
typedef std::pair< bool, std::string > | AttributePair |
Defines the attribute pair type. | |
Public Types inherited from fwRuntime::ConfigurationElementContainer | |
typedef std::vector< std::shared_ptr< ConfigurationElement > > | Container |
Defines the configuration element container type. More... | |
typedef Container::iterator | Iterator |
Defines the configuration element container type. More... | |
Public Member Functions | |
virtual bool | isA (const std::string &type) const |
FWRUNTIME_API const std::shared_ptr< Bundle > | getBundle () const noexcept |
Retrieves the bundle the configuration element is attached to. More... | |
FWRUNTIME_API const std::string | getAttributeValue (const std::string &name) const noexcept |
Retrieves the value of an attribute for the specified name. More... | |
FWRUNTIME_API const std::string | getExistingAttributeValue (const std::string &name) const |
Retrieves the value of an attribute for the specified name. More... | |
FWRUNTIME_API const AttributePair | getSafeAttributeValue (const std::string &name) const noexcept |
Retrieves the value of an existing attribute for the specified name. More... | |
FWRUNTIME_API const std::string | getName () const noexcept |
Retrieves the name of the configuration element. More... | |
FWRUNTIME_API const std::string | getValue () const noexcept |
Retrieves the configuration element value. More... | |
FWRUNTIME_API bool | hasAttribute (const std::string &name) const noexcept |
Tells if the specified attributes exists. More... | |
FWRUNTIME_API const std::map< std::string, std::string > | getAttributes () const noexcept |
Return the map with attributes. | |
FWRUNTIME_API std::vector< ConfigurationElement::sptr > | find (std::string name="", std::string attribute="", std::string attributeValue="", int depth=1) |
Find recursively all the corresponding configuration elements. More... | |
virtual FWRUNTIME_API | ~ConfigurationElement () |
Used only because this class inherit from enable_shared_from_this. | |
Public Member Functions inherited from fwRuntime::ConfigurationElementContainer | |
FWRUNTIME_API Iterator | begin () |
Retrieves the iterator on the first managed configuration element. More... | |
FWRUNTIME_API Iterator | end () |
Retrieves the iterator on the end of the configuration element container. More... | |
FWRUNTIME_API const Container & | getElements () const |
Returns the configuration element container. More... | |
FWRUNTIME_API const std::shared_ptr< ConfigurationElement > | findConfigurationElement (const std::string &name) const |
Retrieves the first configuration corresponding to the specified name. More... | |
FWRUNTIME_API bool | hasConfigurationElement (const std::string &name) const |
Test if has an configuration corresponding to the specified name. More... | |
FWRUNTIME_API ConfigurationElementContainer | findAllConfigurationElement (const std::string &name) const |
Retrieves the configurations corresponding to the specified name. More... | |
FWRUNTIME_API size_t | size () const |
Return the number of configurations. More... | |
Static Public Member Functions | |
static bool | isTypeOf (const std::string &type) |
Protected Member Functions | |
FWRUNTIME_API | ConfigurationElement (const std::shared_ptr< Bundle > bundle, const std::string &name) |
Constructor. More... | |
FWRUNTIME_API void | setAttributeValue (const std::string &name, const std::string &value) noexcept |
Sets an attribute with the specified name and value. More... | |
FWRUNTIME_API void | setValue (const std::string &value) noexcept |
Sets the value of the configuration element it-self. More... | |
Protected Member Functions inherited from fwRuntime::ConfigurationElementContainer | |
FWRUNTIME_API void | addConfigurationElement (std::shared_ptr< ConfigurationElement > element) |
Adds a new configuration element to the extension. More... | |
Friends | |
struct | ::fwRuntime::io::BundleDescriptorReader |
template<class , class , class > | |
class | ::fwTools::ClassFactory |
class | ::fwTools::Factory |
FWRUNTIME_API friend std::ostream & | operator<< (std::ostream &_sstream, ConfigurationElement &_configurationElement) |
Print contents. | |
Demangling methods | |
virtual const std::string & | getClassname () const |
return full object's classname with its namespace, i.e. fwCore::BaseObject | |
static const std::string & | classname () |
return full object's classname with its namespace, i.e. fwCore::BaseObject | |
Defines the configuration element class.
Definition at line 39 of file ConfigurationElement.hpp.
|
protected |
Constructor.
[in] | bundle | a shared pointer to the bundle to the configuration element is attached to |
[in] | name | a string containing the configuration element name |
Definition at line 42 of file ConfigurationElement.cpp.
std::vector< ConfigurationElement::sptr > fwRuntime::ConfigurationElement::find | ( | std::string | name = "" , |
std::string | attribute = "" , |
||
std::string | attributeValue = "" , |
||
int | depth = 1 |
||
) |
Find recursively all the corresponding configuration elements.
[in] | name | name of the configuration element (if name is empty, find all name) |
[in] | attribute | attribute which must be contained by the configuration element ( if attribute is empty, this doesn't check the attribute) |
[in] | attributeValue | value of the attribute which must be contained by the configuration element ( if value is empty, this doesn't check the value ) |
[in] | depth | depth of the recursion |
Definition at line 143 of file ConfigurationElement.cpp.
References fwRuntime::ConfigurationElementContainer::begin(), fwRuntime::ConfigurationElementContainer::end(), getAttributeValue(), getName(), and hasAttribute().
Referenced by fwServices::helper::Config::parseService().
|
noexcept |
Retrieves the value of an attribute for the specified name.
This method will search for an attribute having the specified name and return it's value. When no matching attribute is found, an empty string is returned.
[in] | name | a string containing an attribute value |
Definition at line 58 of file ConfigurationElement.cpp.
Referenced by find(), and fwServices::helper::Config::parseService().
|
noexcept |
Retrieves the bundle the configuration element is attached to.
Definition at line 51 of file ConfigurationElement.cpp.
const std::string fwRuntime::ConfigurationElement::getExistingAttributeValue | ( | const std::string & | name | ) | const |
Retrieves the value of an attribute for the specified name.
This method will search for an attribute having the specified name and return it's value. When no matching attribute is found, an object of type NoSuchAttribute is thrown.
[in] | name | a string containing an attribute name |
NoSuchAttribute | no attribute with the specified name has been found |
Definition at line 66 of file ConfigurationElement.cpp.
Referenced by fwServices::helper::Config::createProxy().
|
noexcept |
Retrieves the name of the configuration element.
Definition at line 94 of file ConfigurationElement.cpp.
Referenced by find(), and fwServices::helper::Config::parseService().
|
noexcept |
Retrieves the value of an existing attribute for the specified name.
The returned value is a pair where the first element is a boolean telling if the attribute really exists and the second element is the attribute value.
[in] | name | a string containing an attribute name |
Definition at line 78 of file ConfigurationElement.cpp.
Referenced by fwServices::helper::Config::parseService().
|
noexcept |
Retrieves the configuration element value.
Definition at line 101 of file ConfigurationElement.cpp.
|
noexcept |
Tells if the specified attributes exists.
[in] | name | a string containing an attribute name |
Definition at line 108 of file ConfigurationElement.cpp.
Referenced by fwServices::helper::Config::createProxy(), and find().
|
protectednoexcept |
Sets an attribute with the specified name and value.
Setting a value for an existing attribute will override the old value.
[in] | name | a string containing the attribute name |
[in] | value | a string containing the attribute value |
Definition at line 123 of file ConfigurationElement.cpp.
Referenced by fwRuntime::EConfigurationElement::addConfigurationElement().
|
protectednoexcept |
Sets the value of the configuration element it-self.
[in] | value | a string containing the new configuration element value |
Definition at line 130 of file ConfigurationElement.cpp.
Referenced by fwRuntime::EConfigurationElement::addConfigurationElement().