COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CNode Class Referenceabstract

Base component adapted to fit the client needs. More...

#include <CNode.hpp>

Inherits Component.

Inherited by NBrowser, NetworkQueue, NGeneric, NJournal, NJournalBrowser, NLink, NLog, NPlugin, NPlugins, NRemoteFSBrowser, NRoot, NScriptEngine, NTree, MyNode, PythonPreCompiler, N3DView, and NPlotXY.

Public Types

enum  Type { STANDARD_NODE = 0, LOCAL_NODE = 1, DEBUG_NODE = 2 }
 Defines the sub-node types. More...
 
- Public Types inherited from Component
typedef ComponentIterator< Componentiterator
 type of the iterator to Component More...
 
typedef ComponentIterator< Component const > const_iterator
 type of the iterator to constant Component More...
 
- Public Types inherited from SignalHandler
typedef std::vector< SignalPtrstorage_t
 storage type for signals More...
 

Public Member Functions

 CNode (const std::string &name, const QString &component_type, Type type)
 
std::string derived_type_name () const
 Component::derived_type_name implementation. More...
 
QString component_type () const
 
Handle< CNodechild (Uint index)
 
virtual QString tool_tip () const =0
 
bool is_local_component () const
 
Type type () const
 
bool is_root ()
 
void set_properties (const common::SignalArgs &node)
 
void set_signals (const common::SignalArgs &node)
 
void modify_options (const QMap< QString, QString > &options)
 Modifies options. More...
 
void list_options (QList< boost::shared_ptr< common::Option > > &list)
 
void list_properties (QMap< QString, QString > &props)
 
void list_signals (QList< ActionInfo > &actions)
 
template<class TYPE >
Handle< const TYPE > castTo () const
 
template<class TYPE >
Handle< TYPE > castTo ()
 
void connect_notifier (QObject *reciever, const char *signal, const char *slot)
 
void add_node (boost::shared_ptr< CNode > node)
 Adds a sub-node. More...
 
void remove_node (const QString &node_name)
 Removes a sub-node. More...
 
CNodeNotifiernotifier () const
 
void list_child_paths (QStringList &list, bool recursive, bool client_node=true) const
 Lists all children paths in a string list. More...
 
void request_signal_signature (const QString &name)
 
void local_signature (const QString &name, common::SignalArgs &node)
 Retrieves the signature of a local signal. More...
 
void finish_setup ()
 
virtual void about_to_be_removed ()
 
Signals
void reply_update_tree (common::SignalArgs &node)
 
void reply_configure (common::SignalArgs &node)
 
void reply_list_content (common::SignalArgs &node)
 
void reply_signal_signature (common::SignalArgs &node)
 Method called when the server replies to a signal. More...
 
- Public Member Functions inherited from Component
 Component (const std::string &name)
 
virtual ~Component ()
 Virtual destructor. More...
 
const std::string & name () const
 Access the name of the component. More...
 
void rename (const std::string &name)
 Rename the component. More...
 
URI uri () const
 Construct the full path. More...
 
void complete_path (URI &path) const
 
Handle< Componentaccess_component (const URI &path) const
 
Handle< Componentaccess_component_checked (const URI &path)
 
Handle< Component const > access_component_checked (const URI &path) const
 
Handle< Componenthandle ()
 Get a handle to the component. More...
 
Handle< Component const > handle () const
 
template<typename ComponentT >
Handle< ComponentT > handle ()
 
template<typename ComponentT >
Handle< ComponentT const > handle () const
 
Handle< Componentparent () const
 
Handle< Component const > root () const
 
Handle< Componentroot ()
 
Handle< Componentget_child (const std::string &name)
 
Handle< Component const > get_child (const std::string &name) const
 
Handle< Componentget_child_checked (const std::string &name)
 
Handle< Component const > get_child_checked (const std::string &name) const
 
Handle< Componentcreate_component (const std::string &name, const std::string &builder)
 Build a (sub)component of this component using the extended type_name of the component. More...
 
template<typename T >
Handle< T > create_component (const std::string &name)
 Create a (sub)component of this component automatically cast to the specified type. More...
 
template<typename T >
Handle< T > create_static_component (const std::string &name)
 Create a static "always there" subcomponent. More...
 
Componentadd_component (const boost::shared_ptr< Component > &subcomp)
 Add the passed component as a subcomponent. More...
 
void add_link (Component &linked_component)
 
