Define GPA_EVENT_CLASS

Define Documentation

GPA_EVENT_CLASS(c)

The GPA_EVENT_CLASS macro handles declaring the boilerplate required for all EventData implementations. When used with the GPA_EVENT_CLASS_IMPL macro, all of the ugly details involved in static-initialization-time registration of the metaclass are handled for the user, while hiding those details from the user.

The ID is a standard v4 UUID, which can be generated by any convenient command-line or web-based tool (such as the "uuidgen" command on Linux and Cygwin, or any UUID generator website). Declaring a EventData class implementation looks like the following:

<file MyEvent.h>

class MyEvent : public EventData { public: GPA_EVENT_CLASS(MyEvent, 57161cb0-57bf-4d27-a3f6-1347fd512c83)

// your methods/members here };

Note: since the default constructor and destructor are part of this template, it is not possible to declare a default constructor separately from this macro. Users of this macro should implement the optional Initialize() method to perform default initialization of their event class.

Note: if you are using clang-format on your source code, you may want to wrap this macro call in clang-format on/off comments, as it will mangle the UUID.

See also

EventData::Initialize()