COOLFluiD
Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
|
Adds fonctionnalities to Property
class.
More...
#include <Option.hpp>
Inherits TaggedObject.
Inherited by OptionArray< TYPE >, OptionComponent< T >, OptionT< TYPE >, and OptionT< URI >.
Public Types | |
typedef boost::function< void() > | TriggerT |
Typedef for trigger functions. More... | |
typedef Uint | TriggerID |
ID for triggers. More... | |
typedef std::map< TriggerID, TriggerT > | TriggerStorageT |
Typedef for trigger functions storage. More... | |
Public Member Functions | |
Option (const std::string &name, boost::any def) | |
virtual | ~Option () |
Desctructor. More... | |
template<typename TYPE > | |
TYPE | value () const |
Casts the value to the provided TYPE. More... | |
template<typename OPTION_TYPE > | |
OPTION_TYPE & | cast_to () |
template<typename OPTION_TYPE > | |
const OPTION_TYPE & | cast_to () const |
Option & | pretty_name (const std::string &pretty_name) |
Sets the option pretty name. More... | |
Option & | description (const std::string &description) |
Sets the option description. More... | |
Option & | separator (const std::string &separator) |
Sets the option operator. The separator is used in some convertions to string to separate items, i.e. the restricted list of values or the option value if it is an array. More... | |
void | set (XML::XmlNode &node) |
configure this option using the passed xml node More... | |
Option & | attach_trigger (TriggerT trigger) |
TriggerID | attach_trigger_tracked (TriggerT trigger) |
Attach a trigger, returning an ID that can be used to detach again. More... | |
void | detach_trigger (const TriggerID trigger_id) |
Detach the given trigger. More... | |
std::string | name () const |
std::string | pretty_name () const |
std::string | description () const |
std::string | separator () const |
Option & | operator= (const boost::any &new_value) |
template<typename TYPE > | |
Option & | link_to (TYPE *par) |
Option & | link_option (const boost::shared_ptr< common::Option > &linked) |
Link another option to this option. More... | |
Option & | mark_basic () |
virtual void | change_value (const boost::any &value) |
change the value of this option More... | |
std::vector< boost::any > & | restricted_list () |
Gives a reference to the restricted list. More... | |
const std::vector< boost::any > & | restricted_list () const |
Gives a const reference to the restricted list. More... | |
virtual std::string | restricted_list_str () const =0 |
Return the restricted list as string. More... | |
virtual void | set_restricted_list_str (const std::vector< std::string > &list)=0 |
Set the restricted list using a vector of strings. More... | |
virtual bool | has_restricted_list () const |
Checks whether the option has a list of restricted values. More... | |
void | trigger () const |
Calls the triggers connected to this option. More... | |
void | restore_default () |
restore the default value of the option More... | |
VIRTUAL FUNCTIONS | |
virtual std::string | value_str () const =0 |
virtual boost::any | value () const |
virtual std::string | type () const |
virtual std::string | element_type () const |
Public Member Functions inherited from TaggedObject | |
TaggedObject () | |
Constructor. More... | |
bool | has_tag (const std::string &tag) const |
void | add_tag (const std::string &tag) |
std::vector< std::string > | get_tags () const |
void | remove_tag (const std::string &tag) |
Protected Attributes | |
boost::any | m_value |
storage of the value of the option More... | |
std::vector< boost::any > | m_linked_params |
parameters that also get updated when option is changed More... | |
std::vector< Handle< Option > > | m_linked_opts |
options that also get updated when option is changed More... | |
Private Member Functions | |
virtual void | copy_to_linked_params (std::vector< boost::any > &linked_params)=0 |
copy the configured update value to all linked parameters More... | |
void | copy_to_linked_options () |
virtual boost::any | extract_configured_value (XML::XmlNode &node)=0 |
virtual void | change_value_impl (const boost::any &value)=0 |
Concrete implementation of the value changing. More... | |
Private Attributes | |
boost::any | m_default |
storage of the default value of the option More... | |
std::string | m_name |
option name More... | |
std::string | m_pretty_name |
option pretty name More... | |
std::string | m_description |
option description More... | |
TriggerStorageT | m_triggers |
list of processors that will process the option More... | |
std::vector< boost::any > | m_restricted_list |
Restricted list of values. More... | |
std::string | m_separator |
Option separator. More... | |
Uint | m_current_connection_id |
Current connection ID for the triggers. More... | |
Adds fonctionnalities to Property
class.
An option is a piece of data of which user can modify the value. An option provides:
mark_basic()
method. restricted_list()
method. Values can be added using Boost.Assign library. Note that this list always contains at least one value: the default one. attach_trigger()
method. Triggers take no parameter and return nothing.Definition at line 76 of file Option.hpp.
ID for triggers.
Definition at line 83 of file Option.hpp.
typedef std::map< TriggerID, TriggerT > TriggerStorageT |
Typedef for trigger functions storage.
Definition at line 85 of file Option.hpp.
typedef boost::function< void() > TriggerT |
Typedef for trigger functions.
Definition at line 81 of file Option.hpp.
Option | ( | const std::string & | name, |
boost::any | def | ||
) |
Constructor.
name | Option name. |
def | Default value. |
Definition at line 19 of file Option.cpp.
|
virtual |
Desctructor.
Definition at line 32 of file Option.cpp.
attach a function that will be triggered when an option gets configured
Definition at line 46 of file Option.cpp.
Option::TriggerID attach_trigger_tracked | ( | Option::TriggerT | trigger | ) |
Attach a trigger, returning an ID that can be used to detach again.
Definition at line 54 of file Option.cpp.
|
inline |
Definition at line 114 of file Option.hpp.
|
inline |
Definition at line 120 of file Option.hpp.
|
virtual |
change the value of this option
Definition at line 89 of file Option.cpp.
|
privatepure virtual |
Concrete implementation of the value changing.
Implemented in OptionArray< TYPE >, OptionComponent< T >, OptionT< TYPE >, OptionT< URI >, and OptionURI.
|
private |
Definition at line 108 of file Option.cpp.
|
privatepure virtual |
copy the configured update value to all linked parameters
Implemented in OptionComponent< T >, OptionArray< TYPE >, OptionT< TYPE >, and OptionT< URI >.
Option & description | ( | const std::string & | description | ) |
Sets the option description.
pretty_name | The option description. |
Definition at line 148 of file Option.cpp.
|
inline |
Definition at line 179 of file Option.hpp.
void detach_trigger | ( | const TriggerID | trigger_id | ) |
Detach the given trigger.
Definition at line 64 of file Option.cpp.
|
virtual |
Reimplemented in OptionArray< TYPE >.
Definition at line 141 of file Option.cpp.
|
privatepure virtual |
Get the value to use from XML
node | XML node with data for this option |
Implemented in OptionComponent< T >, OptionArray< TYPE >, OptionT< TYPE >, and OptionT< URI >.
|
inlinevirtual |
Checks whether the option has a list of restricted values.
true
if the option a such list; otherwise, returns false
. Definition at line 229 of file Option.hpp.
Option & link_option | ( | const boost::shared_ptr< common::Option > & | linked | ) |
Link another option to this option.
so that when this option is changed, the other option will be changed as well
Definition at line 100 of file Option.cpp.
|
inline |
Link the state of this option to the passed parameter
Definition at line 192 of file Option.hpp.
Option & mark_basic | ( | ) |
this option is tagged as a basic option on the GUI
Definition at line 80 of file Option.cpp.
|
inline |
Definition at line 173 of file Option.hpp.
Option & operator= | ( | const boost::any & | new_value | ) |
Assigns a new value to the option
new_value | The new value |
Definition at line 72 of file Option.cpp.
Option & pretty_name | ( | const std::string & | pretty_name | ) |
Sets the option pretty name.
pretty_name | The option pretty name. |
Definition at line 156 of file Option.cpp.
|
inline |
Definition at line 176 of file Option.hpp.
|
inline |
restore the default value of the option
Definition at line 235 of file Option.hpp.
|
inline |
Gives a reference to the restricted list.
Definition at line 214 of file Option.hpp.
|
inline |
Gives a const reference to the restricted list.
Definition at line 218 of file Option.hpp.
|
pure virtual |
Return the restricted list as string.
Implemented in OptionComponent< T >, OptionArray< TYPE >, OptionT< TYPE >, OptionT< URI >, and OptionURI.
Option & separator | ( | const std::string & | separator | ) |
Sets the option operator. The separator is used in some convertions to string to separate items, i.e. the restricted list of values or the option value if it is an array.
pretty_name | The option description. |
Definition at line 164 of file Option.cpp.
|
inline |
Definition at line 182 of file Option.hpp.
void set | ( | XML::XmlNode & | node | ) |
configure this option using the passed xml node
Definition at line 38 of file Option.cpp.
|
pure virtual |
Set the restricted list using a vector of strings.
Implemented in OptionComponent< T >, OptionArray< TYPE >, OptionT< TYPE >, and OptionT< URI >.
void trigger | ( | ) | const |
Calls the triggers connected to this option.
Definition at line 121 of file Option.cpp.
|
virtual |
Reimplemented in OptionComponent< T >.
Definition at line 134 of file Option.cpp.
|
inline |
Casts the value to the provided TYPE.
CastingFailed | if the value could not be cast. |
Definition at line 100 of file Option.hpp.
|
inlinevirtual |
Reimplemented in OptionComponent< T >, OptionComponent< T >, OptionArray< TYPE >, and OptionArray< TYPE >.
Definition at line 132 of file Option.hpp.
|
pure virtual |
Implemented in OptionComponent< T >, OptionArray< TYPE >, OptionT< TYPE >, and OptionT< URI >.
|
private |
Current connection ID for the triggers.
Definition at line 262 of file Option.hpp.
|
private |
storage of the default value of the option
Definition at line 247 of file Option.hpp.
|
private |
option description
Definition at line 253 of file Option.hpp.
options that also get updated when option is changed
Definition at line 243 of file Option.hpp.
|
protected |
parameters that also get updated when option is changed
Definition at line 241 of file Option.hpp.
|
private |
option name
Definition at line 249 of file Option.hpp.
|
private |
option pretty name
Definition at line 251 of file Option.hpp.
|
private |
Restricted list of values.
Definition at line 257 of file Option.hpp.
|
private |
Option separator.
Definition at line 259 of file Option.hpp.
|
private |
list of processors that will process the option
Definition at line 255 of file Option.hpp.
|
protected |
storage of the value of the option
Definition at line 239 of file Option.hpp.
Send comments to: COOLFluiD Web Admin |