gatb.core-API-1.4.2
IProperties Class Referenceabstract

Container of IProperty instances with DP Visitor capability. More...

#include <IProperty.hpp>

Inheritance diagram for IProperties:
Inheritance graph

Public Member Functions

virtual void accept (IPropertiesVisitor *visitor)=0
 
virtual IPropertyadd (size_t depth, const std::string &aKey, const char *format=0,...)=0
 
virtual IPropertyadd (size_t depth, const std::string &aKey, const std::string &aValue)=0
 
virtual void add (size_t depth, IProperties *prop)=0
 
virtual void add (size_t depth, const IProperties &prop)=0
 
virtual void merge (IProperties *prop)=0
 
virtual IPropertyoperator[] (const std::string &key)=0
 
virtual IPropertyget (const std::string &key) const =0
 
virtual std::string getStr (const std::string &key) const =0
 
virtual int64_t getInt (const std::string &key) const =0
 
virtual double getDouble (const std::string &key) const =0
 
virtual void setStr (const std::string &key, const std::string &value)=0
 
virtual void setInt (const std::string &key, const int64_t &value)=0
 
virtual void setDouble (const std::string &key, const double &value)=0
 
virtual IPropertiesclone ()=0
 
virtual std::list< IProperties * > map (const char *separator)=0
 
virtual std::set< std::string > getKeys ()=0
 
virtual void setToFront (const std::string &key)=0
 
virtual std::string getXML ()=0
 
virtual void readXML (std::istream &stream)=0
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 

Friends

std::ostream & operator<< (std::ostream &s, const IProperties &p)
 

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

Container of IProperty instances with DP Visitor capability.

This interface merely defines a container of IProperty instances; it contains several 'add' methods for adding IProperty instances into the container.

It is possible to retrieve a specific IProperty instance given a key.

The main method is 'accept'; its purpose is to visit each contained IProperty instance. Note that the only way to iterate the whole IProperty set is to define its own IPropertiesVisitor class and make it accepted by the IProperties instance; the 'visitProperty' method should be then called for each IProperty instance.

It is defined as a SmartPointer for easing instance life cycle management.

See also
IProperty
IPropertiesVisitor

Member Function Documentation

virtual void accept ( IPropertiesVisitor visitor)
pure virtual

Accept a visitor (should loop over all IProperty instances).

Parameters
[in]visitor: visitor to be accepted

Implemented in Properties.

virtual IProperty* add ( size_t  depth,
const std::string &  aKey,
const char *  format = 0,
  ... 
)
pure virtual

Add a IProperty instance given a depth, a key and a value provided in a printf way.

Parameters
[in]depth: depth of the property to be added
[in]aKey: key of the property to be added
[in]format: define the format of the value of the property, the actual value being defined by the ellipsis
Returns
a IProperty instance is created and returned as result of the method.

Implemented in Properties.

virtual IProperty* add ( size_t  depth,
const std::string &  aKey,
const std::string &  aValue 
)
pure virtual

Add a IProperty instance given a depth, a key and a value.

Parameters
[in]depth: depth of the property to be added
[in]aKey: key of the property to be added
[in]aValue: value (as a string) of the property to be added
Returns
a IProperty instance is created and returned as result of the method.

Implemented in Properties.

virtual void add ( size_t  depth,
IProperties prop 
)
pure virtual

Add all the IProperty instances contained in the provided IProperties instance. Note that a depth is provided and is added to the depth of each added IProperty instance.

Parameters
[in]depth: depth to be added to each depth of added instances.
[in]prop: instance holding IProperty instances to be added

Implemented in Properties.

virtual void add ( size_t  depth,
const IProperties prop 
)
pure virtual

Add all the IProperty instances contained in the provided IProperties instance. Note that a depth is provided and is added to the depth of each added IProperty instance.

Parameters
[in]depth: depth to be added to each depth of added instances.
[in]prop: instance holding IProperty instances to be added

Implemented in Properties.

virtual IProperties* clone ( )
pure virtual

Clone the instance

Returns
the cloned instance.

Implemented in Properties.

virtual IProperty* get ( const std::string &  key) const
pure virtual

Returns the IProperty instance given a key.

Parameters
[in]key: the key
Returns
the IProperty instance if found, 0 otherwise.

Implemented in Properties.

virtual double getDouble ( const std::string &  key) const
pure virtual

Get the value of a property given its key.

Parameters
[in]key: the key of the property
Returns
the value of the key as a double.

Implemented in Properties.

virtual int64_t getInt ( const std::string &  key) const
pure virtual

Get the value of a property given its key.

Parameters
[in]key: the key of the property
Returns
the value of the key as an integer

Implemented in Properties.

virtual std::set<std::string> getKeys ( )
pure virtual

Get the known keys.

Returns
the set of keys

Implemented in Properties.

virtual std::string getStr ( const std::string &  key) const
pure virtual

Get the value of a property given its key.

Parameters
[in]key: the key of the property
Returns
the value of the key as a string.

Implemented in Properties.

virtual std::string getXML ( )
pure virtual

Get the properties as an XML string

Returns
the XML string.

Implemented in Properties.

virtual std::list<IProperties*> map ( const char *  separator)
pure virtual

Distribute arguments that are comma separated list.

Returns
the list of distributed IProperties instances.

Implemented in Properties.

virtual void merge ( IProperties prop)
pure virtual

Merge the IProperty instances contained in the provided IProperties instance.

Parameters
[in]prop: instance holding IProperty instances to be added

Implemented in Properties.

virtual IProperty* operator[] ( const std::string &  key)
pure virtual

Returns the IProperty instance given a key.

Parameters
[in]key: the key
Returns
the IProperty instance if found, 0 otherwise.

Implemented in Properties.

virtual void readXML ( std::istream &  stream)
pure virtual

Fill a Properties instance from an XML stream.

Parameters
[in]streamthe stream to be read (file, string...)

Implemented in Properties.

virtual void setDouble ( const std::string &  key,
const double &  value 
)
pure virtual

Set the value of a property given its key.

Parameters
[in]key: the key of the property
[in]value: value to be set.

Implemented in Properties.

virtual void setInt ( const std::string &  key,
const int64_t &  value 
)
pure virtual

Set the value of a property given its key.

Parameters
[in]key: the key of the property
[in]value: value to be set.

Implemented in Properties.

virtual void setStr ( const std::string &  key,
const std::string &  value 
)
pure virtual

Set the value of a property given its key.

Parameters
[in]key: the key of the property
[in]value: value to be set.

Implemented in Properties.

virtual void setToFront ( const std::string &  key)
pure virtual

Move the item (given its key) to the front of the container.

Parameters
[in]key: the key of the item to be moved.

Implemented in Properties.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const IProperties p 
)
friend

Output the properties object through an output stream

Parameters
[in]s: the output stream
[in]p: the properties object to output
Returns
the modified output stream

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