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
AppFrame::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.
 
void all ()
 Set all flags to true.
 
void clear ()
 Set all flags to false.
 
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.
 
bool any () const
 Return true if any event is set to true.
 
Eventoperator+= (const Event &other)
 Add the flags of the other Event object.
 
Eventoperator-= (const Event &other)
 Clear the flags of the other Event object.
 
template<typename OS >
void print (OS &os) const
 List the flags to a stream.
 

Static Public Member Functions

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

Private Attributes

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

Static Private Attributes

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

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");

Constructor & Destructor Documentation

AppFrame::Event::Event ( )

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

Member Function Documentation

void AppFrame::Event::all ( )

Set all flags to true.

Referenced by AppFrame::ApplicationBase::ApplicationBase().

Here is the caller graph for this function:

bool AppFrame::Event::any ( ) const

Return true if any event is set to true.

static Event AppFrame::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 AppFrame::Event::clear ( )

Set all flags to false.

Event& AppFrame::Event::operator+= ( const Event other)

Add the flags of the other Event object.

Event& AppFrame::Event::operator-= ( const Event other)

Clear the flags of the other Event object.

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

List the flags to a stream.

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

List the names to a stream.

bool AppFrame::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 AppFrame::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> AppFrame::Event::flags
private

The actual list of events.

std::vector<std::string> AppFrame::Event::names
staticprivate

The actual list of names of events.


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