00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00038 #ifndef __NUSMV_CORE_UTILS_NODE_LIST_H__
00039 #define __NUSMV_CORE_UTILS_NODE_LIST_H__
00040
00041 #include "nusmv/core/node/node.h"
00042 #include "nusmv/core/utils/utils.h"
00043 #include "nusmv/core/node/printers/MasterPrinter.h"
00044
00051 typedef struct NodeList_TAG* NodeList_ptr;
00052
00058 #define NODE_LIST(x) \
00059 ((NodeList_ptr) (x))
00060
00066 #define NODE_LIST_CHECK_INSTANCE(x) \
00067 (nusmv_assert(NODE_LIST(x) != NODE_LIST(NULL)))
00068
00075 typedef struct Link_TAG* ListIter_ptr;
00076
00082 #define LIST_ITER(x) \
00083 ((ListIter_ptr) (x))
00084
00091 typedef boolean (*NodeListPred) (node_ptr element, void* arg);
00092
00093
00106 typedef boolean (*NODE_LIST_FOREACH_FUN_P)(NodeList_ptr list, ListIter_ptr iter,
00107 void* user_data);
00108
00109
00110
00111
00117 #define NODE_LIST_FOREACH(list, iter) \
00118 for (iter=NodeList_get_first_iter(list); !ListIter_is_end(iter); \
00119 iter=ListIter_get_next(iter))
00120
00121
00122
00129 NodeList_ptr NodeList_create(void);
00130
00140 NodeList_ptr NodeList_create_from_list(node_ptr list);
00141
00150 NodeList_ptr NodeList_create_from_element(node_ptr node);
00151
00158 NodeList_ptr NodeList_copy(NodeList_ptr self);
00159
00166 void NodeList_destroy(NodeList_ptr self);
00167
00168
00169
00170
00177 int NodeList_get_length(const NodeList_ptr self);
00178
00179
00180
00181
00188 boolean NodeList_is_empty(const NodeList_ptr self);
00189
00197 boolean
00198 NodeList_belongs_to(const NodeList_ptr self, node_ptr elem);
00199
00200
00201
00202
00209 void NodeList_append(NodeList_ptr self, node_ptr elem);
00210
00217 void NodeList_prepend(NodeList_ptr self, node_ptr elem);
00218
00219
00220
00221
00228 node_ptr NodeList_get_elem_at(const NodeList_ptr self,
00229 const ListIter_ptr iter);
00230
00231
00232
00233
00244 int NodeList_remove_elems(NodeList_ptr self,
00245 const NodeList_ptr other,
00246 NodeListPred disposer,
00247 void* disposer_arg);
00248
00249
00250
00251
00258 ListIter_ptr ListIter_get_next(const ListIter_ptr self);
00259
00266 boolean ListIter_is_end(const ListIter_ptr self);
00267
00273 ListIter_ptr ListIter_get_end(void);
00274
00275
00276
00277
00284 ListIter_ptr NodeList_get_first_iter(const NodeList_ptr self);
00285
00295 void NodeList_insert_before(NodeList_ptr self, ListIter_ptr iter,
00296 node_ptr elem);
00297
00308 void NodeList_insert_after(NodeList_ptr self, ListIter_ptr iter,
00309 node_ptr elem);
00310
00318 node_ptr NodeList_remove_elem_at(NodeList_ptr self,
00319 ListIter_ptr iter);
00320
00340 ListIter_ptr
00341 NodeList_search(const NodeList_ptr self, NodeListPred pred, void* arg);
00342
00343
00344
00345
00352 void NodeList_print_nodes(const NodeList_ptr self,
00353 MasterPrinter_ptr printer,
00354 FILE* out);
00355
00356
00357
00358
00365 void NodeList_reverse(NodeList_ptr self);
00366
00375 void NodeList_concat(NodeList_ptr self, const NodeList_ptr src);
00376
00386 void NodeList_concat_unique(NodeList_ptr self, const NodeList_ptr src);
00387
00395 int
00396 NodeList_count_elem(const NodeList_ptr self, node_ptr elem);
00397
00407 int
00408 NodeList_foreach(NodeList_ptr self, NODE_LIST_FOREACH_FUN_P foo,
00409 void* user_data);
00410
00419 NodeList_ptr NodeList_map(const NodeList_ptr self, NPFN foo);
00420
00429 NodeList_ptr NodeList_filter(const NodeList_ptr self, BPFN foo);
00430
00437 void NodeList_sort(NodeList_ptr self, int (*cmp)(const void* el1, const void* el2));
00438
00444 int NodeList_test(NuSMVEnv_ptr env);
00445
00446
00447 #endif