Class EventData

Nested Relationships

Nested Types

Inheritance Relationships

Derived Types

Class Documentation

class EventData

EventData is the base class for all events/messages that can be handled by the EventPublisher dispatch system.

Subclassed by gpa::common::ActionEvent, gpa::common::ApiObjectLifetimeEvent, gpa::common::BeginPlayEvent, gpa::common::CaptureStreamClosedEvent, gpa::common::CaptureStreamOpenFailedEvent, gpa::common::CaptureStreamOpenedEvent, gpa::common::ImmediateScreenshotRequest, gpa::common::KeyframeApplicationStartEvent, gpa::common::KeyframeAppliedEvent, gpa::common::OutOfDiskSpaceEvent, gpa::common::ToggleStreamCaptureRequest, gpa::runtime::SurfaceCreatedEvent

Public Functions

virtual ~EventData()
virtual utility::UUID const &GetID() const = 0
virtual char const *GetName() const = 0
size_t Serialize(serialization::Serializer*) const
size_t Deserialize(serialization::Serializer*)
virtual void Init()

Called by default constructor implementation. This method has a default, empty implementation, so it is optional for implementing classes.

virtual void Destroy()

Called by default denstructor implementation. This method has a default, empty implementation, so it is optional for implementing classes.

virtual Class *GetClassDef() const = 0

Pure virtual method providing access to the metaclass for a live event class instance.

Returns

Pointer to the instance's metaclass.

Public Static Functions

static size_t ReadAndCreateEventData(serialization::Serializer *serializer, EventData **ppEventData)

Given a pointer to a Serializer implementation and a pointer to an EventData*, return a live instance of an EventData derived class.

Parameters
  • serializer -- Pointer to an EventDataSerializer instance. If serializer is NULL, this function returns 0 without performing any actions.

  • ppEventData -- Pointer to an EventData pointer. If ppEventData is not NULL, upon successful return this parameter will contain the address of a live EventData derived class instance. This param can be NULL, in which case bytes will be consumed from the serializer without returning an EventData instance.

Returns

Number of bytes read from the serializer.

Protected Functions

virtual size_t Write(serialization::Serializer*) const

Derived classes to implement these to provide concrete serialization; these are invoked by Serialize/Deserialize methods. Default implementations are NOP

virtual size_t Read(serialization::Serializer*)
virtual uint64_t CalculatePayloadSize() const
class Class

Base reflection metaclass type. Provides access to event class name, and means to create new instances of the described event type. The class definition metadata can be accessed from any EventData instance via GetClassDef() method, or via static GetClass() method on EventData class.

Subclassed by gpa::runtime::EventData::ClassDef< T >

Public Functions

Class(utility::UUID const &eventId, char const *eventName)
virtual ~Class()
utility::UUID const &ID() const

Globally-unique identifier for this metaclass.

Returns

Const reference to the UUID for this metaclass.

char const *Name() const

Name of the class described by this metaclass.

Returns

Pointer to UTF-8 class name.

virtual EventData *Create() const = 0

Create an instance of the class described by this metaclass. This method is pure virtual and requires a derived class implementation (see ClassDef).

Returns

Naked pointer to a live instance of the class described by this metaclass. Caller owns the instance upon return (no reference counting or garbage collection is involved).

Public Members

Class *mNext = {nullptr}

Public Static Functions

static Class const *Find(utility::UUID const &eventId)

Find the event metaclass corresponding to the provided event ID (see ID()).

Note

Since the metaclass registration system depends on static initialization, DCE (dead-code elimination) may cause the metaclass definition to be discarded, and therefore not available to this method. You may need to employ anti-DCE methods to prevent this occurrence if you are looking for a metaclass you know exists, but is not found by this method.

Parameters

eventId -- Globally-unique ID of the desired event metaclass.

Returns

Pointer to the desired event metaclass if found, nullptr if not.

static Class const *Classes()

Obtain a pointer to a linked list of registered classes. This list is null-terminated (meaning, the last element in the list has an mNext value of "nullptr").

Returns

Pointer to the head of the metaclass linked list. If no metaclasses are registered, this will return nullptr.

template<typename T>
class ClassDef : public gpa::runtime::EventData::Class

This template class makes it possible to create instances of a class described by a metaclass.

Public Functions

inline ClassDef(utility::UUID const &eventId, const char *name)
inline virtual EventData *Create() const

See also

Class::Create()