PropertyDefinitionContainer.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Jan Issac (jan dot issac at gmx dot de)
20  * @date 2012
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #pragma once
27 
34 
35 #include <Ice/Proxy.h>
36 #include <Ice/ProxyHandle.h>
37 
38 #include <typeinfo>
39 #include <vector>
40 #include <string>
41 #include <map>
42 
43 namespace armarx
44 {
45  class PropertyDefinitionBase;
46 
47  /**
48  * @ingroup properties
49  *
50  * @class PropertyDefinitionContainer
51  * @brief PropertyDefinitionContainer
52  */
53  class PropertyDefinitionContainer : public virtual IceUtil::Shared
54  {
55  public:
56 
57  typedef std::map<std::string, PropertyDefinitionBase*>
59 
60  PropertyDefinitionContainer(const std::string& prefix);
61 
63 
65 
67 
68  void writeValues();
70  std::map<std::string, ProxyPropertyDefinitionBase*> getProxyDefinitions();
71  std::vector<std::string> getSubscribedTopicDefinitions();
72 
73  template <typename PropertyType>
74  decltype(auto) required(
75  PropertyType& setter,
76  const std::string& name,
77  const std::string& description = "",
78  PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant)
79  {
80  return requiredOrOptional(true, setter, name, description, constness);
81  }
82 
83  template <typename PropertyType>
84  decltype(auto) optional(
85  PropertyType& setter,
86  const std::string& name,
87  const std::string& description = "",
88  PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant)
89  {
90  return requiredOrOptional(false, setter, name, description, constness);
91  }
92 
93  template <typename PropertyType>
94  decltype(auto) requiredOrOptional(
95  bool isRequired,
96  PropertyType& setter,
97  const std::string& name,
98  const std::string& description = "",
99  PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant);
100 
101  public:
102  template <typename PropertyType>
103  void
104  component(
105  IceInternal::ProxyHandle<PropertyType>& setter,
106  const std::string& default_name = "",
107  const std::string& property_name = "",
108  const std::string& description = "");
109 
110  /**
111  * Define a property to set the name of a topic which is subscribed to.
112  *
113  * This defines property to set the name of a topic of the given type from setter. Before
114  * `Component::onInitComponent()`, the component will subscribe to this topic, and before
115  * `Component::onConnectComponent()`, the topic proxy will be written into `setter`.
116  */
117  template <typename PropertyType>
118  void
119  topic(
120  IceInternal::ProxyHandle<PropertyType>& setter,
121  const std::string& default_name = "",
122  const std::string& property_name = "",
123  const std::string& description = "");
124 
125  /**
126  * Define a topic which is offered from the component via the template parameter.
127  *
128  * Sane defaults will be chosen for the property name and the default values depending on
129  * the template parameter, but these values can all be overridden with the parameters.
130  */
131  template <typename PropertyType>
132  void
133  topic(
134  std::string default_name = "",
135  std::string property_name = "",
136  std::string description = "");
137 
138  template <typename PropertyType>
140  const std::string& name,
141  const std::string& description = "",
142  PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant);
143 
144  template <typename PropertyType>
146  const std::string& name,
147  PropertyType defaultValue,
148  const std::string& description = "",
149  PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant);
150 
151  /**
152  * @brief Define a required property for an Eigen vector type.
153  * The EigenVectorType can be any Eigen::Vector type, (Vector3f, VectorXd, ...).
154  *
155  * @param delimiter the delimiter between vector coefficients in the string representation
156  *
157  * Usage example:
158  * @code
159  * // Definition
160  * // accepts e.g. "1.0 2.0 3.0" and "1.0 -.3 .5"
161  * defineRequiredPropertyVector<Eigen::Vector3f>("Position", "The position.");
162  * // accepts e.g. "640x480" and "1920x1080"
163  * defineRequiredPropertyVector<Eigen::Vector2i>("Resolution", "The resolution.", 'x');
164  * // accepts e.g. "0,1,2,3,4,5,6,7,8,9" and "1"
165  * defineRequiredPropertyVector<Eigen::VectorXd>("Values", "The values.", ',');
166  *
167  * // Usage:
168  * Eigen::Vector3f position = getProperty<Eigen::Vector3f>("Position");
169  * Eigen::Vector2i resolution = getProperty<Eigen::Vector2i>("Resolution");
170  * Eigen::VectorXd values = getProperty<Eigen::VectorXd>("Values");
171  * // .getValue() can trigger Eigen's implicit conversion
172  * Eigen::VectorXf positionX = getProperty<Eigen::VectorXf>("Position").getValue();
173  *
174  * // Specification on command line:
175  * ./<binary> --ArmarX.<ComponentName>.Position="1 2 3"
176  * @endcode
177  */
178  template <typename EigenVectorType>
180  const std::string& name,
181  const std::string& description = "",
182  const std::string& delimiter = " ",
183  PropertyDefinitionBase::PropertyConstness constness = PropertyDefinitionBase::eConstant);
184 
185  // Legacy overloads taking char as delimiter.
186  template <typename EigenVectorType>
188  const std::string& name, const std::string& description, char delimiter,
189  PropertyDefinitionBase::PropertyConstness constness)
190  {
191  return defineRequiredPropertyVector<EigenVectorType>(name, description, std::string(1, delimiter), constness);
192  }
193  template <typename EigenVectorType>
195  const std::string& name, const std::string& description, char delimiter)
196  {
197  return defineRequiredPropertyVector<EigenVectorType>(name, description, delimiter, PropertyDefinitionBase::eConstant);
198  }
199 
200  /**
201  * @brief Define a required property for an Eigen vector type.
202  * The EigenVectorType can be any Eigen::Vector type, (Vector3f, VectorXd, ...).
203  * @param delimiter the delimiter between vector coefficients in the string representation
204  *
205  * Usage example:
206  * @code
207  * // Definition
208  * // defaults to "0 0 0", accepts e.g. "1.0 2.0 3.0" and "1.0 -.3 .5"
209  * defineOptionalPropertyVector<Eigen::Vector3f>(
210  * "Position", Eigen::Vector3f::Zero(), "The position.");
211  * // defaults to "640x480", accepts e.g. "1920x1080"
212  * defineOptionalPropertyVector<Eigen::Vector2i>(
213  * "Resolution", Eigen::Vector2f(640, 480), "The resolution.", 'x');
214  * // defaults to "0,1,2,3,4,5,6,7,8,9", accepts e.g. "1" or "1,2,3"
215  * Eigen::VectorXd valuesDefault(10);
216  * valuesDefault << 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
217  * defineOptionalPropertyVector<Eigen::VectorXd>(
218  * "Values", valuesDefault, "The values.", ',');
219  *
220  * // Usage:
221  * Eigen::Vector3f position = getProperty<Eigen::Vector3f>("Position");
222  * Eigen::Vector2i resolution = getProperty<Eigen::Vector2i>("Resolution");
223  * Eigen::VectorXd values = getProperty<Eigen::VectorXd>("Values");
224  * // .getValue() can trigger Eigen's implicit conversion
225  * Eigen::VectorXf positionX = getProperty<Eigen::VectorXf>("Position").getValue();
226  *
227  * // Specification on command line:
228  * ./<binary> --ArmarX.<ComponentName>.Position="1 2 3"
229  * @endcode
230  */
231  template <typename EigenVectorType>
233  const std::string& name,
234  EigenVectorType defaultValue,
235  const std::string& description = "",
236  const std::string& delimiter = " ",
238 
239  // Legacy overloads taking char as delimiter.
240  template <typename EigenVectorType>
242  const std::string& name, EigenVectorType defaultValue, const std::string& description, char delimiter,
244  {
245  return defineOptionalPropertyVector<EigenVectorType>(name, defaultValue, description, std::string(1, delimiter), constness);
246  }
247  template <typename EigenVectorType>
249  const std::string& name, EigenVectorType defaultValue, const std::string& description, char delimiter)
250  {
251  return defineOptionalPropertyVector<EigenVectorType>(name, defaultValue, description, delimiter, PropertyDefinitionBase::eConstant);
252  }
253 
254 
255  PropertyDefinitionBase* getDefinitionBase(const std::string& name);
256 
257  template <typename PropertyType>
258  PropertyDefinition<PropertyType>& getDefintion(const std::string& name);
259  bool hasDefinition(const std::string& name) const
260  {
261  return (definitions.find(name) != definitions.end());
262  }
263 
264  std::string toString(PropertyDefinitionFormatter& formatter);
265 
266  /**
267  * Returns the detailed description of the property user
268  *
269  * @return detailed description text
270  */
271  std::string getDescription() const;
272 
273  /**
274  * Sets the detailed description of the property user
275  *
276  * @param description detailed description text
277  */
278  void setDescription(const std::string& description);
279 
280  void setPrefix(std::string prefix);
281 
282  std::string getPrefix();
283 
284  bool isPropertySet(const std::string& name);
285 
286  std::string getValue(const std::string& name);
287 
288  std::map<std::string, std::string> getPropertyValues(const std::string& prefix = "") const;
289 
290  /**
291  * @brief Parses `string` to an Eigen vector of type `EigenVectorType`.
292  * @param delim The delimiter between coefficients.
293  * @throw std::bad_cast If parsing `string` fails.
294  */
295  template <typename EigenVectorType>
296  static EigenVectorType eigenVectorFactoryFunction(std::string string, std::string delim);
297  template <typename EigenVectorType>
298  static std::string eigenVectorToString(const EigenVectorType& vector, std::string delim);
299 
300  static std::string eigenVectorPropertyDescription(
301  const std::string& description, long size, std::string delim);
302 
303  private:
304 
305  template <typename PropertyType>
306  std::string
307  ice_class_name();
308 
309  template <typename PropertyType>
310  void
311  proxy(
313  const ProxyType proxy_type,
314  std::string default_name,
315  std::string property_name,
316  std::string description);
317 
318 
319  protected:
320  /**
321  * Property definitions container
322  */
324 
325  std::map<std::string, ProxyPropertyDefinitionBase*> proxies;
326 
327  std::vector<std::string> subscribedTopics;
328 
329  /**
330  * Prefix of the properties such as namespace, domain, component name,
331  * etc.
332  */
333  std::string prefix;
334 
335  /**
336  * Property User description
337  */
338  std::string description;
339 
340  /**
341  * PropertyUser brief description
342  */
343  std::string briefDescription;
344 
346  };
347 
348 
349  /**
350  * PropertyDefinitions smart pointer type
351  */
353 
354  /* ====================================================================== */
355  /* === Property Definition Container Implementation ===================== */
356  /* ====================================================================== */
357 
358  std::string PropertyDefinitionContainer_ice_class_name(std::string const& full_type_name);
359 
360 
361  template <typename PropertyType>
362  std::string
363  PropertyDefinitionContainer::ice_class_name()
364  {
365  const std::string full_type_name = PropertyType::ice_staticId();
366  return PropertyDefinitionContainer_ice_class_name(full_type_name);
367  }
368 
369  template <typename PropertyType>
370  inline decltype(auto)
371  PropertyDefinitionContainer::requiredOrOptional(
372  bool isRequired,
373  PropertyType& setter,
374  const std::string& name,
375  const std::string& description,
376  PropertyDefinitionBase::PropertyConstness constness)
377  {
378  using plugin = meta::properties::DefinePropertyPlugin<PropertyType>;
379  if constexpr(plugin::value)
380  {
381  plugin::Define(*this, isRequired, setter, name, description, constness);
382  }
383  else
384  {
385  PropertyDefinition<PropertyType>* def;
386  if (isRequired)
387  {
388  def = new PropertyDefinition<PropertyType>(&setter, name, description, constness);
389  }
390  else
391  {
392  def = new PropertyDefinition<PropertyType>(&setter, name, setter, description, constness);
393  }
394 
395  def->setTypeIdName(typeid(PropertyType).name());
396  definitions[name] = static_cast<PropertyDefinitionBase*>(def);
397  return *def;
398  }
399  }
400 
401 
402  template <typename PropertyType>
403  void
406  const std::string& default_name,
407  const std::string& property_name,
408  const std::string& description)
409  {
410  proxy(setter, ProxyType::component, default_name, property_name, description);
411  }
412 
413 
414  template <typename PropertyType>
415  void
418  const std::string& default_name,
419  const std::string& property_name,
420  const std::string& description)
421  {
422  proxy(setter, ProxyType::topic, default_name, property_name, description);
423  }
424 
425 
426  template <typename PropertyType>
427  void
429  std::string default_name,
430  std::string property_name,
431  std::string description)
432  {
433  const std::string class_name = ice_class_name<PropertyType>();
434 
435  if (default_name.empty())
436  {
437  default_name = class_name;
438  }
439  if (property_name.empty())
440  {
441  property_name = "tpc.sub." + class_name;
442  }
443  if (description.empty())
444  {
445  description = "Name of the `" + class_name + "` topic to subscribe to.";
446  }
447 
448  // Append property definition for the proxy name.
450  new PropertyDefinition<std::string>(nullptr, property_name, default_name, description,
452  def_name->setTypeIdName(typeid(std::string).name());
453  definitions[property_name] = static_cast<PropertyDefinitionBase*>(def_name);
454  subscribedTopics.push_back(property_name);
455  }
456 
457 
458  template <typename PropertyType>
459  void
460  PropertyDefinitionContainer::proxy(
462  const ProxyType proxy_type,
463  std::string default_name,
464  std::string property_name,
465  std::string description)
466  {
467  using PropertyTypePrx = IceInternal::ProxyHandle<PropertyType>;
468 
469  const std::string class_name = ice_class_name<PropertyType>();
470 
471  if (default_name.empty())
472  {
473  default_name = class_name;
474  }
475  if (property_name.empty())
476  {
477  switch (proxy_type)
478  {
480  property_name = "cmp." + class_name;
481  break;
482  case ProxyType::topic:
483  property_name = "tpc.pub." + class_name;
484  break;
485  }
486  }
487  if (description.empty())
488  {
489  switch (proxy_type)
490  {
492  description = "Ice object name of the `" + class_name + "` component.";
493  break;
494  case ProxyType::topic:
495  description = "Name of the `" + class_name + "` topic to publish data to.";
496  break;
497  }
498  }
499 
500  // Append property definition for the proxy name.
501  PropertyDefinition<std::string>* def_name =
502  new PropertyDefinition<std::string>(nullptr, property_name, default_name, description,
504  def_name->setTypeIdName(typeid(std::string).name());
505  definitions[property_name] = static_cast<PropertyDefinitionBase*>(def_name);
506 
507  // Append proxy definition.
508  ProxyPropertyDefinition<PropertyTypePrx>* def =
509  new ProxyPropertyDefinition<PropertyTypePrx>(&setter, proxy_type);
510  proxies[property_name] = static_cast<ProxyPropertyDefinitionBase*>(def);
511  }
512 
513 
514  template <typename PropertyType>
515  PropertyDefinition<PropertyType>&
517  const std::string& description,
519  {
521  new PropertyDefinition<PropertyType>(nullptr, name, description, constness);
522 
523  def->setTypeIdName(typeid(PropertyType).name());
524 
525  definitions[name] = static_cast<PropertyDefinitionBase*>(def);
526 
527  return *def;
528  }
529 
530 
531  template <typename PropertyType>
534  const std::string& name,
535  PropertyType defaultValue,
536  const std::string& description,
538  {
540  new PropertyDefinition<PropertyType>(nullptr, name,
541  defaultValue,
542  description,
543  constness);
544 
545  def->setTypeIdName(typeid(PropertyType).name());
546 
547  definitions[name] = static_cast<PropertyDefinitionBase*>(def);
548 
549  return *def;
550  }
551 
552 
553  template <typename EigenVectorType>
556  const std::string& name,
557  const std::string& description,
558  const std::string& delimiter,
560  {
561  std::string appendedDescription =
562  eigenVectorPropertyDescription(description, EigenVectorType::SizeAtCompileTime,
563  delimiter);
564 
565  PropertyDefinition<EigenVectorType>& def = defineRequiredProperty<EigenVectorType>(
566  name, appendedDescription, constness);
567 
568  // set a factory
569  def.setFactory([delimiter](std::string string) -> EigenVectorType
570  {
571  return eigenVectorFactoryFunction<EigenVectorType>(string, delimiter);
572  });
573  def.setCaseInsensitive(true);
574 
575  return def;
576  }
577 
578 
579  template<typename EigenVectorType>
582  const std::string& name,
583  EigenVectorType defaultValue,
584  const std::string& description,
585  const std::string& delimiter,
587  {
588  std::string appendedDescription =
589  eigenVectorPropertyDescription(description, EigenVectorType::SizeAtCompileTime,
590  delimiter);
591 
592  PropertyDefinition<EigenVectorType>& def = defineOptionalProperty<EigenVectorType>(
593  name, defaultValue, appendedDescription, constness);
594 
595  // set a factory
596  def.setFactory([delimiter](std::string string) -> EigenVectorType
597  {
598  return eigenVectorFactoryFunction<EigenVectorType>(string, delimiter);
599  });
600  // map the default value
601  def.map(eigenVectorToString<EigenVectorType>(defaultValue, delimiter), defaultValue);
602  def.setCaseInsensitive(true);
603 
604  return def;
605  }
606 
607 
608  template <typename PropertyType>
611  {
612  // check definition existance
613  if (definitions.find(name) == definitions.end())
614  {
615  std::stringstream ss;
616  ss << name + " property is not defined. Defined are ";
617  for (typename DefinitionContainer::iterator it = definitions.begin(); it != definitions.end(); ++it)
618  {
619  ss << "\n" << it->first;
620  }
621  throw armarx::LocalException(ss.str());
622  }
623 
624  PropertyDefinitionBase* def = definitions[name];
625 
626  // check definition type
627  if (def->getTypeIdName().compare(typeid(PropertyType).name()) != 0)
628  {
629  throw armarx::LocalException(
630  std::string("Calling getProperty<T>() for the property '")
631  + name
632  + "' with wrong property type [note: "
633  + typeid(PropertyType).name()
634  + " instead of "
635  + def->getTypeIdName()
636  + "]");
637  }
638 
639  // retrieve and down cast the requested definition
640  return *dynamic_cast< PropertyDefinition<PropertyType>* >(def);
641  }
642 
643 
644  template<typename EigenVectorType>
646  std::string string, std::string delim)
647  {
648  using Scalar = typename EigenVectorType::Scalar;
649 
650  long size = EigenVectorType::SizeAtCompileTime;
651  bool isFixedSize = size >= 0; // Eigen::Dynamic is -1.
652 
653  const std::vector<std::string> stringScalars = split(string, delim, true);
654 
655  std::vector<Scalar> scalars;
656  if (isFixedSize)
657  {
658  if (stringScalars.size() != static_cast<std::size_t>(size))
659  {
660  throw std::bad_cast();
661  }
662  scalars.reserve(size);
663  }
664  for (const auto& scalarStr : stringScalars)
665  {
666  // May throw boost::bad_lexical_cast (derives from std::bad_cast).
667  Scalar value = PropertyDefinition_lexicalCastTo<Scalar>(scalarStr);
668  scalars.push_back(value);
669  }
670 
671  EigenVectorType vector;
672  if (!isFixedSize)
673  {
674  vector.resize(scalars.size());
675  }
676  // Write values.
677  for (std::size_t i = 0; i < scalars.size(); ++i)
678  {
679  vector(i) = scalars[i];
680  }
681  return vector;
682  }
683 
684 
685  template<typename EigenVectorType>
687  const EigenVectorType& vector, std::string delim)
688  {
689  std::stringstream ss;
690  long size = vector.size();
691 
692  ss << vector(0);
693  for (int i = 1; i < size; ++i)
694  {
695  ss << delim << vector(i);
696  }
697 
698  return ss.str();
699  }
700 
701 
702 }
armarx::PropertyDefinitionContainer::eigenVectorFactoryFunction
static EigenVectorType eigenVectorFactoryFunction(std::string string, std::string delim)
Parses string to an Eigen vector of type EigenVectorType.
Definition: PropertyDefinitionContainer.h:645
armarx::PropertyDefinitionContainer::setPrefix
void setPrefix(std::string prefix)
Definition: PropertyDefinitionContainer.cpp:202
armarx::PropertyDefinitionContainer::getDescription
std::string getDescription() const
Returns the detailed description of the property user.
Definition: PropertyDefinitionContainer.cpp:192
armarx::PropertyDefinitionContainer::getProperties
Ice::PropertiesPtr getProperties()
Definition: PropertyDefinitionContainer.cpp:124
armarx::PropertyDefinitionBase
Common interface of any property definition.
Definition: PropertyDefinitionInterface.h:51
armarx::PropertyDefinitionContainer::setProperties
void setProperties(Ice::PropertiesPtr properties)
Definition: PropertyDefinitionContainer.cpp:130
armarx::PropertyDefinitionContainer::setDescription
void setDescription(const std::string &description)
Sets the detailed description of the property user.
Definition: PropertyDefinitionContainer.cpp:197
armarx::PropertyDefinitionContainer::defineRequiredProperty
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Definition: PropertyDefinitionContainer.h:516
LocalException.h
armarx::PropertyDefinitionContainer::defineOptionalProperty
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Definition: PropertyDefinitionContainer.h:533
armarx::PropertyDefinitionBase::PropertyConstness
PropertyConstness
Definition: PropertyDefinitionInterface.h:54
armarx::PropertyDefinitionContainer::hasDefinition
bool hasDefinition(const std::string &name) const
Definition: PropertyDefinitionContainer.h:259
armarx::ProxyType::component
@ component
armarx::PropertyDefinitionContainer::writeValues
void writeValues()
Definition: PropertyDefinitionContainer.cpp:79
armarx::PropertyDefinitionContainer::required
decltype(auto) required(PropertyType &setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Definition: PropertyDefinitionContainer.h:74
armarx::PropertyDefinitionContainer::briefDescription
std::string briefDescription
PropertyUser brief description.
Definition: PropertyDefinitionContainer.h:343
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
PropertyDefinitionFormatter.h
armarx::PropertyDefinitionContainer::eigenVectorPropertyDescription
static std::string eigenVectorPropertyDescription(const std::string &description, long size, std::string delim)
Definition: PropertyDefinitionContainer.cpp:261
armarx::PropertyDefinitionContainer::subscribedTopics
std::vector< std::string > subscribedTopics
Definition: PropertyDefinitionContainer.h:327
armarx::PropertyDefinitionContainer::component
void component(IceInternal::ProxyHandle< PropertyType > &setter, const std::string &default_name="", const std::string &property_name="", const std::string &description="")
Definition: PropertyDefinitionContainer.h:404
armarx::PropertyDefinitionContainer::defineRequiredPropertyVector
PropertyDefinition< EigenVectorType > & defineRequiredPropertyVector(const std::string &name, const std::string &description, char delimiter)
Definition: PropertyDefinitionContainer.h:194
armarx::PropertyDefinitionContainer::topic
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.
Definition: PropertyDefinitionContainer.h:416
IceInternal::Handle< ::Ice::Properties >
armarx::PropertyDefinitionContainer::getValue
std::string getValue(const std::string &name)
Definition: PropertyDefinitionContainer.cpp:218
armarx::PropertyDefinitionContainer::description
std::string description
Property User description.
Definition: PropertyDefinitionContainer.h:338
armarx::PropertyDefinitionContainer::getDefintion
PropertyDefinition< PropertyType > & getDefintion(const std::string &name)
Definition: PropertyDefinitionContainer.h:610
PropertyDefinitionInterface.h
armarx::PropertyDefinitionContainer::defineOptionalPropertyVector
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector(const std::string &name, EigenVectorType defaultValue, const std::string &description, char delimiter, PropertyDefinitionBase::PropertyConstness constness)
Definition: PropertyDefinitionContainer.h:241
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::PropertyDefinitionContainer::definitions
DefinitionContainer definitions
Property definitions container.
Definition: PropertyDefinitionContainer.h:323
armarx::ProxyType::topic
@ topic
armarx::PropertyDefinitionContainer::getProxyDefinitions
std::map< std::string, ProxyPropertyDefinitionBase * > getProxyDefinitions()
Definition: PropertyDefinitionContainer.cpp:111
IceManager.h
armarx::ProxyType
ProxyType
Definition: ProxyPropertyDefinition.h:41
armarx::PropertyDefinitionContainer::proxies
std::map< std::string, ProxyPropertyDefinitionBase * > proxies
Definition: PropertyDefinitionContainer.h:325
armarx::PropertyDefinitionContainer::properties
Ice::PropertiesPtr properties
Definition: PropertyDefinitionContainer.h:345
armarx::PropertyDefinitionContainer::getDefinitionBase
PropertyDefinitionBase * getDefinitionBase(const std::string &name)
Definition: PropertyDefinitionContainer.cpp:137
IceInternal
Definition: InstrumentationI.h:16
armarx::PropertyDefinitionContainer
PropertyDefinitionContainer.
Definition: PropertyDefinitionContainer.h:53
armarx::PropertyDefinitionContainer::getPropertyValues
std::map< std::string, std::string > getPropertyValues(const std::string &prefix="") const
Definition: PropertyDefinitionContainer.cpp:230
armarx::PropertyDefinitionContainer::requiredOrOptional
decltype(auto) requiredOrOptional(bool isRequired, PropertyType &setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
armarx::PropertyDefinitionContainer::writeProxyValues
void writeProxyValues(IceManagerPtr)
Definition: PropertyDefinitionContainer.cpp:92
armarx::PropertyDefinitionContainer::getSubscribedTopicDefinitions
std::vector< std::string > getSubscribedTopicDefinitions()
Definition: PropertyDefinitionContainer.cpp:118
armarx::PropertyDefinitionContainer::defineOptionalPropertyVector
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: PropertyDefinitionContainer.h:581
armarx::PropertyDefinitionContainer::optional
decltype(auto) optional(PropertyType &setter, const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Definition: PropertyDefinitionContainer.h:84
std
Definition: Application.h:66
IceUtil::Handle< IceManager >
armarx::PropertyDefinitionContainer::DefinitionContainer
std::map< std::string, PropertyDefinitionBase * > DefinitionContainer
Definition: PropertyDefinitionContainer.h:58
Scalar
float Scalar
Definition: basic.h:14
IceInternal::ProxyHandle
Definition: ObjectPoseClientWidget.h:39
armarx::PropertyDefinitionContainer::isPropertySet
bool isPropertySet(const std::string &name)
Definition: PropertyDefinitionContainer.cpp:212
armarx::PropertyDefinitionContainer::defineOptionalPropertyVector
PropertyDefinition< EigenVectorType > & defineOptionalPropertyVector(const std::string &name, EigenVectorType defaultValue, const std::string &description, char delimiter)
Definition: PropertyDefinitionContainer.h:248
armarx::PropertyDefinitionContainer_ice_class_name
std::string PropertyDefinitionContainer_ice_class_name(std::string const &full_type_name)
Definition: PropertyDefinitionContainer.cpp:280
armarx::PropertyDefinitionContainer::eigenVectorToString
static std::string eigenVectorToString(const EigenVectorType &vector, std::string delim)
Definition: PropertyDefinitionContainer.h:686
armarx::PropertyDefinitionContainer::getPrefix
std::string getPrefix()
Definition: PropertyDefinitionContainer.cpp:207
armarx::PropertyDefinition::setCaseInsensitive
PropertyDefinition< PropertyType > & setCaseInsensitive(bool isCaseInsensitive)
Sets whether the property value matching is case insensitive.
Definition: PropertyDefinition.hpp:150
ProxyPropertyDefinition.h
armarx::PropertyDefinitionContainer::~PropertyDefinitionContainer
~PropertyDefinitionContainer() override
Definition: PropertyDefinitionContainer.cpp:62
armarx::PropertyDefinitionContainer::PropertyDefinitionContainer
PropertyDefinitionContainer(const std::string &prefix)
Definition: PropertyDefinitionContainer.cpp:54
armarx::PropertyDefinition::setFactory
PropertyDefinition< PropertyType > & setFactory(const PropertyFactoryFunction &func)
Sets the factory function that creates the specified template type from the actual string value.
Definition: PropertyDefinition.hpp:140
armarx::PropertyDefinitionFormatter
PropertyDefinitionFormatter is the base class for all formatters of PropertyDefinitions.
Definition: PropertyDefinitionFormatter.h:38
armarx::PropertyDefinition
PropertyDefinition defines a property that will be available within the PropertyUser.
Definition: PropertyDefinition.h:107
armarx::PropertyDefinitionContainer::defineRequiredPropertyVector
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: PropertyDefinitionContainer.h:555
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
PropertyDefinition.h
armarx::PropertyDefinition::map
PropertyDefinition< PropertyType > & map(const std::string &valueString, PropertyType value)
Maps a string value onto a value of the specified template type.
Definition: PropertyDefinition.hpp:95
armarx::PropertyDefinitionContainer::toString
std::string toString(PropertyDefinitionFormatter &formatter)
Definition: PropertyDefinitionContainer.cpp:150
armarx::split
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
Definition: StringHelpers.cpp:36
armarx::PropertyDefinitionBase::eConstant
@ eConstant
Definition: PropertyDefinitionInterface.h:56