@@ -53,51 +53,107 @@ typedef enum {
53
53
*/
54
54
ECSACT_ASYNC_ERR_PERMISSION_DENIED ,
55
55
56
+ /**
57
+ * Client sent invalid connection options
58
+ */
59
+ ECSACT_ASYNC_INVALID_CONNECTION_STRING ,
60
+
56
61
/**
57
62
* Connection to the client is closed
58
63
*/
59
64
ECSACT_ASYNC_ERR_CONNECTION_CLOSED ,
60
65
61
66
/**
62
- * ExecutionOptions failed to merge
67
+ * ExecutionOptions failed to merge, and upon failure the connection is closed
63
68
*/
64
69
ECSACT_ASYNC_ERR_EXECUTION_MERGE_FAILURE ,
65
70
} ecsact_async_error ;
66
71
67
72
/**
68
- * When an error occurs due to an async request this callback is invoked, only
69
- * either @p async_err or @p execute_err will have a non-ok value.
73
+ * When an error occurs due to an async request this callback is invoked.
70
74
*
71
75
* @param async_err when there is no async error this will be @ref
72
76
* ECSACT_ASYNC_OK otherwise @see ecsact_async_error
73
- * @param execute_err when there is no system execution error, this will be @ref
74
- * ECSACT_EXEC_SYS_OK other @see ecsact_execute_systems_error
75
- * @param request_id the request ID returned by an async request function that
77
+
78
+ * @param request_ids A list of request IDs returned by an async request
79
+ function that
76
80
* was responsible for this error
77
81
* @param callback_user_data the @ref
78
82
* ecsact_async_events_collector::error_callback_user_data
79
83
*/
80
84
typedef void (* ecsact_async_error_callback )(
81
85
//
82
- ecsact_async_error async_err ,
86
+ ecsact_async_error async_err ,
87
+ int request_ids_length ,
88
+ ecsact_async_request_id * request_ids ,
89
+ void * callback_user_data
90
+ );
91
+
92
+ /**
93
+ * When an occurs from the system execution this callback is invoked.
94
+ *
95
+ * @param execute_err when there is no system execution error, this will be
96
+ * @ref ECSACT_EXEC_SYS_OK other @see ecsact_execute_systems_error
97
+ */
98
+ typedef void (* ecsact_execute_sys_error_callback )(
99
+ //
83
100
ecsact_execute_systems_error execute_err ,
84
- ecsact_async_request_id request_id ,
85
101
void * callback_user_data
86
102
);
87
103
104
+ /**
105
+ * When an entity is sucessfully created this callback is
106
+ * invoked.
107
+ *
108
+ * @param entity_id the entity id of the created entity
109
+ * @param request_id the request ID returned by the create entity callback
110
+ * @param callback_user_data the @ref
111
+ * ecsact_async_events_collector::error_callback_user_data
112
+ */
113
+ typedef void (* ecsact_async_create_entity_callback )(
114
+ //
115
+ ecsact_entity_id entity_id ,
116
+ ecsact_async_request_id request_id ,
117
+ void * callback_user_data
118
+ );
119
+
88
120
typedef struct ecsact_async_events_collector {
89
121
/**
90
122
* invoked when an async request failed.
91
123
* @see ecsact_async_error_callback
92
124
* @see ecsact_async_error
125
+ */
126
+ ecsact_async_error_callback async_error_callback ;
127
+
128
+ /**
129
+ * `callback_user_data` passed to `async_error_callback`
130
+ */
131
+ void * async_error_callback_user_data ;
132
+
133
+ /**
134
+ * Invoked when a create entity request succeeds.
135
+ * @see ecsact_async_create_entity_callback
136
+ * @see ecsact_entity_id
137
+ * @see ecsact_async_error
138
+ */
139
+ ecsact_async_create_entity_callback async_entity_callback ;
140
+
141
+ /**
142
+ * `callback_user_data` passed to `async_entity_callback`
143
+ */
144
+ void * async_entity_callback_user_data ;
145
+
146
+ /**
147
+ * invoked when a system execution error occurred.
148
+ * @see ecsact_execute_sys_error_callback
93
149
* @see ecsact_execute_systems_error
94
150
*/
95
- ecsact_async_error_callback error_callback ;
151
+ ecsact_execute_sys_error_callback system_error_callback ;
96
152
97
153
/**
98
154
* `callback_user_data` passed to `error_callback`
99
155
*/
100
- void * error_callback_user_data ;
156
+ void * system_error_callback_user_data ;
101
157
} ecsact_async_events_collector ;
102
158
103
159
/**
@@ -116,34 +172,10 @@ ECSACT_ASYNC_API_FN(
116
172
const ecsact_execution_options options
117
173
);
118
174
119
- /**
120
- * Enqueues system execution options at the specified ticks. If multiple
121
- * invocations of `ecsact_async_enqueue_execution_options_at` happen for the
122
- * same tick(s) the execution options will be _merged_.
123
- *
124
- * @param list_length the length of @p tick_list and @p options_list
125
- * @param tick_list a sequential list of ticks the execution options in @p
126
- * options_list will be used during system exeuction. Length is determined by @p
127
- * list_length
128
- * @param options_list a sequential list of execution options. Length is
129
- * determined by @p list_length
130
- * @returns a request ID representing this async request. Later used in @ref
131
- * ecsact_async_error_callback if an error occurs
132
- */
133
-
134
- ECSACT_ASYNC_API_FN (
135
- ecsact_async_request_id ,
136
- ecsact_async_enqueue_execution_options_at
137
- )
138
- ( //
139
- int list_length ,
140
- const int * tick_list ,
141
- const ecsact_execution_options * options_list
142
- );
143
-
144
175
/**
145
176
* Invokes the various callbacks in `execution_events` and `async_events` that
146
- * have been pending.
177
+ * have been pending. If either a system or async error occurs it's treated
178
+ * as a call to ecscact_async_disconnect
147
179
*/
148
180
ECSACT_ASYNC_API_FN (void , ecsact_async_flush_events )
149
181
( //
@@ -171,12 +203,17 @@ ECSACT_ASYNC_API_FN(ecsact_async_request_id, ecsact_async_connect)
171
203
*/
172
204
ECSACT_ASYNC_API_FN (void , ecsact_async_disconnect )(void );
173
205
174
- #define FOR_EACH_ECSACT_ASYNC_API_FN (fn , ...) \
175
- fn(ecsact_async_enqueue_execution_options, __VA_ARGS__); \
176
- fn(ecsact_async_enqueue_execution_options_at, __VA_ARGS__); \
177
- fn(ecsact_async_flush_events, __VA_ARGS__); \
178
- fn(ecsact_async_connect, __VA_ARGS__); \
179
- fn(ecsact_async_disconnect, __VA_ARGS__);
206
+ /**
207
+ * Returns an entity
208
+ */
209
+ ECSACT_ASYNC_API_FN (ecsact_async_request_id , ecsact_async_create_entity )(void );
210
+
211
+ #define FOR_EACH_ECSACT_ASYNC_API_FN (fn , ...) \
212
+ fn(ecsact_async_enqueue_execution_options, __VA_ARGS__); \
213
+ fn(ecsact_async_flush_events, __VA_ARGS__); \
214
+ fn(ecsact_async_connect, __VA_ARGS__); \
215
+ fn(ecsact_async_disconnect, __VA_ARGS__); \
216
+ fn(ecsact_async_create_entity, __VA_ARGS__);
180
217
181
218
#undef ECSACT_ASYNC_API
182
219
#undef ECSACT_ASYNC_API_FN
0 commit comments