libsesstype  2.0.0
Library for Session Types programming.
role.h
Go to the documentation of this file.
00001 
00005 #ifndef SESSTYPE__ROLE_H__
00006 #define SESSTYPE__ROLE_H__
00007 
00008 #ifdef __cplusplus
00009 #include <string>
00010 #include <vector>
00011 #endif
00012 
00013 #include "sesstype/util/clonable.h"
00014 #include "sesstype/util/visitor_tmpl.h"
00015 #include "sesstype/util/role_visitor.h"
00016 
00017 #ifdef __cplusplus
00018 namespace sesstype {
00019 class Role;
00020 } // namespace sesstype
00021 #endif
00022 
00023 #ifdef __cplusplus
00024 namespace sesstype {
00025 #endif
00026 
00027 #ifdef __cplusplus
00028 
00031 class Role : public util::Clonable {
00032     std::string name_;
00033 
00034   public:
00036     Role() : name_("default") { }
00037 
00039     Role(std::string name) : name_(name) { }
00040 
00042     Role(const Role &role) : name_(role.name_) { }
00043 
00045     virtual ~Role() { }
00046 
00048     virtual Role *clone() const override
00049     {
00050         return new Role(*this);
00051     }
00052 
00054     std::string name() const
00055     {
00056         return name_;
00057     }
00058 
00060     void set_name(std::string name)
00061     {
00062         name_ = name;
00063     }
00064 
00067     virtual bool matches(Role *other) const
00068     {
00069         return (name_ == other->name_);
00070     }
00071 
00072     virtual void accept(util::RoleVisitor &v);
00073 };
00074 #endif // __cplusplus
00075 
00076 #ifdef __cplusplus
00077 extern "C" {
00078 #endif
00079 
00080 #ifdef __cplusplus
00081 typedef Role st_role;
00082 #else
00083 typedef struct Role st_role;
00084 #endif
00085 
00089 st_role *st_role_init(const char *name);
00090 
00094 st_role *st_role_copy(const st_role *const role);
00095 
00099 const char *st_role_name(st_role *const role);
00100 
00105 st_role *st_role_set_name(st_role *const role, const char *name);
00106 
00109 void st_role_free(st_role *role);
00110 
00111 #ifdef __cplusplus
00112 } // extern "C"
00113 #endif
00114 
00115 #ifdef __cplusplus
00116 } // namespace sesstype
00117 #endif
00118 
00119 #endif//SESSTYPE__ROLE_H__
 All Classes Namespaces Files Functions