boost::shared_ptr< Componentremove_component (const std::string &name)
 Remove a (sub)component of this component. More...
 
boost::shared_ptr< Componentremove_component (Component &subcomp)
 Remove a (sub)component of this component. More...
 
void clear ()
 Remove all sub-components of this component, except for the static ones. More...
 
void move_to (Component &to_parent)
 
std::string tree (bool basic_mode=false, Uint depth=0, Uint recursion_level=0) const
 
std::string info (const std::string &what=std::string("cospt")) const
 
size_t count_children () const
 
PropertyListproperties ()
 
const PropertyListproperties () const
 
OptionListoptions ()
 
const OptionListoptions () const
 
void reset_options ()
 Reset all options to their default value. More...
 
void configure_option_recursively (const std::string &optname, const boost::any &val)
 
Componentmark_basic ()
 marks this component as basic. More...
 
template<typename ComponentT >
void put_components (std::vector< boost::shared_ptr< ComponentT > > &vec, const bool recurse)
 
template<typename ComponentT >
void put_components (std::vector< boost::shared_ptr< ComponentT const > > &vec, const bool recurse) const
 
template<>
void put_components (std::vector< boost::shared_ptr< Component > > &vec, const bool recurse)
 
template<>
void put_components (std::vector< boost::shared_ptr< Component const > > &vec, const bool recurse) const
 
Component::iterator begin ()
 The begin iterator for a range containing Components. More...
 
Component::iterator end ()
 The end iterator for a range containing Components. More...
 
Component::const_iterator begin () const
 The begin iterator for a range containing Components (const version) More...
 
Component::const_iterator end () const
 The end iterator for a range containing Components (const version) More...
 
Component::iterator recursive_begin ()
 The begin iterator for a recursive range containing Components. More...
 
Component::iterator recursive_end ()
 The end iterator for a recursive range containing Components. More...
 
Component::const_iterator recursive_begin () const
 The begin iterator for a recursive range containing Components (const version) More...
 
Component::const_iterator recursive_end () const
 The end iterator for a recursive range containing Components (const version) More...
 
template<typename T >
Handle< T > create_component (const std::string &name, const std::string &builder)
 Create a component using the reduced builder name. More...
 
void signal_configure (SignalArgs &args)
 configures all the options on this class More...
 
void signal_create_component (SignalArgs &args)
 creates a component from this component More...
 
void signal_delete_component (SignalArgs &args)
 delete this component More...
 
void signal_move_component (SignalArgs &args)
 moves a component from this component to another More...
 
void signal_list_tree (SignalArgs &args) const
 lists the sub components and puts them on the xml_tree More...
 
void signal_list_tree_recursive (SignalArgs &args) const
 prints tree recursively More...
 
void signal_list_properties (SignalArgs &args) const
 lists the properties of this component More...
 
void signal_list_options (SignalArgs &args) const
 lists the properties of this component More...
 
void signal_list_options_recursive (SignalArgs &args) const
 prints all options recursive More...
 
void signal_list_signals (SignalArgs &args) const
 lists the signals of this component More...
 
void signal_list_signals_recursive (SignalArgs &args) const
 prints all signals recursive More...
 
void signal_print_info (SignalArgs &args) const
 gets info on this component More...
 
void signal_print_tree (SignalArgs &args) const
 signal to print the tree More...
 
void signature_print_tree (SignalArgs &args) const
 signature to signal_print_tree More...
 
void signal_rename_component (SignalArgs &args)
 renames this component More...
 
void signal_save_tree (SignalArgs &args)
 dumps the tree to a file More...
 
void signal_list_content (SignalArgs &args)
 gives information about this component such as options, signals, ... More...
 
void signal_signature (SignalArgs &args)
 Gives a signal signature, if any. More...
 
void signature_create_component (SignalArgs &args)
 
void signature_rename_component (SignalArgs &args)
 
void signature_move_component (SignalArgs &args)
 
void signal_store_timings (SignalArgs &args)
 Signal to store the timings (if enabled) into properties, i.e. for readout from python or the GUI. More...
 
void signal_clear (SignalArgs &args)
 Signal to remove all sub-components. More...
 
void signal_reset_options (SignalArgs &args)
 Signal to set all options to their default value. More...
 
void signal_add_tag (SignalArgs &args)
 Signal to add a tag. More...
 
void signature_add_tag (SignalArgs &args)
 
- Public Member Functions inherited from SignalHandler
 ~SignalHandler ()
 
const storage_tsignal_list () const
 
