00001 #include "SIGEL_Simulation/SIG_Recorder.h" 00002 00003 SIGEL_Simulation::SIG_Recorder::SIG_Recorder() 00004 : initialized(false), finished(false) 00005 { 00006 simulationQueries = 0; 00007 }; 00008 00009 void SIGEL_Simulation::SIG_Recorder::init() 00010 throw(SIGEL_Simulation::SIG_RecorderNoQueriesSetException, 00011 SIGEL_Simulation::SIG_RecorderBadRecordingOrderException) 00012 { 00013 if (simulationQueries==0) 00014 throw SIG_RecorderNoQueriesSetException(__FILE__,__LINE__,"Init called before setSimulationQueries"); 00015 if (initialized) 00016 throw SIG_RecorderBadRecordingOrderException(__FILE__,__LINE__,"Init called more than once"); 00017 initialized=true; 00018 }; 00019 00020 void SIGEL_Simulation::SIG_Recorder::record() 00021 throw(SIGEL_Simulation::SIG_RecorderNoQueriesSetException, 00022 SIGEL_Simulation::SIG_RecorderBadRecordingOrderException) 00023 { 00024 if (simulationQueries==0) 00025 throw SIG_RecorderNoQueriesSetException(__FILE__,__LINE__,"Record called before setSimulationQueries"); 00026 if (!initialized) 00027 throw SIG_RecorderBadRecordingOrderException(__FILE__,__LINE__,"Record called before Init"); 00028 if (finished) 00029 throw SIG_RecorderBadRecordingOrderException(__FILE__,__LINE__,"Record called after Finish"); 00030 }; 00031 00032 void SIGEL_Simulation::SIG_Recorder::finish() 00033 throw(SIGEL_Simulation::SIG_RecorderNoQueriesSetException, 00034 SIGEL_Simulation::SIG_RecorderBadRecordingOrderException) 00035 { 00036 if (simulationQueries==0) 00037 throw SIG_RecorderNoQueriesSetException(__FILE__,__LINE__,"Finish called before setSimulationQueries"); 00038 if (!initialized) 00039 throw SIG_RecorderBadRecordingOrderException(__FILE__,__LINE__,"Finish called before Init"); 00040 if (finished) 00041 throw SIG_RecorderBadRecordingOrderException(__FILE__,__LINE__,"Finish called more than once"); 00042 finished = true; 00043 }; 00044 00045 void SIGEL_Simulation::SIG_Recorder::setSimulationQueries(SIG_SimulationQueries const &newSimulationQueries) 00046 { 00047 simulationQueries=&newSimulationQueries; 00048 };