MSTriggeredReader Class Reference

#include <MSTriggeredReader.h>

Inheritance diagram for MSTriggeredReader:

MSTriggeredXMLReader MSCalibrator::MSCalibrator_FileTriggeredChild MSEmitter::MSEmitter_FileTriggeredChild

Detailed Description

Superclass for structures that read from a file where the times the next reading is performed are triggered by events,

Definition at line 44 of file MSTriggeredReader.h.


Public Member Functions

void init ()
bool isInitialised () const
SUMOTime wrappedExecute (SUMOTime current) throw (ProcessError)
virtual ~MSTriggeredReader ()
 Destructor.

Protected Member Functions

virtual void inputEndReached ()=0
 MSTriggeredReader (MSNet &net)
 Constructor (for an abstract class).
virtual void myInit ()=0
virtual bool processNextEntryReaderTriggered ()=0
 Processes the next event Returns true if the next element shall be read (a new timestemp is then available also) Returns false if the action could not be accomplished; this method is then called in the next step again.
virtual bool readNextTriggered ()=0
 Reads from the file.
SUMOTime warppedExecute (SUMOTime currentTime) throw (ProcessError)

Protected Attributes

SUMOTime myOffset
 The offset to the next event.
bool myWasInitialised

Private Member Functions

 MSTriggeredReader (const MSTriggeredReader &)
 Invalidated copy constructor.
MSTriggeredReaderoperator= (const MSTriggeredReader &)
 Invalidated assignment operator.

Constructor & Destructor Documentation

MSTriggeredReader::~MSTriggeredReader (  )  [virtual]

Destructor.

Definition at line 45 of file MSTriggeredReader.cpp.

00045 {}

MSTriggeredReader::MSTriggeredReader ( MSNet net  )  [protected]

Constructor (for an abstract class).

Definition at line 41 of file MSTriggeredReader.cpp.

00042         : myOffset(0), myWasInitialised(false) {}

MSTriggeredReader::MSTriggeredReader ( const MSTriggeredReader  )  [private]

Invalidated copy constructor.


Member Function Documentation

void MSTriggeredReader::init (  ) 

Definition at line 49 of file MSTriggeredReader.cpp.

References myInit(), and myWasInitialised.

Referenced by wrappedExecute(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00049                         {
00050     myInit();
00051     myWasInitialised = true;
00052 }

virtual void MSTriggeredReader::inputEndReached (  )  [protected, pure virtual]

bool MSTriggeredReader::isInitialised (  )  const

Definition at line 56 of file MSTriggeredReader.cpp.

References myWasInitialised.

Referenced by wrappedExecute(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00056                                        {
00057     return myWasInitialised;
00058 }

virtual void MSTriggeredReader::myInit (  )  [protected, pure virtual]

Implemented in MSTriggeredXMLReader.

Referenced by init().

MSTriggeredReader& MSTriggeredReader::operator= ( const MSTriggeredReader  )  [private]

Invalidated assignment operator.

virtual bool MSTriggeredReader::processNextEntryReaderTriggered (  )  [protected, pure virtual]

Processes the next event Returns true if the next element shall be read (a new timestemp is then available also) Returns false if the action could not be accomplished; this method is then called in the next step again.

Implemented in MSCalibrator::MSCalibrator_FileTriggeredChild, and MSEmitter::MSEmitter_FileTriggeredChild.

Referenced by wrappedExecute().

virtual bool MSTriggeredReader::readNextTriggered (  )  [protected, pure virtual]

Reads from the file.

Implemented in MSTriggeredXMLReader.

Referenced by wrappedExecute().

SUMOTime MSTriggeredReader::warppedExecute ( SUMOTime  currentTime  )  throw (ProcessError) [protected]

SUMOTime MSTriggeredReader::wrappedExecute ( SUMOTime  current  )  throw (ProcessError)

Definition at line 62 of file MSTriggeredReader.cpp.

References DELTA_T, init(), isInitialised(), myOffset, processNextEntryReaderTriggered(), and readNextTriggered().

Referenced by MSTriggeredXMLReader::MSTriggeredXMLReader().

00062                                                                       {
00063     if (!isInitialised()) {
00064         init();
00065     }
00066     SUMOTime next = current;
00067     // loop until the next action lies in the future
00068     while (current==next) {
00069         // run the next action
00070         //  if it could be accomplished...
00071         if (processNextEntryReaderTriggered()) {
00072             // read the next one
00073             if (readNextTriggered()) {
00074                 // set the time for comparison if a next one exists
00075                 next = myOffset;
00076             } else {
00077                 // leave if no further exists
00078                 return 0;
00079             }
00080         } else {
00081             // action could not been accomplished; try next time step
00082             return DELTA_T;
00083         }
00084     }
00085     // come back if the next action shall be executed
00086     if (myOffset - current<=0) {
00087         // current is delayed;
00088         return DELTA_T;
00089     }
00090     return myOffset - current;
00091 }


Field Documentation

Definition at line 74 of file MSTriggeredReader.h.

Referenced by init(), and isInitialised().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:50 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6