![]() |
libsesstype
2.0.0
Library for Session Types programming.
|
00001 00005 #ifndef SESSTYPE__NODE_H__ 00006 #define SESSTYPE__NODE_H__ 00007 00008 #include "sesstype/msg.h" 00009 #include "sesstype/role.h" 00010 #include "sesstype/util/clonable.h" 00011 00012 #ifdef __cplusplus 00013 namespace sesstype { 00014 namespace util { 00015 00016 class NodeVisitor; 00017 00018 } // namesapce util 00019 } // namespace sesstype 00020 #endif 00021 00022 #ifdef __cplusplus 00023 namespace sesstype { 00024 #endif 00025 00026 #define ST_NODE_ROOT 0 00027 #define ST_NODE_SENDRECV 1 00028 #define ST_NODE_CHOICE 2 00029 #define ST_NODE_RECUR 3 00030 #define ST_NODE_CONTINUE 4 00031 #define ST_NODE_PARALLEL 5 00032 #define ST_NODE_NESTED 6 00033 #define ST_NODE_INTERRUPTIBLE 7 00034 00035 #ifdef __cplusplus 00036 00041 class Node : public util::Clonable { 00042 unsigned int type_; 00043 00044 public: 00046 virtual ~Node() { } 00047 00049 unsigned int type() const { return type_; } 00050 00051 virtual void accept(util::NodeVisitor &v) { }; 00052 00053 friend std::ostream &operator<<(std::ostream &os, Node &node); 00054 00055 protected: 00056 explicit Node(unsigned int type) : type_(type) { } 00057 }; 00058 #endif // __cplusplus 00059 00060 #ifdef __cplusplus 00061 extern "C" { 00062 #endif 00063 00064 #ifdef __cplusplus 00065 typedef Node st_node; 00066 #else 00067 typedef struct Node st_node; 00068 #endif // __cplusplus 00069 00070 st_node *st_node_project(st_node *const node, st_role *const endpoint); 00071 00072 void st_node_print(st_node *const node); 00073 00074 void st_node_free(st_node *node); 00075 00076 #ifdef __cplusplus 00077 } // extern "C" 00078 #endif 00079 00080 #ifdef __cplusplus 00081 } // namespace sesstype 00082 #endif 00083 00084 #endif//SESSTYPE__NODE_H__