SignalPtr signal (const SignalID &sname)
 
SignalCPtr signal (const SignalID &sname) const
 
SignalRet call_signal (const SignalID &sname, SignalArgs &sinput)
 Calls the signal by providing its name and input. More...
 
SignalRet call_signal (const SignalID &sname, std::vector< std::string > &sinput)
 Calls the signal by providing its name and input. More...
 
bool signal_exists (const SignalID &sname) const
 Checks if a signal exists or not. More...
 
Signalregist_signal (const SignalID &sname)
 Regist signal. More...
 
void unregist_signal (const SignalID &sname)
 Unregist signal. More...
 
- Public Member Functions inherited from ConnectionManager
 ~ConnectionManager ()
 destructor closes all connections More...
 
Connectionconnection (const std::string &name)
 
Connectionmanage_connection (const std::string &name)
 manages a connection (creates if necessary) More...
 
- 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)
 

Static Public Member Functions

static std::string type_name ()
 
static boost::shared_ptr< CNodecreate_from_xml (common::XML::XmlNode node)
 Creates an object tree from a given node. More...
 
- Static Public Member Functions inherited from Component
static std::string type_name ()
 Get the class name. More...
 

Protected Member Functions

virtual void disable_local_signals (QMap< QString, bool > &local_signals) const =0
 
virtual void setup_finished ()
 
- Protected Member Functions inherited from Component
Componentadd_static_component (const boost::shared_ptr< Component > &subcomp)
 Add a static (sub)component of this component. More...
 
void raise_tree_updated_event ()
 raise event that the path has changed More...
 

Protected Attributes

CNodeNotifierm_notifier
 This internal notifier. More...
 
QStringList m_local_signals
 Lists the names of the local signals. More...
 
QMutex * m_mutex
 
bool m_content_listed
 
bool m_listing_content
 
bool m_is_root
 
QList< ActionInfom_action_sigs
 List of signals that can be remotely executed. More...
 

Private Member Functions

void fetch_content ()
 

Static Private Member Functions

static boost::shared_ptr< CNodecreate_from_xml_recursive (common::XML::XmlNode &node, QMap< boost::shared_ptr< NLink >, common::URI > &link_targets)
 Creates an object tree from a given node. More...
 

Private Attributes

QString m_component_type
 Component type name. More...
 
CNode::Type m_type
 

Additional Inherited Members

- Public Attributes inherited from SignalHandler
storage_t m_signals
 storage of the signals More...
 

Detailed Description

Base component adapted to fit the client needs.

Every component class created in the client should derive from this class. Each CNode has a special type, that helps a potential model to determine whether it should be showed or hidden, depending on the current modes (debug and/or advanced).
The types are defined by the nested enum CNode::Type. Standard nodes are typically those comming from the server, they are deleted everytime the tree is updated. Local nodes are managed by the client itself to handle some local information, they only exist on the client-side. Debug nodes are local ones, except that they are only visible in debug mode. Local and debug modes exist are not deleted on tree update.

Author
Quentin Gasper

Definition at line 120 of file CNode.hpp.

Member Enumeration Documentation

enum Type

Defines the sub-node types.

Enumerator
STANDARD_NODE 

Standard node.

LOCAL_NODE 

Local node.

DEBUG_NODE 

Local and debug node.

Definition at line 131 of file CNode.hpp.

Constructor & Destructor Documentation

CNode ( const std::string &  name,
const QString &  component_type,
Type  type 
)

Constructor.

Parameters
nameComponent name.
component_typeCorresponding component type name (on the simulator side)
typeNode type.

Definition at line 83 of file CNode.cpp.

Member Function Documentation

virtual void about_to_be_removed ( )
inlinevirtual

Reimplemented in N3DView.

Definition at line 352 of file CNode.hpp.

void add_node ( boost::shared_ptr< CNode node)

Adds a sub-node.

This method is a wrapper for Component::add_component(). It calls the parent method, but emits CNodeNotifier::notifyadvancedModeChanged() on success.It is recommended to add child nodes using this method in order to guarantee the view is correctly updated.

Parameters
nodeNode to add.
Exceptions
common::ValueExistsForwards to the upper level any common::ValueExists exception thrown by Component::add_component()

Definition at line 452 of file CNode.cpp.

Handle<const TYPE> castTo ( ) const
inline

Casts this node to a constant component of type TYPE.

Returns
Returns the cast pointer
Exceptions
CastingFailedif the casting failed.

