libsesstype  2.0.0
Library for Session Types programming.
msg.h
Go to the documentation of this file.
00001 
00005 #ifndef SESSTYPE__PARAMETERISED__MSG_H__
00006 #define SESSTYPE__PARAMETERISED__MSG_H__
00007 
00008 #ifdef __cplusplus
00009 #include <vector>
00010 #endif
00011 
00012 #include "sesstype/msg.h"
00013 #include "sesstype/parameterised/expr.h"
00014 
00015 #ifdef __cplusplus
00016 namespace sesstype {
00017 namespace parameterised {
00018 #endif
00019 
00020 #ifdef __cplusplus
00021 
00024 class MsgPayload : public sesstype::MsgPayload {
00025     std::vector<Expr *> param_;
00026 
00027   public:
00029     MsgPayload(std::string type) : sesstype::MsgPayload(type), param_() { }
00030 
00034     MsgPayload(std::string type, std::string name)
00035         : sesstype::MsgPayload(type, name), param_() { }
00036 
00038     MsgPayload(const MsgPayload &payload)
00039         : sesstype::MsgPayload(payload), param_()
00040     {
00041         for (auto param : param_) {
00042             param_.emplace_back(param);
00043         }
00044     }
00045 
00047     ~MsgPayload()
00048     {
00049         for (auto param : param_) {
00050             delete param;
00051         }
00052     }
00053 
00055     unsigned int num_dimens() const
00056     {
00057         return param_.size();
00058     }
00059 
00062     void add_param(Expr *param)
00063     {
00064         param_.push_back(param);
00065     }
00066 
00070     Expr *operator[](unsigned int idx)
00071     {
00072         return param_.at(idx);
00073     }
00074 };
00075 
00076 using MsgSig = sesstype::MsgSig;
00077 #endif
00078 
00079 #ifdef __cplusplus
00080 } // namespace parameterised
00081 } // namespace sesstype
00082 #endif
00083 
00084 #endif//SESSTYPE__PARAMETERISED__MSG_H__
 All Classes Namespaces Files Functions