Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 6, 2009, 4:56:42 AM (15 years ago)
Author:
landauf
Message:

Added support for named events (so one object can fire multiple different events).
Added a new class, EventFilter, to filter differently named events and map them to different states.

I've wrapped the event names with a pretty useless macro, but I want to expand this in the future and register possible event names in the Identifier of the corresponding class. This allows us to get the possible event names in a static manner and thus build an editor upon it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/EventIncludes.h

    r5879 r5888  
    6868    static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \
    6969    XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true)
     70   
     71
     72/**
     73    @brief Defines a new event name for a class. Named events can only have names which were defined with this macro.
     74   
     75    @param classname The name of the class
     76    @param name      The name of the event
     77*/
     78#define CreateEventName(classname, name) \
     79    static std::string eventname##classname##name = #name
     80
     81/**
     82    @brief This macro is needed to fire an event with this name. The event name must previously be declared with @ref CreateEventName.
     83*/   
     84#define EventName(classname, name) \
     85    eventname##classname##name
    7086 
    7187#endif /* _EventIncludes_H__ */
Note: See TracChangeset for help on using the changeset viewer.