Definition at line 244 of file CNode.hpp.

Handle<TYPE> castTo ( )
inline

Casts this node to a component of type TYPE.

Returns
Returns the cast pointer
Exceptions
CastingFailedif the casting failed.

Definition at line 257 of file CNode.hpp.

Handle< CNode > child ( cf3::Uint  index)

Gives a child a a certain index.

Parameters
indexIndex of the wanted child. Should be between 0 (included) and count_children() (excluded).
Returns
Returns the found child.

Definition at line 392 of file CNode.cpp.

QString component_type ( ) const

Gives the corresponding component type name

Returns
Returns the corresponding component type name

Definition at line 120 of file CNode.cpp.

void connect_notifier ( QObject *  reciever,
const char *  signal,
const char *  slot 
)

Connects a slot a signal provided by the internal notifier.

Parameters
receiverThe receiver object, The object on which the slot will be called.
signalThe signal.
slotThe slot to connect.
See also
CNodeNotifier

Definition at line 408 of file CNode.cpp.

boost::shared_ptr< CNode > create_from_xml ( common::XML::XmlNode  node)
static

Creates an object tree from a given node.

Parameters
nodeNode to convert
Returns
Retuns a shared pointer to the created node.
Exceptions
XmlErrorIf the tree could not be built.

Definition at line 374 of file CNode.cpp.

boost::shared_ptr< CNode > create_from_xml_recursive ( common::XML::XmlNode node,
QMap< boost::shared_ptr< NLink >, common::URI > &  link_targets 
)
staticprivate

Creates an object tree from a given node.

This is a recursive method. The second parameter holds, for each link the tree, the CPath of the target. The methods proceeds in this way since the target might not exist yet when the link exists. Furthermore, the method does not guarantee that each target path exists (e.i. the target is missing in the XML). It is up to the calling code to make that check.

Parameters
nodeNode to convert
link_targetsMap where links
Returns
Retuns a shared pointer to the created node.
Exceptions
XmlErrorIf the tree could not be built.

Definition at line 596 of file CNode.cpp.

std::string derived_type_name ( ) const
inlinevirtual

Component::derived_type_name implementation.

Implements Component.

Definition at line 155 of file CNode.hpp.

virtual void disable_local_signals ( QMap< QString, bool > &  local_signals) const
protectedpure virtual

Disables the local signals that need to.

Parameters
local_signalsMap of local signals. The map is pre-initialiazed before calling this function with all local signals and the value set to true.

Implemented in NTree, NJournalBrowser, NScriptEngine, NetworkQueue, NRemoteFSBrowser, NLog, NRoot, NPlugins, NLink, NJournal, N3DView, NBrowser, NPlotXY, NGeneric, NPlugin, PythonPreCompiler, and MyNode.

void fetch_content ( )
private

Definition at line 691 of file CNode.cpp.

void finish_setup ( )

Definition at line 366 of file CNode.cpp.

bool is_local_component ( ) const
inline

Indicates whether this node is a client component or not. A node is considered as a client one if its type is either CNode::LOCAL_TYPE or CNode::DEBUB_NODE.

Returns
Returns true if this node is a client component.

Definition at line 178 of file CNode.hpp.

bool is_root ( )
inline

Indicates whether this component is the root or not.

Returns
Returns true if this node is a NRoot component.

Definition at line 192 of file CNode.hpp.

void list_child_paths ( QStringList &  list,
bool  recursive,
bool  client_node = true 
) const

Lists all children paths in a string list.

Strings have the same format as returned by CPath::uri().string().

Parameters
listThe string list where paths will be stored. The list is not cleaned before first use.
recursiveIf true, the listing is recursive. Otherwise, only direct children are listed.
client_nodeIf true, client nodes are included into the the result. Otherwise, they are ignored.

Definition at line 424 of file CNode.cpp.

void list_options ( QList< boost::shared_ptr< common::Option > > &  list)

Gives options

Parameters
optionsReference to a list where options will be put. The list cleared before first use.

Definition at line 507 of file CNode.cpp.

void list_properties ( QMap< QString, QString > &  props)

Gives properties

Parameters
propsReference to a map where properties will be put. The map is cleared before first use.

Definition at line 524 of file CNode.cpp.

void list_signals ( QList< ActionInfo > &  actions)

Gives actions.

Parameters
acttionsReference to a list where actions will be put. The list is cleared before first use.

Definition at line 550 of file CNode.cpp.

