00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef SST_ACTIVITY_H
00014 #define SST_ACTIVITY_H
00015
00016 #include <sst/core/sst.h>
00017
00018 namespace SST {
00019
00020 class Activity {
00021 public:
00022 Activity() {}
00023 virtual ~Activity() {}
00024
00025 virtual void execute(void) = 0;
00026
00027
00028 class less_time_priority {
00029 public:
00030 inline bool operator()(const Activity* lhs, const Activity* rhs) {
00031 if (lhs->delivery_time == rhs->delivery_time ) return lhs->priority < rhs->priority;
00032 else return lhs->delivery_time < rhs->delivery_time;
00033 }
00034
00035 inline bool operator()(const Activity& lhs, const Activity& rhs) {
00036 if (lhs.delivery_time == rhs.delivery_time ) return lhs.priority < rhs.priority;
00037 else return lhs.delivery_time < rhs.delivery_time;
00038 }
00039 };
00040
00041
00042 class less_time {
00043 public:
00044 inline bool operator()(const Activity* lhs, const Activity* rhs) {
00045 return lhs->delivery_time < rhs->delivery_time;
00046 }
00047
00048 inline bool operator()(const Activity& lhs, const Activity& rhs) {
00049 return lhs.delivery_time < rhs.delivery_time;
00050 }
00051 };
00052
00053 void setDeliveryTime(int time) {
00054 delivery_time = time;
00055 }
00056
00057 inline SimTime_t getDeliveryTime() const {
00058 return delivery_time;
00059 }
00060
00061 inline int getPriority() const {
00062 return priority;
00063 }
00064
00065 protected:
00066 void setPriority(int priority) {
00067 this->priority = priority;
00068 }
00069
00070 private:
00071
00072 SimTime_t delivery_time;
00073 int priority;
00074
00075 friend class boost::serialization::access;
00076 template<class Archive>
00077 void
00078 serialize(Archive & ar, const unsigned int version )
00079 {
00080 }
00081 };
00082
00083 }
00084
00085 #endif // SST_ACTIVITY_H