libsapling  0.8.0
first_out_buffer.h
Go to the documentation of this file.
1 #ifndef _LIBSAPLING_FIRST_OUT_BUFFER_H_
2 #define _LIBSAPLING_FIRST_OUT_BUFFER_H_
3 
12 #include "libsapling/dm/path.h"
13 
18 #define FIRST_IN predicate_0
19 
24 #define LAST_IN predicate_1
25 
26 #define IMPLEMENT_FIRST_OUT_BUFFER(FIRST_OUT, SYM) \
27  \
28 void SYM##__insert(node_t *ref, void *info) \
29 { \
30  path__insert(ref, info, FIRST_OUT); \
31 } \
32  \
33 void SYM##__delete(node_t *ref) \
34 { \
35  path__delete(E_QT, ref, NULL, predicate_1); \
36 } \
37  \
38  \
39 struct get_data { \
40  void *data; \
41 }; \
42  \
43 static \
44 void get_data(node_t *ref, const struct info_stack *info) \
45 { \
46  if (*ref != NULL) { \
47  struct get_data *user = info->user; \
48  user->data = path__data(*ref); \
49  } \
50 } \
51  \
52 void *SYM##__access(node_t *ref) \
53 { \
54  struct get_data info = { NULL }; \
55  path__access(E_QT, ref, &info, predicate_1, get_data); \
56  return info.data; \
57 }
58 
59 #endif