SOFA API  d3aee470
Open source framework for multi-physics simuation
sofa::core::objectmodel::Event Class Referenceabstract

#include <Event.h>

Base class for all events received by the objects. More...

Inheritance diagram for sofa::core::objectmodel::Event:

Detailed Description

Base class for all events received by the objects.

When created, the status is initialized as not handled. It is then propagated along the objects until it is handled.

Francois Faure

Protected Attributes

bool m_handled

Static Protected Attributes

static size_t s_lastEventTypeIndex = 0
 storing the last given id More...

Public Member Functions

 Event ()
virtual ~Event ()
void setHandled ()
 Tag the event as handled, i.e. the event needs not be propagated further. More...
bool isHandled () const
 Returns true of the event has been handled. More...
virtual const char * getClassName () const
virtual size_t getEventTypeIndex () const =0

Static Public Member Functions

static const char * GetClassName ()
static size_t getEventTypeCount ()

Attribute details

bool sofa::core::objectmodel::Event::m_handled
size_t sofa::core::objectmodel::Event::s_lastEventTypeIndex = 0

storing the last given id

Constructor details

sofa::core::objectmodel::Event::Event ( )
sofa::core::objectmodel::Event::~Event ( )

Function details

virtual const char* sofa::core::objectmodel::Event::getClassName ( ) const
the class name from an instance. Do not override directly. Instead, add the SOFA_EVENT_H in your class definition
static const char* sofa::core::objectmodel::Event::GetClassName ( )
the name of the event type. As the method is static the name can be retrieved without instantiation. Must be reimplemented in each subclasse
static size_t sofa::core::objectmodel::Event::getEventTypeCount ( )
the total number of events available in SOFA
virtual size_t sofa::core::objectmodel::Event::getEventTypeIndex ( ) const
pure virtual
unique type index for fast Event type comparison with unique indices (see function 'checkEventType')
this mechanism will only work for the last derivated type (and not for eventual intermediaries) e.g. for C derivated from B derivated from A, checkEventType will returns true only for C* but false for B* or A* Should be implemented by using macros SOFA_EVENT_H / SOFA_EVENT_CPP
bool sofa::core::objectmodel::Event::isHandled ( ) const

Returns true of the event has been handled.

void sofa::core::objectmodel::Event::setHandled ( )

Tag the event as handled, i.e. the event needs not be propagated further.