SOFA API  b5aefb45
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.

Author
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
protected

◆ s_lastEventTypeIndex

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

storing the last given id

Constructor details

◆ Event()

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

◆ ~Event()

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

Function details

◆ GetClassName()

static const char* sofa::core::objectmodel::Event::GetClassName ( )
inlinestatic
Returns
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
inlinevirtual
Returns
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 ( )
inlinestatic
Returns
the total number of events available in SOFA

◆ getEventTypeIndex()

virtual size_t sofa::core::objectmodel::Event::getEventTypeIndex ( ) const
pure virtual
Returns
unique type index for fast Event type comparison with unique indices (see function 'checkEventType')
Warning
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.