00001
00025 #ifndef SIMOBJECT_H_
00026 #define SIMOBJECT_H_
00027
00028 #include <vector>
00029 #include <queue>
00030
00031 #include <cassert>
00032
00033 #include "Galois/Graphs/Graph.h"
00034
00035 #include "comDefs.h"
00036 #include "BaseEvent.h"
00037 #include "LogicUpdate.h"
00038
00039 #include "Event.h"
00040
00041
00050 class SimObject {
00051 public:
00052 typedef Galois::Graph::FirstGraph <SimObject*, void, true> Graph;
00053 typedef Graph::GraphNode GNode;
00054 typedef Event<SimObject*, LogicUpdate> EventTy;
00055
00056
00057 public:
00058 virtual ~SimObject () {}
00063 virtual SimObject* clone() const = 0;
00064
00065
00077 virtual EventTy makeEvent(SimObject* sendObj, SimObject* recvObj, const EventTy::Type& type, const LogicUpdate& act
00078 , const SimTime& sendTime, SimTime delay = MIN_DELAY) = 0;
00079
00086 virtual void recvEvent(size_t inputIndex, const EventTy& e) = 0;
00087
00100 virtual void execEvent(Graph& graph, GNode& myNode, const EventTy& e) = 0;
00101
00109 virtual size_t simulate(Graph& graph, GNode& myNode) = 0;
00110
00111
00112
00118 virtual bool isActive() const = 0;
00119
00125 virtual void updateActive() = 0;
00126
00127 virtual size_t numPendingEvents () const = 0;
00128
00132 virtual const std::string toString() const = 0;
00133
00139 virtual size_t getId() const = 0;
00140
00141 protected:
00143 static const SimTime MIN_DELAY = 1l;
00144
00145
00146 };
00147
00148 #endif