Provides access to Ice properties with extended capabilities.
More...
#include <ArmarXCore/core/application/properties/Property.h>
template<typename PropertyType>
class armarx::Property< PropertyType >
Provides access to Ice properties with extended capabilities.
The Property template class provides access to Ice config properties and command line options. Its main capability is to map a string value on any type that is required and put constrains on the value as well as on the property itself at the same time. For instance you can specify that a certain property is required for the component to proceed or a property may require a specific value syntax or even numeric bounds which may not be exceeded. These features and few more are supported by the Property combined with the PropertyDefinition.
Outline
template<
typename PropertyType>
class Property
{
bool iseSet();
}
PropertyType getValue()
Returns the property value set in a config file or passed as a command-line option.
Definition Property.h:203
Property(PropertyDefinition< PropertyType > definition, std::string prefix, Ice::PropertiesPtr properties)
Property constructor.
Definition Property.h:193
bool isRequired() const
Checks if this property is required.
Definition Property.h:211
◆ PropertyValuesMap
template<typename PropertyType>
◆ Property()
template<typename PropertyType>
Property constructor.
- Parameters
-
| definition | Property specific definition |
| prefix | Property prefix such as domain or component name |
| properties | Ice properties set which contains all property strings. |
◆ getValue()
template<typename PropertyType>
| PropertyType getValue |
( |
| ) |
|
Returns the property value set in a config file or passed as a command-line option.
If property is not set, the default value is returned unless the property is required. In the latter case an exception is thrown indicating that the required property is not set.
- Returns
- Property value of the type PropertyType
- Exceptions
-
◆ getValueAndReplaceAllVars() [1/2]
template<typename PropertyType>
template<class
T = PropertyType>
| std::enable_if_t< std::is_same_v< T, std::string >, T > getValueAndReplaceAllVars |
( |
| ) |
|
|
inline |
◆ getValueAndReplaceAllVars() [2/2]
template<typename PropertyType>
template<class
T = PropertyType>
| std::enable_if_t< std::is_same_v< T, std::vector< std::string > >, T > getValueAndReplaceAllVars |
( |
| ) |
|
|
inline |
◆ isConstant()
template<typename PropertyType>
| bool isConstant |
( |
| ) |
const |
Checks if this property is constant or if it can be changed at runtime.
- Returns
- true if property is constant, otherwise false
◆ isRequired()
template<typename PropertyType>
| bool isRequired |
( |
| ) |
const |
Checks if this property is required.
- Returns
- true if set required, otherwise false
◆ isSet()
template<typename PropertyType>
Checks whether the property is set.
- Returns
- true if property is set, otheriwse false
◆ operator PropertyType()
template<typename PropertyType>
| operator PropertyType |
( |
| ) |
|
|
inline |
Convenience overload of getValue().
Usage:
std::string val = getProperty<std::string>("myProp");
The documentation for this class was generated from the following file: