libsesstype  2.0.0
Library for Session Types programming.
rng.h
00001 #ifndef SESSTYPE__PARAMETERISED__EXPR__RNG_H__
00002 #define SESSTYPE__PARAMETERISED__EXPR__RNG_H__
00003 
00004 #ifdef __cplusplus
00005 #include <string>
00006 #endif
00007 
00008 #include "sesstype/parameterised/expr.h"
00009 
00010 #ifdef __cplusplus
00011 namespace sesstype {
00012 namespace parameterised {
00013 #endif
00014 
00015 #ifdef __cplusplus
00016 
00022 class RngExpr : public Expr {
00023     std::string bindvar_;
00024     Expr *from_;
00025     Expr *to_;
00026 
00027   public:
00031     RngExpr(Expr *from, Expr *to)
00032         : Expr(ST_EXPR_RNG),bindvar_(), from_(from), to_(to) { }
00033 
00038     RngExpr(std::string bindvar, Expr *from, Expr *to)
00039         : Expr(ST_EXPR_RNG), bindvar_(bindvar), from_(from), to_(to) { }
00040 
00042     RngExpr(const RngExpr &expr)
00043         : Expr(ST_EXPR_RNG),
00044           bindvar_(expr.bindvar_), from_(expr.from_->clone()), to_(expr.to_->clone()) { }
00045 
00047     ~RngExpr() override
00048     {
00049         delete from_;
00050         delete to_;
00051     }
00052 
00054     RngExpr *clone() const override
00055     {
00056         return new RngExpr(*this);
00057     }
00058 
00061     void set_bindvar(std::string bindvar)
00062     {
00063         bindvar_ = bindvar;
00064     }
00065 
00067     std::string bindvar() const
00068     {
00069         return bindvar_;
00070     }
00071 
00073     void set_from(Expr *from)
00074     {
00075         delete from_;
00076         from_ = from;
00077     }
00078 
00080     Expr *from() const
00081     {
00082         return from_;
00083     }
00084 
00086     void set_to(Expr *to)
00087     {
00088         delete to_;
00089         to_ = to;
00090     }
00091 
00093     Expr *to() const
00094     {
00095         return to_;
00096     }
00097 
00098     virtual void accept(util::ExprVisitor &v) override;
00099 };
00100 #endif // __cplusplus
00101 
00102 #ifdef __cplusplus
00103 extern "C" {
00104 #endif
00105 
00106 #ifdef __cplusplus
00107 typedef RngExpr st_rng_expr; 
00108 #else
00109 typedef struct RngExpr st_rng_expr; 
00110 #endif
00111 
00117 st_expr *st_expr_mk_range(char *bindvar, st_expr *from, st_expr *to);
00118 
00119 #ifdef __cplusplus
00120 } // extern "C"
00121 #endif
00122 
00123 #ifdef __cplusplus
00124 } // namespace parameterised
00125 } // namespace sesstype
00126 #endif
00127 
00128 #endif//SESSTYPE__PARAMETERISED__EXPR__RNG_H__
 All Classes Namespaces Files Functions