MachineIntelligenceCore:Toolchain
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mic::configuration::Property< T, Translator > Class Template Reference

Template class for storing properties. More...

#include <Property.hpp>

Inheritance diagram for mic::configuration::Property< T, Translator >:
Collaboration diagram for mic::configuration::Property< T, Translator >:

Public Member Functions

 Property (const std::string &name_, const T &initializer_=T(), std::string type_=typeid(T).name())
 
operator() () const
 
operator() (T const &value_)
 
 operator T () const
 
Property< T > & operator= (T const &value_)
 
bool operator== (T const &value_)
 
bool operator!= (T const &value_)
 
virtual void setValue (const std::string &str)
 
virtual std::string getValue ()
 
std::string type () const
 
- Public Member Functions inherited from mic::configuration::PropertyInterface
 PropertyInterface (const std::string &name_)
 
virtual ~PropertyInterface ()
 
const std::string & name () const
 

Protected Attributes

property_value
 Actual property value. More...
 
std::string property_type
 Type of the property. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Property &prop)
 

Detailed Description

template<class T, class Translator = LexicalTranslator<T>>
class mic::configuration::Property< T, Translator >

Template class for storing properties.

Author
tkornuta

Definition at line 133 of file Property.hpp.

Constructor & Destructor Documentation

template<class T, class Translator = LexicalTranslator<T>>
mic::configuration::Property< T, Translator >::Property ( const std::string &  name_,
const T &  initializer_ = T(),
std::string  type_ = typeid(T).name() 
)
inline

Default constructor, sets name, type and sets value (calls default type constructor).

Parameters
name
initializer
type

Definition at line 141 of file Property.hpp.

Member Function Documentation

template<class T, class Translator = LexicalTranslator<T>>
virtual std::string mic::configuration::Property< T, Translator >::getValue ( )
inlinevirtual

Returns the string representing the current value.

Returns
string representation of current value.

Implements mic::configuration::PropertyInterface.

Definition at line 213 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
mic::configuration::Property< T, Translator >::operator T ( ) const
inline

Returns property value.

Returns
Current value

Definition at line 167 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
bool mic::configuration::Property< T, Translator >::operator!= ( T const &  value_)
inline

Compares the value of the property with a given value.

Parameters
valueCompared value.
Returns
True is different.

Definition at line 195 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
T mic::configuration::Property< T, Translator >::operator() ( ) const
inline

Access the data with function call syntax.

Definition at line 149 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
T mic::configuration::Property< T, Translator >::operator() ( T const &  value_)
inline

Sets new value (with operator ()) and returns current value.

Parameters
Newvalue
Returns
Current value

Definition at line 158 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
Property<T>& mic::configuration::Property< T, Translator >::operator= ( T const &  value_)
inline

Sets new property value.

Parameters
value_New value to be set.
Returns
Current value

Definition at line 176 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
bool mic::configuration::Property< T, Translator >::operator== ( T const &  value_)
inline

Compares the value of the property with given value.

Parameters
value_Compared value
Returns
True is equal.

Definition at line 186 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
virtual void mic::configuration::Property< T, Translator >::setValue ( const std::string &  str)
inlinevirtual

Sets value on a basis of a string (with the use of translator).

Parameters
strString to retrieve value from.

Implements mic::configuration::PropertyInterface.

Definition at line 204 of file Property.hpp.

template<class T, class Translator = LexicalTranslator<T>>
std::string mic::configuration::Property< T, Translator >::type ( ) const
inline

Returns property type.

Returns
Type.

Definition at line 221 of file Property.hpp.

Friends And Related Function Documentation

template<class T, class Translator = LexicalTranslator<T>>
std::ostream& operator<< ( std::ostream &  os,
const Property< T, Translator > &  prop 
)
friend

Overloaded stream operator.

Parameters
osStream
prop
Returns
Property.

Definition at line 232 of file Property.hpp.

Member Data Documentation

template<class T, class Translator = LexicalTranslator<T>>
std::string mic::configuration::Property< T, Translator >::property_type
protected

Type of the property.

Definition at line 242 of file Property.hpp.

Referenced by mic::configuration::Property< bool >::type().


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