00001 00003 /* 00004 FAU Discrete Event Systems Library (libfaudes) 00005 00006 Copyright (C) 2008 Thomas Moor 00007 00008 */ 00009 00010 // load configuration 00011 #include "corefaudes.h" 00012 00013 #ifndef FAUDES_SP_DPLPEXECUTOR_H 00014 #define FAUDES_SP_DPLPEXECUTOR_H 00015 00016 00017 #include "tp_include.h" 00018 #include "sp_plpexecutor.h" 00019 #include "sp_simeventset.h" 00020 #include <ctime> 00021 00022 00023 // use iodevice or dummy if not available 00024 #ifdef FAUDES_PLUGIN_IODEVICE 00025 #include "iop_include.h" 00026 #else 00027 namespace faudes { 00029 typedef void vDevice; 00030 } 00031 #endif 00032 00033 namespace faudes { 00034 00077 class DeviceExecutor : public ProposingExecutor { 00078 00079 public: 00080 00081 /***************************************** 00082 ***************************************** 00083 ***************************************** 00084 *****************************************/ 00085 00092 DeviceExecutor(); 00093 00097 ~DeviceExecutor(); 00098 00099 00102 /***************************************** 00103 ***************************************** 00104 ***************************************** 00105 *****************************************/ 00106 00119 virtual void Reset(long int seed=0); 00120 00127 virtual void Clear(void); 00128 00129 00141 bool ExecuteEvent(Idx event); 00142 00143 00159 bool SyncTime(void); 00160 00171 Idx SyncEvents(); 00172 00173 00187 bool SyncWait(tpTime::Type duration=tpTime::Max); 00188 00200 Idx SyncStep(tpTime::Type duration=tpTime::Max); 00201 00212 bool SyncRun(tpTime::Type duration=tpTime::Max); 00213 00221 bool IsSynchronous(void) const { return ! mSyncError; }; 00222 00230 void Tolerance(tpTime::Type maxgap) {mMaxSyncGap=maxgap;}; 00231 00243 void Devicep(vDevice* dev); 00244 00249 void DeviceStart(void); 00250 00255 void DeviceStop(void); 00256 00259 protected: 00260 00261 00263 bool mSyncError; 00264 00266 tpTime::Type mMaxSyncGap; 00267 00269 vDevice* pDevice; 00270 00271 00272 00273 }; // end class DeviceExecutor 00274 00275 00276 00277 } // namespace faudes 00278 00279 00280 #endif // .h 00281