XROAD
order_aux.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <cache/xroad_objects.h>
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
15 
16 #define xroad_order_is_active(order) \
17 ({ \
18  xroad_order_status_t status = xroad_order_base_get_status(order); \
19  xroad_order_status_initial == status || \
20  xroad_order_status_active == status || \
21  xroad_order_status_awaiting_active == status || \
22  xroad_order_status_awaiting_cancel == status || \
23  xroad_order_status_awaiting_replace == status; \
24 })
25 
26 #define xroad_order_is_on_exchange(order) \
27 ({ \
28  xroad_order_status_t status = xroad_order_base_get_status(order); \
29  xroad_order_status_active == status || \
30  xroad_order_status_awaiting_active == status || \
31  xroad_order_status_awaiting_cancel == status || \
32  xroad_order_status_awaiting_replace == status; \
33 })
34 
35 #define xroad_order_is_done(order) \
36 ({ \
37  xroad_order_status_t status = xroad_order_base_get_status(order); \
38  xroad_order_status_filled == status || \
39  xroad_order_status_canceled == status || \
40  xroad_order_status_rejected == status || \
41  xroad_order_status_expired == status || \
42  xroad_order_status_removed == status; \
43 })
44 
45 #define xroad_order_is_pending(order) \
46 ({ \
47  xroad_order_status_t status = xroad_order_base_get_status(order); \
48  xroad_order_status_awaiting_active == status || \
49  xroad_order_status_awaiting_cancel == status || \
50  xroad_order_status_awaiting_replace == status; \
51 })
52 
53 #define order_is_active(order) \
54 ({ \
55  order_state_t state = order_get_state(order); \
56  state == order_state_initial || \
57  state == order_state_active || \
58  state == order_state_awaiting_active || \
59  state == order_state_awaiting_replace || \
60  state == order_state_awaiting_destroy || \
61  state == order_state_awaiting_cancel; \
62 })
63 
64 #define order_is_done(order) \
65 ({ \
66  order_state_t state = order_get_state(order); \
67  state == order_state_destroyed || \
68  state == order_state_canceled || \
69  state == order_state_rejected || \
70  state == order_state_filled || \
71  state == order_state_expired; \
72 })
73 
74 #define order_is_pending(order) \
75 ({ \
76  order_state_t state = order_get_state(order); \
77  state == order_state_awaiting_active || \
78  state == order_state_awaiting_destroy || \
79  state == order_state_awaiting_cancel || \
80  state == order_state_awaiting_replace; \
81 })
82 
83 #define order_is_on_exchange(o) \
84 ({ \
85  order_state_t st = order_get_state(o); \
86  st == order_state_active || \
87  st == order_state_awaiting_active || \
88  st == order_state_awaiting_cancel || \
89  st == order_state_awaiting_destroy || \
90  st == order_state_awaiting_replace; \
91 })
92 
93 #define order_book_is_active(order) \
94 ({ \
95  order_book_state_t state = order_book_get_state(order); \
96  state == order_book_state_initial || \
97  state == order_book_state_active || \
98  state == order_book_state_awaiting_active || \
99  state == order_book_state_awaiting_replace || \
100  state == order_book_state_awaiting_destroy || \
101  state == order_book_state_awaiting_cancel || \
102  state == order_book_state_awaiting_reject || \
103  state == order_book_state_error || \
104  state == order_book_state_awaiting_cancel_replace; \
105 })
106 
107 #define order_book_is_done(order) \
108 ({ \
109  order_book_state_t state = order_book_get_state(order); \
110  state == order_book_state_destroyed || \
111  state == order_book_state_canceled || \
112  state == order_book_state_rejected || \
113 })
114 
115 #define order_book_is_pending(order) \
116 ({ \
117  order_book_state_t state = order_book_get_state(order); \
118  state == order_book_state_awaiting_active || \
119  state == order_book_state_awaiting_destroy || \
120  state == order_book_state_awaiting_cancel || \
121  state == order_book_state_awaiting_replace || \
122  state == order_book_state_awaiting_reject || \
123  state == order_book_state_awaiting_cancel_replace; \
124 })
125 
126 #define order_book_is_on_exchange(o) \
127 ({ \
128  order_book_state_t st = order_book_get_state(o); \
129  st == order_book_state_active || \
130  st == order_book_state_awaiting_active || \
131  st == order_book_state_awaiting_cancel || \
132  st == order_book_state_awaiting_destroy || \
133  st == order_book_state_awaiting_replace || \
134  st == order_book_state_awaiting_reject || \
135  st == order_book_state_error || \
136  st == order_book_state_awaiting_cancel_replace; \
137 })
138 
139 
140 #ifdef __cplusplus
141 }
142 #endif
CAUTION: do not change this file - it is autogenerated.