#include <propertylist.h>
Public Types | |
typedef std::vector< std::pair< std::string, std::string > > | StringPairList |
typedef std::vector< std::string > | list_string |
typedef std::vector< int > | vector_int |
typedef std::vector< double > | vector_double |
enum | p_type { bool_t, int_t, unsigned_t, double_t, complex_t, string_t, list_string_t, enum_t, sequencelength_t, vector_octal_int_t, vector_double_t, octal_int_t } |
Public Member Functions | |
Property (const std::string &name, p_type type, const std::string &default_value="", const std::string &description="", const StringPairList &possible_values=StringPairList(), bool enable_empty_default=false, bool obsolete=false, const std::string &grouping="") | |
Property (const Property &p) | |
Property () | |
~Property () | |
template<> | |
void | setValue (const bool &value) |
template<> | |
void | setValue (const int &value) |
template<> | |
void | setValue (const unsigned &value) |
template<> | |
void | setValue (const double &value) |
template<> | |
void | setValue (const Complex &value) |
template<> | |
void | setValue (const std::string &value) |
template<> | |
void | setValue (const list_string &value) |
template<> | |
void | setValue (const vector_int &value) |
template<> | |
void | setValue (const vector_double &value) |
template<> | |
const bool & | getValue (const bool &dummyargument) const |
template<> | |
const int & | getValue (const int &dummyargument) const |
template<> | |
const unsigned & | getValue (const unsigned &dummyargument) const |
template<> | |
const double & | getValue (const double &dummyargument) const |
template<> | |
const Complex & | getValue (const Complex &dummyargument) const |
template<> | |
const std::string & | getValue (const std::string &dummyargument) const |
template<> | |
const list_string & | getValue (const list_string &dummyargument) const |
template<> | |
const vector_int & | getValue (const vector_int &dummyargument) const |
template<> | |
const vector_double & | getValue (const vector_double &dummyargument) const |
Information | |
const std::string & | getName () const |
p_type | getType () const |
const std::string & | getDefault_value () const |
const std::string & | getDescription () const |
bool | hasDefault () const |
bool | isSet () const |
bool | hasEmptyDefaultEnabled () const |
const StringPairList & | getPossibleValues () const |
bool | obsolete () const |
const std::string & | grouping () const |
Type-correct getter/setter | |
template<class T> | |
void | setValue (const T &value) |
template<class T> | |
const T & | getValue (MSVC_WORKAROUND(const T &dummyargument=0)) const |
String getter/setter | |
void | setValueStr (const std::string &v) |
std::string | getValueStr () const |
std::string | toString () const |
Static Public Member Functions | |
static const char * | p_type_toString (p_type t) |
static p_type | string_to_p_type (const std::string &t) |
static list_string | supported_types () |
static list_string | string_to_list (const std::string &s) |
Classes | |
union | value_u |
A property is the mechanism to configure a Device's behaviour in a concrete simulation setup. A property has a name and a value and some more characteristics, and the value adjusts the actual behaviour of the Device at run time.
More precisely: A property has a name, a type, a default value and a description. Type-correct (template) functions for setting and getting the value are provided. The definition of all properties of a Device should be done in the devicelist XML files. The values for these properties are then filled in from the parameter file by the SimulationSystem when the concrete simulation is set up.
If you want to add another supported type, you need to do the following steps: 1. Add flag to p_type
and union member to value_u
; 2. Add specializations to the getValue()
, setValue()
members (below); 3. Add entries for your new type to the static functions supported_types(), string_to_p_type(), p_type_toString(); 4. Scan all member function implementations for the switch(type_)
statement (including constructor, *copy constructor*, and destructor) and add handling of your type accordingly.
|
To save typing and avoid ambiguities: The type for a list/vector of string pairs. |
|
To save typing and avoid ambiguities: The type for a list of strings. |
|
To save typing and avoid ambiguities: The type for a vector of int's. |
|
To save typing and avoid ambiguities: The type for a vector of double's. |
|
The type flags for the different types that a property can be. If you access this Property's value i.e. call
|
|
Constructor.
|
|
Copy constructor. Creates a by-value copy. |
|
Default constructor -- needed for instantiating a std::map of this. |
|
Destructor. |
|
Returns the name (the identifier) of this property. |
|
Returns the type flag of this property. |
|
Returns the default value of this property. If it doesn't have one, this returns the empty string. |
|
Returns the description of this property. |
|
Returns true if this property has a valid default value. This is the case either if a non-empty default string has been specified, or if the attribute enable_empty_default has been set to true. |
|
Returns true if this property was set to a certain value. Returns false if this property is still at its default setting. |
|
Returns true if this property's default value is allowed to be the empty string. If false (default), then 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. That behaviour can be overridden if this boolean has been set to true. |
|
Returns the list of possible values, if there are any. See the comment in the constructor: This is a list of possible values for this property. Each list element is a pair of strings; the first string in the pair is the possible value itself (similar to default_value), and the second string is the explanation for this value. The meaning of these possible values are as follows: 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. |
|
Whether this Property is marked as obsolete or not. If this is true, the GUI should not show this property, but in order to preserve backward compatibility (for old parameter files) this property still exists. |
|
Returns a string that gives grouping hints for this property inside a long list of properties. |
|
Set this to the given value. If this template function is called with the wrong type is called, this will throw an exception. |
|
Returns the current value. If this template function is called with the wrong type is called, this will throw an exception. This dummyargument needs to be used here because MSVC won't work otherwise. See http://support.microsoft.com/default.aspx?scid=kb;EN-US;240871 |
|
Set this to the given value, parsed from the given string. |
|
Returns the current value as a string. Note: The returned string here can easily be different than the one specified at setValueStr(). It is, however, not (yet) guaranteed that when feeding this string into setValueStr() the value will remain the same. |
|
Returns a description of this property, formatted for usage in the simthetic debugging output. Output includes name, type, and value, but no trailing newline -- you might want to add that manually. |
|
Returns a human-readable type string for the given type flag. |
|
Converts the given human-readable type string into the internal type flag. |
|
Returns a list of all supported type strings. |
|
Splits a space-separated string into a list of strings, separating at each whitespace. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|