PropertyDefinitionContainer Class Reference

PropertyDefinitionContainer. More...

#include <ArmarXCore/core/application/properties/PropertyDefinitionContainer.h>

+ Inheritance diagram for PropertyDefinitionContainer:

Public Types

typedef std::map< std::string, PropertyDefinitionBase * > DefinitionContainer
 

Public Member Functions

template<typename PropertyType>
void component (IceInternal::ProxyHandle< PropertyType > &setter, const std::string &default_name="", const std::string &property_name="", const std::string &description="")
 
template<typename PropertyType>
PropertyDefinition< PropertyType > & defineOptionalProperty (const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector (const std::string &name, EigenVectorType defaultValue, const std::string &description, char delimiter)
 
template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector (const std::string &name, EigenVectorType defaultValue, const std::string &description, char delimiter, PropertyDefinitionBase::PropertyConstness constness)
 
template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector (const std::string &name, EigenVectorType defaultValue, const std::string &description="", const std::string &delimiter=" ", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 Define a required property for an Eigen vector type.
 
template<typename PropertyType>
PropertyDefinition< PropertyType > & defineRequiredProperty (const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector (const std::string &name, const std::string &description, char delimiter)
 
template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector (const std::string &name, const std::string &description, char delimiter, PropertyDefinitionBase::PropertyConstness constness)
 
template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector (const std::string &name, const std::string &description="", const std::string &delimiter=" ", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 Define a required property for an Eigen vector type.
 
PropertyDefinitionBasegetDefinitionBase (const std::string &name)
 
template<typename PropertyType>
PropertyDefinition< PropertyType > & getDefintion (const std::string &name)
 
std::string getDescription () const
 Returns the detailed description of the property user.
 
std::string getPrefix ()
 
Ice::PropertiesPtr getProperties ()
 
std::map< std::string, std::string > getPropertyValues (const std::string &prefix="") const
 
std::map< std::string, ProxyPropertyDefinitionBase * > getProxyDefinitions ()
 
std::vector< std::string > getSubscribedTopicDefinitions ()
 
std::string getValue (const std::string &name)
 
bool hasDefinition (const std::string &name) const
 
bool isPropertySet (const std::string &name)
 
template<typename PropertyType>
decltype(auto) optional (const PropertyType &getter, std::function< void(const PropertyType &)> setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
template<typename PropertyType>
decltype(auto) optional (PropertyType &setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
 PropertyDefinitionContainer (const std::string &prefix)
 
template<typename PropertyType>
decltype(auto) required (PropertyType &setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
template<typename PropertyType>
decltype(auto) requiredOrOptional (bool isRequired, const PropertyType &getter, std::function< void(const PropertyType &)> setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
template<typename PropertyType>
decltype(auto) requiredOrOptional (bool isRequired, PropertyType &setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
 
void setDescription (const std::string &description)
 Sets the detailed description of the property user.
 
void setPrefix (std::string prefix)
 
void setProperties (Ice::PropertiesPtr properties)
 
template<typename PropertyType>
void topic (IceInternal::ProxyHandle< PropertyType > &setter, const std::string &default_name="", const std::string &property_name="", const std::string &description="")
 Define a property to set the name of a topic which is subscribed to.
 
template<typename PropertyType>
void topic (std::string default_name="", std::string property_name="", std::string description="")
 Define a topic which is offered from the component via the template parameter.
 
std::string toString (PropertyDefinitionFormatter &formatter)
 
void writeProxyValues (IceManagerPtr)
 
void writeValues ()
 
 ~PropertyDefinitionContainer () override
 

Static Public Member Functions

template<typename EigenVectorType>
static EigenVectorType eigenVectorFactoryFunction (std::string string, std::string delim)
 Parses string to an Eigen vector of type EigenVectorType.
 
static std::string eigenVectorPropertyDescription (const std::string &description, long size, std::string delim)
 
template<typename EigenVectorType>
static std::string eigenVectorToString (const EigenVectorType &vector, std::string delim)
 

Protected Attributes

std::string briefDescription
 PropertyUser brief description.
 
DefinitionContainer definitions
 Property definitions container.
 
std::string description
 Property User description.
 
std::string prefix
 Prefix of the properties such as namespace, domain, component name, etc.
 
Ice::PropertiesPtr properties
 
std::map< std::string, ProxyPropertyDefinitionBase * > proxies
 
std::vector< std::string > subscribedTopics
 

Detailed Description

Member Typedef Documentation

◆ DefinitionContainer

typedef std::map<std::string, PropertyDefinitionBase*> DefinitionContainer

Definition at line 57 of file PropertyDefinitionContainer.h.

Constructor & Destructor Documentation

◆ PropertyDefinitionContainer()

PropertyDefinitionContainer ( const std::string & prefix)

Definition at line 53 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~PropertyDefinitionContainer()

Definition at line 60 of file PropertyDefinitionContainer.cpp.

Member Function Documentation

◆ component()

template<typename PropertyType>
void component ( IceInternal::ProxyHandle< PropertyType > & setter,
const std::string & default_name = "",
const std::string & property_name = "",
const std::string & description = "" )

Definition at line 463 of file PropertyDefinitionContainer.h.

◆ defineOptionalProperty()

template<typename PropertyType>
PropertyDefinition< PropertyType > & defineOptionalProperty ( const std::string & name,
PropertyType defaultValue,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )

Definition at line 582 of file PropertyDefinitionContainer.h.

◆ defineOptionalPropertyVector() [1/3]

template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector ( const std::string & name,
EigenVectorType defaultValue,
const std::string & description,
char delimiter )
inline

Definition at line 281 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:

◆ defineOptionalPropertyVector() [2/3]

template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector ( const std::string & name,
EigenVectorType defaultValue,
const std::string & description,
char delimiter,
PropertyDefinitionBase::PropertyConstness constness )
inline

Definition at line 269 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:

◆ defineOptionalPropertyVector() [3/3]

template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector ( const std::string & name,
EigenVectorType defaultValue,
const std::string & description = "",
const std::string & delimiter = " ",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )

Define a required property for an Eigen vector type.

The EigenVectorType can be any Eigen::Vector type, (Vector3f, VectorXd, ...).

Parameters
delimiterthe delimiter between vector coefficients in the string representation

Usage example:

// Definition
// defaults to "0 0 0", accepts e.g. "1.0 2.0 3.0" and "1.0 -.3 .5"
"Position", Eigen::Vector3f::Zero(), "The position.");
// defaults to "640x480", accepts e.g. "1920x1080"
"Resolution", Eigen::Vector2f(640, 480), "The resolution.", 'x');
// defaults to "0,1,2,3,4,5,6,7,8,9", accepts e.g. "1" or "1,2,3"
Eigen::VectorXd valuesDefault(10);
valuesDefault << 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
"Values", valuesDefault, "The values.", ',');
// Usage:
Eigen::Vector3f position = getProperty<Eigen::Vector3f>("Position");
Eigen::Vector2i resolution = getProperty<Eigen::Vector2i>("Resolution");
Eigen::VectorXd values = getProperty<Eigen::VectorXd>("Values");
// .getValue() can trigger Eigen's implicit conversion
Eigen::VectorXf positionX = getProperty<Eigen::VectorXf>("Position").getValue();
// Specification on command line:
./<binary> --ArmarX.<ComponentName>.Position="1 2 3"
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector(const std::string &name, EigenVectorType defaultValue, const std::string &description="", const std::string &delimiter=" ", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Define a required property for an Eigen vector type.

Definition at line 622 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defineRequiredProperty()

template<typename PropertyType>
PropertyDefinition< PropertyType > & defineRequiredProperty ( const std::string & name,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )

Definition at line 565 of file PropertyDefinitionContainer.h.

◆ defineRequiredPropertyVector() [1/3]

template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector ( const std::string & name,
const std::string & description,
char delimiter )
inline

Definition at line 218 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:

◆ defineRequiredPropertyVector() [2/3]

template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector ( const std::string & name,
const std::string & description,
char delimiter,
PropertyDefinitionBase::PropertyConstness constness )
inline

Definition at line 207 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:

◆ defineRequiredPropertyVector() [3/3]

template<typename EigenVectorType>
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector ( const std::string & name,
const std::string & description = "",
const std::string & delimiter = " ",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )

Define a required property for an Eigen vector type.

The EigenVectorType can be any Eigen::Vector type, (Vector3f, VectorXd, ...).

Parameters
delimiterthe delimiter between vector coefficients in the string representation

Usage example:

// Definition
// accepts e.g. "1.0 2.0 3.0" and "1.0 -.3 .5"
defineRequiredPropertyVector<Eigen::Vector3f>("Position", "The position.");
// accepts e.g. "640x480" and "1920x1080"
defineRequiredPropertyVector<Eigen::Vector2i>("Resolution", "The resolution.", 'x');
// accepts e.g. "0,1,2,3,4,5,6,7,8,9" and "1"
defineRequiredPropertyVector<Eigen::VectorXd>("Values", "The values.", ',');
// Usage:
Eigen::Vector3f position = getProperty<Eigen::Vector3f>("Position");
Eigen::Vector2i resolution = getProperty<Eigen::Vector2i>("Resolution");
Eigen::VectorXd values = getProperty<Eigen::VectorXd>("Values");
// .getValue() can trigger Eigen's implicit conversion
Eigen::VectorXf positionX = getProperty<Eigen::VectorXf>("Position").getValue();
// Specification on command line:
./<binary> --ArmarX.<ComponentName>.Position="1 2 3"
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector(const std::string &name, const std::string &description="", const std::string &delimiter=" ", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Define a required property for an Eigen vector type.

Definition at line 600 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eigenVectorFactoryFunction()

template<typename EigenVectorType>
EigenVectorType eigenVectorFactoryFunction ( std::string string,
std::string delim )
static

Parses string to an Eigen vector of type EigenVectorType.

Parameters
delimThe delimiter between coefficients.
Exceptions
std::bad_castIf parsing string fails.

Definition at line 680 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eigenVectorPropertyDescription()

std::string eigenVectorPropertyDescription ( const std::string & description,
long size,
std::string delim )
static

Definition at line 255 of file PropertyDefinitionContainer.cpp.

+ Here is the caller graph for this function:

◆ eigenVectorToString()

template<typename EigenVectorType>
std::string eigenVectorToString ( const EigenVectorType & vector,
std::string delim )
static

Definition at line 720 of file PropertyDefinitionContainer.h.

+ Here is the caller graph for this function:

◆ getDefinitionBase()

PropertyDefinitionBase * getDefinitionBase ( const std::string & name)

Definition at line 130 of file PropertyDefinitionContainer.cpp.

◆ getDefintion()

template<typename PropertyType>
PropertyDefinition< PropertyType > & getDefintion ( const std::string & name)

Definition at line 647 of file PropertyDefinitionContainer.h.

+ Here is the caller graph for this function:

◆ getDescription()

std::string getDescription ( ) const

Returns the detailed description of the property user.

Returns
detailed description text

Definition at line 180 of file PropertyDefinitionContainer.cpp.

◆ getPrefix()

std::string getPrefix ( )

Definition at line 198 of file PropertyDefinitionContainer.cpp.

+ Here is the caller graph for this function:

◆ getProperties()

Ice::PropertiesPtr getProperties ( )

Definition at line 118 of file PropertyDefinitionContainer.cpp.

◆ getPropertyValues()

std::map< std::string, std::string > getPropertyValues ( const std::string & prefix = "") const

Definition at line 224 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:

◆ getProxyDefinitions()

std::map< std::string, ProxyPropertyDefinitionBase * > getProxyDefinitions ( )

Definition at line 106 of file PropertyDefinitionContainer.cpp.

◆ getSubscribedTopicDefinitions()

std::vector< std::string > getSubscribedTopicDefinitions ( )

Definition at line 112 of file PropertyDefinitionContainer.cpp.

◆ getValue()

std::string getValue ( const std::string & name)

Definition at line 211 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasDefinition()

bool hasDefinition ( const std::string & name) const
inline

Definition at line 296 of file PropertyDefinitionContainer.h.

◆ isPropertySet()

bool isPropertySet ( const std::string & name)

Definition at line 204 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:

◆ optional() [1/2]

template<typename PropertyType>
decltype(auto) optional ( const PropertyType & getter,
std::function< void(const PropertyType &)> setter,
const std::string & name,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )
inline

Definition at line 96 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:

◆ optional() [2/2]

template<typename PropertyType>
decltype(auto) optional ( PropertyType & setter,
const std::string & name,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )
inline

Definition at line 85 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ required()

template<typename PropertyType>
decltype(auto) required ( PropertyType & setter,
const std::string & name,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )
inline

Definition at line 74 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ requiredOrOptional() [1/2]

template<typename PropertyType>
decltype(auto) requiredOrOptional ( bool isRequired,
const PropertyType & getter,
std::function< void(const PropertyType &)> setter,
const std::string & name,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )
inline

Definition at line 436 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:

◆ requiredOrOptional() [2/2]

template<typename PropertyType>
decltype(auto) requiredOrOptional ( bool isRequired,
PropertyType & setter,
const std::string & name,
const std::string & description = "",
PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant )
inline

Definition at line 403 of file PropertyDefinitionContainer.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

void setDescription ( const std::string & description)

Sets the detailed description of the property user.

Parameters
descriptiondetailed description text

Definition at line 186 of file PropertyDefinitionContainer.cpp.

+ Here is the caller graph for this function:

◆ setPrefix()

void setPrefix ( std::string prefix)

Definition at line 192 of file PropertyDefinitionContainer.cpp.

+ Here is the caller graph for this function:

◆ setProperties()

void setProperties ( Ice::PropertiesPtr properties)

Definition at line 124 of file PropertyDefinitionContainer.cpp.

◆ topic() [1/2]

template<typename PropertyType>
void topic ( IceInternal::ProxyHandle< PropertyType > & setter,
const std::string & default_name = "",
const std::string & property_name = "",
const std::string & description = "" )

Define a property to set the name of a topic which is subscribed to.

This defines property to set the name of a topic of the given type from setter. Before Component::onInitComponent(), the component will subscribe to this topic, and before Component::onConnectComponent(), the topic proxy will be written into setter.

Definition at line 473 of file PropertyDefinitionContainer.h.

◆ topic() [2/2]

template<typename PropertyType>
void topic ( std::string default_name = "",
std::string property_name = "",
std::string description = "" )

Define a topic which is offered from the component via the template parameter.

Sane defaults will be chosen for the property name and the default values depending on the template parameter, but these values can all be overridden with the parameters.

Definition at line 483 of file PropertyDefinitionContainer.h.

◆ toString()

std::string toString ( PropertyDefinitionFormatter & formatter)

Definition at line 143 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:

◆ writeProxyValues()

void writeProxyValues ( IceManagerPtr ice_manager)

Definition at line 88 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:

◆ writeValues()

void writeValues ( )

Definition at line 76 of file PropertyDefinitionContainer.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ briefDescription

std::string briefDescription
protected

PropertyUser brief description.

Definition at line 377 of file PropertyDefinitionContainer.h.

◆ definitions

DefinitionContainer definitions
protected

Property definitions container.

Definition at line 357 of file PropertyDefinitionContainer.h.

◆ description

std::string description
protected

Property User description.

Definition at line 372 of file PropertyDefinitionContainer.h.

◆ prefix

std::string prefix
protected

Prefix of the properties such as namespace, domain, component name, etc.

Definition at line 367 of file PropertyDefinitionContainer.h.

◆ properties

Ice::PropertiesPtr properties
protected

Definition at line 379 of file PropertyDefinitionContainer.h.

◆ proxies

std::map<std::string, ProxyPropertyDefinitionBase*> proxies
protected

Definition at line 359 of file PropertyDefinitionContainer.h.

◆ subscribedTopics

std::vector<std::string> subscribedTopics
protected

Definition at line 361 of file PropertyDefinitionContainer.h.


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