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

Manages a set of maps. More...

#include <SignalFrame.hpp>

Public Member Functions

 SignalFrame (XmlNode xml=XmlNode())
 
 SignalFrame (boost::shared_ptr< XmlDoc > doc)
 
 SignalFrame (const std::string &target, const URI &sender, const URI &receiver)
 
 ~SignalFrame ()
 Destructor. More...
 
XmlNode set_option (const std::string &value_key, const std::string type_name, const std::string &value_str, const std::string &descr=std::string())
 
XmlNode set_array (const std::string &value_key, const std::string element_type_name, const std::string &value_str, const std::string &delimiter, const std::string &descr=std::string())
 
template<typename TYPE >
TYPE get_option (const std::string &name) const
 
template<typename TYPE >
std::vector< TYPE > get_array (const std::string &name) const
 
bool has_map (const std::string &name) const
 
bool has_entry (const std::string &name) const
 
bool has_reply () const
 
SignalFramemap (const std::string &name)
 
const SignalFramemap (const std::string &name) const
 
SignalFrame create_reply (const URI &sender=URI())
 
SignalFrame get_reply () const
 
void insert (std::vector< std::string > &input)
 Inserts the options, translating them from strings. More...
 
std::string to_script (int indentation=0) const
 Converts this signal to a string in the CF script format. More...
 
std::string to_python_script (int indentation=0) const
 Converts this signal to a string in the CF python script format. More...
 
void flush_maps ()
 Flushes internal SignalOptions maps. More...
 
SignalOptionsoptions (const std::string &name=std::string())
 
const SignalOptionsoptions (const std::string &name=std::string()) const
 

Public Attributes

XmlNode node
 The frame node. More...
 
Map main_map
 The main map. More...
 
boost::shared_ptr< XmlDocxml_doc
 

Private Attributes

std::map< std::string, SignalFramem_maps
 Maps contained in this frame. More...
 
std::map< std::string, SignalOptionsm_options
 

Detailed Description

Manages a set of maps.

Author
Quentin Gasper.

Definition at line 31 of file SignalFrame.hpp.

Constructor & Destructor Documentation

SignalFrame ( XmlNode  xml = XmlNode())

Contructor.

Parameters
xmlThe node to manage.

Definition at line 38 of file SignalFrame.cpp.

SignalFrame ( boost::shared_ptr< XmlDoc doc)

Constructor

Parameters
docThe document the frame is based on.

Definition at line 85 of file SignalFrame.cpp.

SignalFrame ( const std::string &  target,
const URI sender,
const URI receiver 
)

Contructor. Builds a new XML document and adds frame node to it.

Parameters
targetThe signal name.
senderThe sender CPATH.
receiverThe receiver CPATH

Definition at line 138 of file SignalFrame.cpp.

Destructor.

Definition at line 152 of file SignalFrame.cpp.

Member Function Documentation

SignalFrame create_reply ( const URI sender = URI())

Creates a reply to this signal. The reply is created as a sibling node and has the same parent as this frame node.

Parameters
senderThe sender CPATH. If empty, or not a CPATH, the receiver of this frame node is used.
Returns
Returns the created frame.
Exceptions
XmlErrorIf the sender argument is not valid and the receiver could not be found in the frame node.

Definition at line 253 of file SignalFrame.cpp.

void flush_maps ( )

Flushes internal SignalOptions maps.

Definition at line 343 of file SignalFrame.cpp.

std::vector< TYPE > get_array ( const std::string &  name) const

Gets an array from the main map.

Parameters
nameThe array name.
Returns
Returns the array value.

Definition at line 201 of file SignalFrame.cpp.

TYPE get_option ( const std::string &  name) const

Gets an option from the main map.

Parameters
nameThe option name.
Returns
Returns the option value.

Definition at line 182 of file SignalFrame.cpp.

SignalFrame get_reply ( ) const

Retrieves the reply to this signal.

Returns
Returns the reply frame. If no reply was found, the node of the reply returned is not valid.

Definition at line 279 of file SignalFrame.cpp.

bool has_entry ( const std::string &  name) const

Checks if an option or array exists with specified name

Parameters
namethe name of the option

Definition at line 191 of file SignalFrame.cpp.

bool has_map ( const std::string &  name) const

Checks wether a frame the a specified name exists.

Parameters
nameThe frame name
Returns
Returns true if the frame exists, otherwise, returns false.

Definition at line 210 of file SignalFrame.cpp.

bool has_reply ( ) const

Checks whether a reply for this present as sibling node of this signal.

Returns
Returns true if a reply has been found; otherwise, returns false.

Definition at line 217 of file SignalFrame.cpp.

void insert ( std::vector< std::string > &  input)

Inserts the options, translating them from strings.

Definition at line 300 of file SignalFrame.cpp.

SignalFrame & map ( const std::string &  name)

Returns a sub-frame with a specified name. If the frame does not exist yet, it is created.

Parameters
nameThe frame name.
Returns
Returns the frame.

Definition at line 224 of file SignalFrame.cpp.

const SignalFrame & map ( const std::string &  name) const

Returns a sub-frame with a specified name. The frame must exist.

Parameters
nameThe frame name.
Returns
Returns the frame.

Definition at line 241 of file SignalFrame.cpp.

SignalOptions & options ( const std::string &  name = std::string())

Definition at line 362 of file SignalFrame.cpp.

const SignalOptions & options ( const std::string &  name = std::string()) const

Definition at line 377 of file SignalFrame.cpp.

XmlNode set_array ( const std::string &  value_key,
const std::string  element_type_name,
const std::string &  value_str,
const std::string &  delimiter,
const std::string &  descr = std::string() 
)

Sets an option to the main map. #Map::set_array_value() is used to acheive this.

Parameters
nameThe option name.
valueThe option value.
delimiterThe delimiter string.
See also
Map::set_value()

Definition at line 172 of file SignalFrame.cpp.

XmlNode set_option ( const std::string &  value_key,
const std::string  type_name,
const std::string &  value_str,
const std::string &  descr = std::string() 
)

Sets an option to the main map. #Map::set_single_value() is used to acheive this.

Parameters
nameThe option name.
valueThe option value.
See also
Map::set_value()

Definition at line 163 of file SignalFrame.cpp.

std::string to_python_script ( int  indentation = 0) const

Converts this signal to a string in the CF python script format.

Definition at line 428 of file SignalFrame.cpp.

std::string to_script ( int  indentation = 0) const

Converts this signal to a string in the CF script format.

Definition at line 392 of file SignalFrame.cpp.

Member Data Documentation

std::map<std::string, SignalFrame> m_maps
private

Maps contained in this frame.

Definition at line 154 of file SignalFrame.hpp.

std::map<std::string, SignalOptions> m_options
private

Definition at line 156 of file SignalFrame.hpp.

Map main_map

The main map.

Definition at line 141 of file SignalFrame.hpp.

XmlNode node

The frame node.

Definition at line 138 of file SignalFrame.hpp.

boost::shared_ptr<XmlDoc> xml_doc

The XML document. This pointer is not null only if a document was created by this class.

Definition at line 145 of file SignalFrame.hpp.


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