template<typename EventT, EventClass BaseEventT, typename ContentT = void>
class Quotient::EventTemplate< EventT, BaseEventT, ContentT >
A template base class to derive your event type from.
This simple class template generates commonly used event constructor signatures and the content() method with the appropriate return type. The generic version here is only used with non-trivial ContentT
(if you don't need to create an event from its content structure, just go and derive straight from the respective EventBaseT
instead of using EventTemplate); specialisations may override that and provide useful semantics even without ContentT
(see EventTemplate<CallEvent>, e.g.).
The template uses CRTP to pick the event type id from the actual class; it will fail to compile if EventT
doesn't provide TypeId. It also uses the base event type's basicJson(); if you need extra keys to be inserted you may want to bypass this template as writing the code to that effect in your class will likely be clearer and more concise.
- See also
- https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
-
DEFINE_SIMPLE_EVENT
Definition at line 376 of file event.h.