-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathi_tiny_event.h
More file actions
35 lines (26 loc) · 779 Bytes
/
i_tiny_event.h
File metadata and controls
35 lines (26 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*!
* @file
* @brief Abstract event.
*/
#ifndef i_tiny_event_h
#define i_tiny_event_h
#include "tiny_event_subscription.h"
struct i_tiny_event_api_t;
typedef struct {
const struct i_tiny_event_api_t* api;
} i_tiny_event_t;
typedef struct i_tiny_event_api_t {
/*!
* Adds a subscriber to the event.
*/
void (*subscribe)(i_tiny_event_t* self, tiny_event_subscription_t* subscription);
/*!
* Removes a subscriber from the event.
*/
void (*unsubscribe)(i_tiny_event_t* self, tiny_event_subscription_t* subscription);
} i_tiny_event_api_t;
#define tiny_event_subscribe(self, subscription) \
(self)->api->subscribe((self), (subscription))
#define tiny_event_unsubscribe(self, subscription) \
(self)->api->unsubscribe((self), (subscription))
#endif