MSDetectorControl.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Detectors container; responsible for string and output generation
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef MSDetectorControl_h
00020 #define MSDetectorControl_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <vector>
00034 #include <utils/common/NamedObjectCont.h>
00035 #include <microsim/output/MSE2Collector.h>
00036 #include <microsim/output/MS_E2_ZS_CollectorOverLanes.h>
00037 #include <microsim/output/MSE3Collector.h>
00038 #include <microsim/output/MSInductLoop.h>
00039 #include <microsim/output/MSRouteProbe.h>
00040 
00041 #ifdef _MESSAGES
00042 #include <microsim/output/MSMsgInductLoop.h>
00043 #endif
00044 
00045 #ifdef HAVE_MESOSIM
00046 #include <mesosim/MEInductLoop.h>
00047 #endif
00048 
00049 
00050 // ===========================================================================
00051 // class declarations
00052 // ===========================================================================
00053 class MSMeanData_Harmonoise;
00054 
00055 
00056 // ===========================================================================
00057 // class definitions
00058 // ===========================================================================
00063 class MSDetectorControl {
00064 public:
00067 
00068 #ifdef _MESSAGES
00070     typedef NamedObjectCont< MSMsgInductLoop*> MsgLoopDict;
00071 #endif
00072 
00074     typedef NamedObjectCont< MSInductLoop*> LoopDict;
00075 
00077     typedef NamedObjectCont< MSE2Collector*> E2Dict;
00078 
00080     typedef NamedObjectCont< MSE3Collector*> E3Dict;
00081 
00083     typedef NamedObjectCont< MS_E2_ZS_CollectorOverLanes* > E2ZSOLDict;
00084 
00086     typedef NamedObjectCont< MSRouteProbe* > RouteProbeDict;
00087 
00088 #ifdef HAVE_MESOSIM
00090     typedef NamedObjectCont< MEInductLoop*> MELoopDict;
00091 #endif
00092 
00093 
00095     typedef std::vector< MSInductLoop*> LoopVect;
00096 
00098     typedef std::vector< MSE2Collector*> E2Vect;
00099 
00101     typedef std::vector< MSE3Collector*> E3Vect;
00102 
00104     typedef std::vector< MS_E2_ZS_CollectorOverLanes* > E2ZSOLVect;
00105 
00106 #ifdef HAVE_MESOSIM
00108     typedef std::vector< MEInductLoop*> MELoopVect;
00109 #endif
00111 
00112 
00113 public:
00116     MSDetectorControl() throw();
00117 
00118 
00123     ~MSDetectorControl() throw();
00124 
00125 
00134     void close(SUMOTime step) throw(IOError);
00135 
00136 
00139 
00140 #ifdef _MESSAGES
00141 
00146     void add(MSMsgInductLoop *msgl, OutputDevice& device, int splInterval) throw(ProcessError);
00147 #endif
00148 
00164     void add(MSInductLoop *il, OutputDevice& device, int splInterval) throw(ProcessError);
00165 
00166 
00182     void add(MSE2Collector *e2, OutputDevice& device, int splInterval) throw(ProcessError);
00183 
00184 
00200     void add(MS_E2_ZS_CollectorOverLanes *e2ol, OutputDevice& device,
00201              int splInterval) throw(ProcessError);
00202 
00203 
00219     void add(MSE3Collector *e3, OutputDevice& device, int splInterval) throw(ProcessError);
00220 
00221 
00234     void add(MSRouteProbe *vp, OutputDevice& device, SUMOTime frequency, SUMOTime begin) throw(ProcessError);
00235 
00236 
00237 #ifdef HAVE_MESOSIM
00238 
00253     void add(MEInductLoop *il, OutputDevice& device, int splInterval) throw(ProcessError);
00254 #endif
00256 
00257 
00258 
00261 
00273     void add(MSE2Collector *e2) throw(ProcessError);
00274 
00275 
00287     void add(MS_E2_ZS_CollectorOverLanes *e2ol) throw(ProcessError);
00288 
00289 
00298     void add(MSMeanData_Harmonoise *mn) throw();
00299 
00301 
00302 
00312     void addDetectorAndInterval(MSDetectorFileOutput* det,
00313                                 OutputDevice *device,
00314                                 SUMOTime interval, SUMOTime begin=-1) throw();
00315 
00316 
00317 
00320 
00325     const LoopDict &getInductLoops() const throw() {
00326         return myLoops;
00327     }
00328 
00329 
00334     const E2Dict &getE2Detectors() const throw() {
00335         return myE2Detectors;
00336     }
00337 
00338 
00343     const E3Dict &getE3Detectors() const throw() {
00344         return myE3Detectors;
00345     }
00346 
00347 
00352     const E2ZSOLDict &getE2OLDetectors() const throw() {
00353         return myE2OverLanesDetectors;
00354     }
00356 
00357 
00358 
00370     void updateDetectors(SUMOTime step) throw();
00371 
00372 
00384     void writeOutput(SUMOTime step, bool closing) throw(IOError);
00385 
00386 
00387 protected:
00390 
00391 #ifdef _MESSAGES
00393     MsgLoopDict myMsgLoops;
00394 #endif
00395 
00397     typedef std::pair< MSDetectorFileOutput*, OutputDevice* > DetectorFilePair;
00398 
00400     typedef std::vector< DetectorFilePair > DetectorFileVec;
00401 
00403     typedef std::pair<SUMOTime, SUMOTime> IntervalsKey;
00404 
00406     typedef std::map< IntervalsKey, DetectorFileVec > Intervals;
00408 
00420     struct detectorEquals : public std::binary_function< DetectorFilePair, MSDetectorFileOutput*, bool > {
00422         bool operator()(const DetectorFilePair& pair, const MSDetectorFileOutput* det) const throw() {
00423             return pair.first == det;
00424         }
00425     };
00426 
00427 protected:
00430 
00432     LoopDict myLoops;
00433 
00435     E2Dict myE2Detectors;
00436 
00438     E3Dict myE3Detectors;
00439 
00441     E2ZSOLDict myE2OverLanesDetectors;
00442 
00444     RouteProbeDict myRouteProbeDetectors;
00445 
00446 #ifdef HAVE_MESOSIM
00448     MELoopDict myMesoLoops;
00449 #endif
00451 
00452 
00453     Intervals myIntervals;
00454 
00456     std::map<IntervalsKey, SUMOTime> myLastCalls;
00457 
00459     std::vector<MSMeanData_Harmonoise*> myHarmonoiseDetectors;
00460 
00461 
00462 private:
00464     MSDetectorControl(const MSDetectorControl&);
00465 
00467     MSDetectorControl& operator=(const MSDetectorControl&);
00468 
00469 
00470 };
00471 
00472 
00473 #endif
00474 
00475 /****************************************************************************/
00476 

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