void local_signature ( const QString &  name,
common::SignalArgs node 
)

Retrieves the signature of a local signal.

Parameters
nameThe signal name.
nodenode SignalFrame where the signature will be stored.

Definition at line 358 of file CNode.cpp.

void modify_options ( const QMap< QString, QString > &  options)

Modifies options.

If at least one option has been modified, a configure signal is sent to the corresponding component on the server.

Parameters
optionsMap of options to modify. The key is the option name. The value is the new option value, in string format.
Exceptions
BadValueIf an option could not be found or could not be converted to an option.

Definition at line 281 of file CNode.cpp.

CNodeNotifier * notifier ( ) const

Gives the internal notifier.

Returns
Returns the internal notifier.

Definition at line 417 of file CNode.cpp.

void remove_node ( const QString &  node_name)

Removes a sub-node.

This method is a wrapper for Component::remove_component(). It calls the parent method, but emits CNodeNotifier::notify_child_count_changed() on success.It is recommended to remove child nodes using this method in order to guarantee the view is correctly updated.

Parameters
node_nameNode to remove.
Exceptions
common::ValueNotFoundForwards to the upper level any common::ValueNotFound exception thrown by Component::remove_component()

Definition at line 463 of file CNode.cpp.

void reply_configure ( common::SignalArgs node)

Method called when receiving a reply to a previously sent "configure" signal.

Parameters
nodeAn XML representation of the modified options.

Definition at line 474 of file CNode.cpp.

void reply_list_content ( common::SignalArgs node)

Method called when the server replies to a list_content request.

Parameters
nodeSignal data.

Definition at line 487 of file CNode.cpp.

void reply_signal_signature ( common::SignalArgs node)

Method called when the server replies to a signal.

Definition at line 500 of file CNode.cpp.

void reply_update_tree ( common::SignalArgs node)

Method called when a tree_update event occurs on the server. This methods calls NTree::update_tree() method to resquet an update of the tree.

Parameters
nodeSignal data. This parameter is not used.

Definition at line 684 of file CNode.cpp.

void request_signal_signature ( const QString &  name)

Definition at line 670 of file CNode.cpp.

void set_properties ( const common::SignalArgs node)

Sets node properties

Parameters
nodeNode containing the options

Definition at line 127 of file CNode.cpp.

void set_signals ( const common::SignalArgs node)

Sets node signals Those are considered as non-local ones, meaning that asking the node to execute them will result to the sendng of a request to the remote component.

Parameters
nodeNode containing the signals

Definition at line 209 of file CNode.cpp.

virtual void setup_finished ( )
inlineprotectedvirtual

Reimplemented in N3DView, and NPlotXY.

Definition at line 396 of file CNode.hpp.

virtual QString tool_tip ( ) const
pure virtual

Gives the node tooltip.

Returns
Returns the tooltip text.

Implemented in NTree, NJournalBrowser, NRemoteFSBrowser, NetworkQueue, NLog, NPlugins, NJournal, NBrowser, NScriptEngine, NRoot, NGeneric, N3DView, NPlotXY, NLink, PythonPreCompiler, NPlugin, and MyNode.

Type type ( ) const
inline

Gives the node type.

Returns
Returns the type of this node.

Definition at line 185 of file CNode.hpp.

static std::string type_name ( )
inlinestatic

Definition at line 152 of file CNode.hpp.

Member Data Documentation

QList<ActionInfo> m_action_sigs
protected

List of signals that can be remotely executed.

Definition at line 388 of file CNode.hpp.

QString m_component_type
private

Component type name.

Definition at line 381 of file CNode.hpp.

bool m_content_listed
protected

false until the node content has been retrieved from the server.

Definition at line 366 of file CNode.hpp.

bool m_is_root
protected

Indicates whether this component is a NRoot. If true, this component is a NRoot object.

Definition at line 376 of file CNode.hpp.

bool m_listing_content
protected

Idicates whether this node is already waiting for content from the server. This is used to avoid sending multiple requests to the server in case it is overloaded and takes some time to reply.

Definition at line 372 of file CNode.hpp.

QStringList m_local_signals
protected

Lists the names of the local signals.

Definition at line 360 of file CNode.hpp.

QMutex* m_mutex
protected

Definition at line 362 of file CNode.hpp.

CNodeNotifier* m_notifier
protected

This internal notifier.

Definition at line 357 of file CNode.hpp.

CNode::Type m_type
private

Definition at line 383 of file CNode.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin