00001 // File: con.h 00002 // Module for conservative simulation strategy class 00003 // Last Modified: 06.05.01 by Terry L. Wilmarth 00004 00005 #ifndef CONS_H 00006 #define CONS_H 00007 00008 class con : public strat { 00009 protected: 00010 virtual void CancelEvents(); 00011 public: 00012 void initSync() { parent->sync = CONSERVATIVE; } 00013 virtual void Step(); 00014 POSE_TimeType SafeTime() { // computes the safe time for this object: the object in 00015 // its current state cannot generate an event or cancellation earlier than 00016 // its safe time 00017 POSE_TimeType hightime = userObj->OVT(), lowtime; 00018 00019 if ((parent->cancels.getEarliest() < 0) 00020 && (eq->currentPtr->timestamp < 0) 00021 && (userObj->OVT() <= localPVT->getGVT())) 00022 return POSE_UnsetTS; // this corresponds to an idle object; ignore its safe time 00023 00024 if (eq->currentPtr->timestamp > hightime) // check next queued event 00025 hightime = eq->currentPtr->timestamp; 00026 00027 lowtime = hightime; 00028 if (parent->cancels.getEarliest() >= 0) // check cancellations 00029 lowtime = parent->cancels.getEarliest(); 00030 00031 if (lowtime < hightime) 00032 return lowtime; 00033 else 00034 return hightime; 00035 } 00036 }; 00037 00038 #endif