libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_event.h
Go to the documentation of this file.
1/*! \file
2 * \brief GblEvent base type and basic API
3 * \ingroup meta
4 *
5 * \todo
6 * - maybe give them timestamps?
7 * - maybe give them virtuals for onAccept/onReject/onReset?
8 * - maybe give them source objects?
9 * - extra extended creation args + default values
10 *
11 * \author 2023 Falco Girgis
12 * \copyright MIT License
13 */
14
15#ifndef GIMBAL_EVENT_H
16#define GIMBAL_EVENT_H
17
18#include "gimbal_box.h"
19
20/*! \name Type System
21 * \brief Type UUID and cast operators
22 * @{
23 */
24#define GBL_EVENT_TYPE (GBL_TYPEID(GblEvent)) //!< Returns the GblType for GblEvent
25#define GBL_EVENT(self) (GBL_CAST(GblEvent, self)) //!< Casts a GblInstance to GblEvent
26#define GBL_EVENT_CLASS(klass) (GBL_CLASS_CAST(GblEvent, klass)) //!< Casts a GblClass to GblEventClass
27#define GBL_EVENT_CLASSOF(self) (GBL_CLASSOF(GblEvent, self)) //!< Gets a GblEventClass from GblInstance
28//! @}
29
30#define GBL_SELF_TYPE GblEvent
31
33
34GBL_DECLARE_ENUM(GBL_EVENT_STATE) {
35 GBL_EVENT_STATE_PENDING,
36 GBL_EVENT_STATE_ACCEPTED,
37 GBL_EVENT_STATE_IGNORED
38};
39
40/*! \struct GblEventClass
41 * \extends GblBoxClass
42 * \brief GblClass VTable structure for GblEvent
43 *
44 * No public virtual methods
45 *
46 * \sa GblEvent
47 */
48GBL_CLASS_DERIVE_EMPTY(GblEvent, GblBox)
49
50/*! \struct GblEvent
51 * \extends GblBox
52 * \ingroup meta
53 * \brief Event base class for use with the event system
54 *
55 * \sa GblIEventHandler, GblIEventFilter
56 */
59 GBL_EVENT_STATE state;
62
63GBL_EXPORT GblType GblEvent_type (void) GBL_NOEXCEPT;
64GBL_EXPORT GblEvent* GblEvent_create (GblType type) GBL_NOEXCEPT;
65GBL_EXPORT GBL_RESULT GblEvent_construct (GBL_SELF, GblType type) GBL_NOEXCEPT;
66GBL_EXPORT GBL_EVENT_STATE GblEvent_state (GBL_CSELF) GBL_NOEXCEPT;
67GBL_EXPORT GBL_RESULT GblEvent_accept (GBL_SELF) GBL_NOEXCEPT;
68GBL_EXPORT void GblEvent_reset (GBL_SELF) GBL_NOEXCEPT;
69
71
72#undef GBL_SELF_TYPE
73
74
75#endif // GIMBAL_EVENT_H
#define GBL_CLASS_CAST(cType, klass)
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_TYPEID(instanceStruct)
#define GBL_INSTANCE_DERIVE(derivedInstance, baseInstance)
#define GBL_PRIVATE_BEGIN
#define GBL_DECLARE_ENUM(E)
#define GBL_INSTANCE_END
#define GBL_CLASS_DERIVE_EMPTY(...)
#define GBL_EXPORT
#define GBL_PRIVATE_END
Private data structure.
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)
uintptr_t GblType
Meta Type UUID.
Definition gimbal_type.h:51
Event base class for use with the event system.