COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Notifier.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 "common/PE/Manager.hpp"
8 
10 
11 using namespace cf3::common;
12 
14 
15 namespace cf3 {
16 namespace Tools {
17 namespace solver {
18 
20 
21 Notifier::Notifier( const Handle<common::PE::Manager>& manager )
22  : m_manager(manager)
23 {
24  cf3_assert( is_not_null(manager) );
25 
27 }
28 
30 
32 {
33 
34 }
35 
37 
38 void Notifier::listen_to_event(const std::string & name, bool notifyOnce)
39 {
41 
42  if(notifyOnce)
44 }
45 
47 
49 {
50  std::map<std::string, bool>::iterator it = m_once_notifying_events.begin();
51 
52  for( ; it != m_once_notifying_events.end() ; it++)
53  it->second = false;
54 }
55 
57 
58 void Notifier::new_event(const std::string & name, SignalArgs & args)
59 {
60  std::map<std::string, bool>::iterator it = m_once_notifying_events.find(name);
61 
62  if( it == m_once_notifying_events.end() || !it->second )
63  {
64  event_occured(name, args);
65 
67  m_manager->new_event(args);
68 
69  if(it != m_once_notifying_events.end())
70  it->second = true;
71  }
72 }
73 
75 
76 } // solver
77 } // Tools
78 } // cf3
std::string name(ComponentWrapper &self)
common::NotificationQueue * m_observed_queue
Definition: Notifier.hpp:50
#define cf3_assert(a)
Definition: Assertions.hpp:93
void new_event(SignalArgs &args)
Definition: Manager.cpp:205
Manages a set of maps.
Definition: SignalFrame.hpp:31
Handle< common::PE::Manager > m_manager
Definition: Notifier.hpp:54
boost::signals2::signal< void(const std::string &, common::SignalArgs &) > event_occured
Definition: Notifier.hpp:42
common::NotificationQueue * notification_queue()
Definition: Manager.hpp:59
Top-level namespace for coolfluid.
Definition: Action.cpp:18
void new_event(const std::string &name, common::SignalArgs &args)
Definition: Notifier.cpp:58
void add_notifier(const std::string &name, void(NOTIFIER::*fcnt)(const std::string &, SignalArgs &args), NOTIFIER *receiver)
Adds a notifier.
void listen_to_event(const std::string &name, bool notify_once)
Definition: Notifier.cpp:38
std::map< std::string, bool > m_once_notifying_events
Definition: Notifier.hpp:52
Most basic kernel library.
Definition: Action.cpp:19
bool is_not_null(T ptr)
predicate for comparison to nullptr
Definition: CF.hpp:147
Send comments to:
COOLFluiD Web Admin