Image Component Library (ICL)
ConfigurableProxy.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLUtils/src/ICLUtils/ConfigurableProxy.h **
10 ** Module : ICLUtils **
11 ** Authors: Viktor Richter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Configurable.h>
35 
36 namespace icl{
37  namespace utils{
38 
41  private:
44 
45  public:
46 
48  virtual ~ConfigurableProxy(){}
49 
52 
57  }
58 
62  ICLASSERT_THROW(m_intConfigurable,ICLException("ConfigurableProxy: internal Configurable is null"));
63  return m_intConfigurable;
64  }
65 
67  void setPropertyValue(const std::string &propertyName, const Any &value) {
68  getInternalConfigurable() -> setPropertyValue(propertyName, value);
69  }
70 
72  std::vector<std::string> getPropertyList() const{
74  }
75 
77  bool supportsProperty(const std::string &propertyName) const{
78  return getInternalConfigurable() -> supportsProperty(propertyName);
79  }
80 
82  void saveProperties(const std::string &filename, const std::vector<std::string> &propertiesToSkip=Configurable::EMPTY_VEC) const{
83  getInternalConfigurable() -> saveProperties(filename, propertiesToSkip);
84  }
85 
87  void loadProperties(const std::string &filename,const std::vector<std::string> &propertiesToSkip=Configurable::EMPTY_VEC){
88  getInternalConfigurable() -> loadProperties(filename, propertiesToSkip);
89  }
90 
91  void addChildConfigurable(Configurable *configurable, const std::string &childPrefix=""){
92  getInternalConfigurable() -> addChildConfigurable(configurable,childPrefix);
93  }
94 
95 
98  }
99 
101  std::string getPropertyType(const std::string &propertyName) const{
102  return getInternalConfigurable() -> getPropertyType(propertyName);
103  }
104 
106  std::string getPropertyInfo(const std::string &propertyName) const{
107  return getInternalConfigurable() -> getPropertyInfo(propertyName);
108 
109  }
110 
112  Any getPropertyValue(const std::string &propertyName) const{
113  return getInternalConfigurable() -> getPropertyValue(propertyName);
114  }
115 
117  std::string getPropertyToolTip(const std::string &propertyName) const{
118  return getInternalConfigurable() -> getPropertyToolTip(propertyName);
119  }
120 
122  int getPropertyVolatileness(const std::string &propertyName) const{
123  return getInternalConfigurable() -> getPropertyVolatileness(propertyName);
124  }
125 
127  void syncChangesTo(Configurable *configurables, int num=1) {
128  getInternalConfigurable()->syncChangesTo(configurables,num);
129  }
130 
132  void syncChangesTo(ConfigurableProxy *configurable){
134  }
135  };
136  } // namespace utils
137 }
138 
The General Function Template.
Definition: Function.h:284
Any getPropertyValue(const std::string &propertyName) const
returns the current value of a property or a parameter
Definition: ConfigurableProxy.h:112
bool supportsProperty(const std::string &propertyName) const
base implementation for property check (seaches in the property list)
Definition: ConfigurableProxy.h:77
void setPropertyValue(const std::string &propertyName, const Any &value)
sets a property value
Definition: ConfigurableProxy.h:67
void addChildConfigurable(Configurable *configurable, const std::string &childPrefix="")
Definition: ConfigurableProxy.h:91
undocument this line if you encounter any issues!
Definition: Any.h:37
static const std::vector< std::string > EMPTY_VEC
used as shortcut – just an empty vector of std::strings
Definition: Configurable.h:384
Configurable * m_intConfigurable
Definition: ConfigurableProxy.h:43
void setInternalConfigurable(Configurable *c=NULL)
sets the internally used Configurable to the passed one
Definition: ConfigurableProxy.h:54
ConfigurableProxy(Configurable *c=NULL)
Constructor with passed internal Configurable.
Definition: ConfigurableProxy.h:51
This class provides the getter and setter methods of an internally set Configurable.
Definition: ConfigurableProxy.h:40
std::string getPropertyInfo(const std::string &propertyName) const
get information of a properties valid values
Definition: ConfigurableProxy.h:106
Configurable * getInternalConfigurable() const
returns the internally used Configurable
Definition: ConfigurableProxy.h:60
void registerCallback(Configurable::Callback cb)
Definition: ConfigurableProxy.h:96
void syncChangesTo(Configurable *configurables, int num=1)
syncronzies all property changes to the given configurable
Definition: ConfigurableProxy.h:127
void saveProperties(const std::string &filename, const std::vector< std::string > &propertiesToSkip=Configurable::EMPTY_VEC) const
writes all available properties into a file
Definition: ConfigurableProxy.h:82
Interface for classes that can be configured from configuration-files and GUI-Components.
Definition: Configurable.h:194
void syncChangesTo(ConfigurableProxy *configurable)
syncronzies all property changes to the given configurable
Definition: ConfigurableProxy.h:132
std::vector< std::string > getPropertyList() const
returns a list of All properties, that can be set using setProperty
Definition: ConfigurableProxy.h:72
Base class for Exception handling in the ICL.
Definition: Exception.h:42
int getPropertyVolatileness(const std::string &propertyName) const
Returns whether this property may be changed internally.
Definition: ConfigurableProxy.h:122
void loadProperties(const std::string &filename, const std::vector< std::string > &propertiesToSkip=Configurable::EMPTY_VEC)
reads a camera config file from disc
Definition: ConfigurableProxy.h:87
Mutex m_configurableLock
Definition: ConfigurableProxy.h:42
virtual ~ConfigurableProxy()
virtual destructor
Definition: ConfigurableProxy.h:48
std::string getPropertyType(const std::string &propertyName) const
get type of property
Definition: ConfigurableProxy.h:101
Mutex class of the ICL.
Definition: Mutex.h:54
Simple generic data type implementation that uses a string based data representation.
Definition: Any.h:109
Locks a mutex on the stack (mutex is unlocked when the stack's section is released.
Definition: Mutex.h:120
#define ICLASSERT_THROW(X, OBJ)
Definition: Macros.h:155
void syncChangesTo(Configurable *others, int num=1)
this can be used to let this instance also apply property changes to others
std::string getPropertyToolTip(const std::string &propertyName) const
returns the tooltip description for a given property
Definition: ConfigurableProxy.h:117