SOFA API  ca70b0f0
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 chargetClassName () const
virtual size_t getEventTypeIndex () const =0

Static Public Member Functions

static const charGetClassName ()
static size_t getEventTypeCount ()

Attribute details

◆ m_handled

bool sofa::core::objectmodel::Event::m_handled

◆ s_lastEventTypeIndex

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

storing the last given id

Constructor details

◆ Event()

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

◆ ~Event()

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

Function details

◆ GetClassName()

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

◆ getClassName()

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

◆ getEventTypeCount()

static size_t sofa::core::objectmodel::Event::getEventTypeCount ( )
the total number of events available in SOFA

◆ getEventTypeIndex()

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

◆ isHandled()

bool sofa::core::objectmodel::Event::isHandled ( ) const

Returns true of the event has been handled.

◆ setHandled()

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

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