OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
FuelCell::ApplicationCore::Event Class Reference

Objects of this kind are used to notify interior applications of changes provoked by an outer loop. More...

#include <event.h>

Public Member Functions

 Event ()
 Constructor, generating a clear Event object with all flags set to false. More...
 
void all ()
 Set all flags to true. More...
 
void clear ()
 Set all flags to false. More...
 
bool test (const Event &other) const
 Test whether all the flags set to true in the other Event object are also set to true in this one. More...
 
bool any () const
 Return true if any event is set to true. More...
 
Eventoperator+= (const Event &other)
 Add the flags of the other Event object. More...
 
Eventoperator-= (const Event &other)
 Clear the flags of the other Event object. More...
 
template<typename OS >
void print (OS &os) const
 List the flags to a stream. More...
 

Static Public Member Functions

static Event assign (const char *name)
 This function registers a new event type and assigns a unique identifier to it. More...
 
template<typename OS >
static void print_assigned (OS &os)
 List the names to a stream. More...
 

Private Attributes

bool all_true
 Sometimes, actions have to be taken by all means. More...
 
std::vector< bool > flags
 The actual list of events. More...
 

Static Private Attributes

static std::vector< std::string > names
 The actual list of names of events. More...
 

Detailed Description

Objects of this kind are used to notify interior applications of changes provoked by an outer loop.

They are handed to the application through ApplicationBase::notify() and it is up to the actual application how to handle them.

Event is organized as an extensible binary enumerator. Every class can add its own events using assign(). A typical code example is

class A
{
  static Event event;
};
Event A::event = Event::assign("Event for A");
Author
Guido Kanschat

Constructor & Destructor Documentation

FuelCell::ApplicationCore::Event::Event ( )

Constructor, generating a clear Event object with all flags set to false.

Member Function Documentation

void FuelCell::ApplicationCore::Event::all ( )

Set all flags to true.

bool FuelCell::ApplicationCore::Event::any ( ) const

Return true if any event is set to true.

static Event FuelCell::ApplicationCore::Event::assign ( const char *  name)
static

This function registers a new event type and assigns a unique identifier to it.

All flags are set to false. The flag for this new event type is set to true. The result of this function should be stored for later use.

void FuelCell::ApplicationCore::Event::clear ( )

Set all flags to false.

Event& FuelCell::ApplicationCore::Event::operator+= ( const Event other)

Add the flags of the other Event object.

Event& FuelCell::ApplicationCore::Event::operator-= ( const Event other)

Clear the flags of the other Event object.

template<typename OS >
void FuelCell::ApplicationCore::Event::print ( OS &  os) const

List the flags to a stream.

template<typename OS >
static void FuelCell::ApplicationCore::Event::print_assigned ( OS &  os)
static

List the names to a stream.

bool FuelCell::ApplicationCore::Event::test ( const Event other) const

Test whether all the flags set to true in the other Event object are also set to true in this one.

Member Data Documentation

bool FuelCell::ApplicationCore::Event::all_true
private

Sometimes, actions have to be taken by all means.

Therefore, if this value is true, test() always returns true.

std::vector<bool> FuelCell::ApplicationCore::Event::flags
private

The actual list of events.

std::vector<std::string> FuelCell::ApplicationCore::Event::names
staticprivate

The actual list of names of events.


The documentation for this class was generated from the following file: