-
Notifications
You must be signed in to change notification settings - Fork 6
/
simobj.h
22 lines (19 loc) · 1.01 KB
/
simobj.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "simcpp.h"
#define OBSERVABLE_PROPERTY(TYP, NAM, VAL) \
private: \
TYP NAM = VAL; \
\
public: \
shared_ptr<Event> NAM##_event = std::make_shared<Event>(env); \
TYP get_##NAM() { return this->NAM; } \
void set_##NAM(TYP v) { \
this->NAM = v; \
this->env->schedule(this->NAM##_event); \
this->NAM##_event = std::make_shared<Event>(env); \
}
class EnvObj {
protected:
shared_ptr<Simulation> env;
public:
EnvObj(shared_ptr<Simulation> s) : env(s) {}
};