COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Action.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #include <boost/bind.hpp>
8 #include <boost/function.hpp>
9 #include "common/Builder.hpp"
10 #include "common/Signal.hpp"
11 #include "common/PropertyList.hpp"
12 #include "common/OptionList.hpp"
13 #include "common/Action.hpp"
15 
16 #include "common/LibCommon.hpp"
17 
18 namespace cf3 {
19 namespace common {
20 
22 
24 
25 Action::Action ( const std::string& name ) : Component(name)
26 {
27  // signals
28 
29  regist_signal( "execute" )
30  .connect( boost::bind( &Action::signal_execute, this, _1 ) )
31  .description("Execute the action")
32  .pretty_name("Execute");
33 }
34 
35 
36 Action& Action::create_action(const std::string& action_provider,
37  const std::string& name)
38 {
39  boost::shared_ptr<Action> sub_action = build_component_abstract_type<Action>(action_provider,name);
40  add_component(sub_action);
41  return *sub_action;
42 }
43 
44 
46 {
47  this->execute();
48 }
49 
51 
52 } // common
53 } // cf3
std::string name(ComponentWrapper &self)
Signal & description(const std::string &desc)
sets the description of this signal
Definition: Signal.cpp:42
Signal & connect(const Signal::slot_type &subscriber)
connects to a subscribing slot
Definition: Signal.cpp:92
const std::string & name() const
Access the name of the component.
Definition: Component.hpp:146
Manages a set of maps.
Definition: SignalFrame.hpp:31
Signal & pretty_name(const std::string &name)
sets the pretty name of this signal
Definition: Signal.cpp:48
Helper class to register typeinfo and option type of a component This is mostly useful for abstract c...
Definition: Builder.hpp:271
Component & add_component(const boost::shared_ptr< Component > &subcomp)
Add the passed component as a subcomponent.
Definition: Component.cpp:289
Top-level namespace for coolfluid.
Definition: Action.cpp:18
Action(const std::string &name)
Definition: Action.cpp:25
Component that executes an action. Implementation of the IAction interface as a component, exposing the execute function as a signal.
Definition: Action.hpp:21
virtual void execute()=0
execute the action
virtual Action & create_action(const std::string &action_provider, const std::string &name)
Definition: Action.cpp:36
Signal & regist_signal(const SignalID &sname)
Regist signal.
RegisterComponent< Action, LibCommon > register_action
Definition: Action.cpp:23
Base class for defining CF components.
Definition: Component.hpp:82
void signal_execute(common::SignalArgs &node)
signal to execute this action
Definition: Action.cpp:45
Send comments to:
COOLFluiD Web Admin