Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

simth::PropertyList Class Reference

List of properties that configures a device. More...

#include <propertylist.h>

List of all members.

Public Types

typedef std::map< key_type,
Property
map_type
typedef map_type::value_type value_type
typedef map_type::iterator iterator
typedef map_type::const_iterator const_iterator

Public Member Functions

 PropertyList ()
 PropertyList (const PropertyList &)
 ~PropertyList ()
void toStream (std::ostream &os) const
Set/Add values
void addProperty (const std::string &name, const std::string &type, const std::string &default_value="", const std::string &description="", const Property::StringPairList &possible_values=Property::StringPairList(), bool enable_empty_default=false)
void addProperty (const Property &p)
template<class propertyT>
void setProperty (const std::string &name, const propertyT &value)
Value retrieval
template<class propertyT>
const propertyT & getProperty (const std::string &name) const
Propertyget (const std::string &name)
const Propertyget (const std::string &name) const
bool exists (const std::string &name) const
Standard Container Methods
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
bool empty () const
size_t size () const
bool remove (const std::string &name)


Detailed Description

List of properties that configures a device.

This is the complete list of properties that exist in a particular device, and can be used to configure this device in a concrete simulation setup. Each property has a name and a value and some more characteristics, and the value adjusts the actual behaviour of the Device at run time.

In this property list you can look up any property, iterate through all of them, change their values, or add new ones.


Member Typedef Documentation

EXPIMP_TEMPLATE template DLLIMPORT simth::PropertyList::map_type
 

Type of the internal map.

typedef map_type::value_type simth::PropertyList::value_type
 

Type of the values in the map -- that's probably a std::pair<key_type, Property> .

typedef map_type::iterator simth::PropertyList::iterator
 

Iterator.

typedef map_type::const_iterator simth::PropertyList::const_iterator
 

Const iterator.


Constructor & Destructor Documentation

simth::PropertyList::PropertyList  ) 
 

Constructor.

simth::PropertyList::PropertyList const PropertyList  ) 
 

Copy Constructor. Creates a deep (by-value) copy. Expensive for long lists.

simth::PropertyList::~PropertyList  ) 
 

Destructor.


Member Function Documentation

void simth::PropertyList::addProperty const std::string &  name,
const std::string &  type,
const std::string &  default_value = "",
const std::string &  description = "",
const Property::StringPairList possible_values = Property::StringPairList(),
bool  enable_empty_default = false
 

Create a new property in the list.

If a property with that name already exists, an exception will be thrown.

Parameters:
name The name of the new property.
type A string describing the type of the new property. Valid types are returned by the function Property::supportedTypes().
default_value The default value for this property, or the empty string (default) if none should be given.
description The human-readable description of what this property is about.
possible_values A list of possible values for this property. Each list element is a pair of strings; the first string in a pair is the possible value itself (similar to default_value), and the second string is the explanation for this value. Note: In the case of the type enum_t, the actual value of this Property is only allowed to be one out of the possible_value list. For all other types, these possible values are only optional proposals that can be presented to the user by some GUI.
enable_empty_default If true, then allow the empty string to be the default value. If false (default), the empty string will be interpreted such that this Property does not have any default value and the property requires to be set to some value.

void simth::PropertyList::addProperty const Property p  ) 
 

Add a property in the list.

If a property with the same name already exists, an exception will be thrown.

template<class propertyT>
void simth::PropertyList::setProperty const std::string &  name,
const propertyT &  value
[inline]
 

Set a property to the given value of type T.

This will only work if this property already exists (created by addProperty()), otherwise it will throw an error. Also, if the type in the template function does not match the type of this property.

Parameters:
name The name of the property that should be set
value The value that the property should be set to.

template<class propertyT>
const propertyT& simth::PropertyList::getProperty const std::string &  name  )  const [inline]
 

Returns the value of the specified property, of type T. Throws an error if the property doesn't exist, or if the type in the template function does not match the type of this property.

Parameters:
name The name of the property
Returns:
The value of the specified property

Property& simth::PropertyList::get const std::string &  name  ) 
 

Returns the specified property. Throws an error if it doesn't exist.

const Property& simth::PropertyList::get const std::string &  name  )  const
 

Returns the specified property. Throws an error if it doesn't exist.

bool simth::PropertyList::exists const std::string &  name  )  const
 

Returns true when a property with the specified name exists.

Parameters:
name The name of the property
Returns:
True, if a property with that name exists.

iterator simth::PropertyList::begin  )  [inline]
 

Returns an iterator.

const_iterator simth::PropertyList::begin  )  const [inline]
 

Returns an iterator.

iterator simth::PropertyList::end  )  [inline]
 

Returns an iterator.

const_iterator simth::PropertyList::end  )  const [inline]
 

Returns an iterator.

bool simth::PropertyList::empty  )  const [inline]
 

Returns true if this list is empty.

size_t simth::PropertyList::size  )  const [inline]
 

Returns the size of this list.

bool simth::PropertyList::remove const std::string &  name  ) 
 

Removes the property of the given name from this PropertyList. Returns true if a property was removed, or false if none of this name has been found.

void simth::PropertyList::toStream std::ostream &  os  )  const
 

Writes all properties of this list to the specified output stream, formatted for usage in the simthetic debugging output. Output includes name, type, and value of each property.


Generated on Mon Apr 24 21:19:20 2006 for simthetic by  doxygen 1.4.1