44 #include <mesosim/MEInductLoop.h>
47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
63 for (std::vector<MSMeanData*>::const_iterator i =
myMeanData.begin(); i !=
myMeanData.end(); ++i) {
131 for (std::map<std::string, MSDetectorFileOutput*>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
132 (*j).second->detectorUpdate(step);
135 for (std::vector<MSMeanData*>::const_iterator i =
myMeanData.begin(); i !=
myMeanData.end(); ++i) {
136 (*i)->detectorUpdate(step);
149 for (DetectorFileVec::iterator it = dfVec.begin(); it != dfVec.end(); ++it) {
172 detAndFileVec.push_back(std::make_pair(det, device));
173 myIntervals.insert(std::make_pair(key, detAndFileVec));
177 if (find_if(detAndFileVec.begin(), detAndFileVec.end(), bind2nd(
detectorEquals(), det)) == detAndFileVec.end()) {
178 detAndFileVec.push_back(std::make_pair(det, device));
181 WRITE_WARNING(
"MSDetectorControl::addDetectorAndInterval: detector already in container. Ignoring.");
std::vector< DetectorFilePair > DetectorFileVec
Container holding DetectorFilePair (with the same interval).
Data collector for edges/lanes.
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::vector< MSMeanData * > myMeanData
List of harmonoise detectors.
std::map< IntervalsKey, SUMOTime > myLastCalls
The map that holds the last call for each sample interval.
virtual bool add(const std::string &id, T item)
Adds an item.
void updateDetectors(const SUMOTime step)
Computes detector values.
void writeOutput(SUMOTime step, bool closing)
Writes the output to be generated within the given time step.
Returns true if detectors are equal.
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const =0
Open the XML-output.
const std::string & getID() const
Returns the id.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
NamedObjectCont< MSDetectorFileOutput * > myEmptyContainer
An empty container to return in getTypedDetectors() if no detectors of the asked type exist...
SUMOTime string2time(const std::string &r)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
std::pair< SUMOTime, SUMOTime > IntervalsKey
Definition of the interval key.
std::map< SumoXMLTag, NamedObjectCont< MSDetectorFileOutput * > > myDetectors
The detectors map, first by detector type, then using NamedObjectCont (.
const IDMap & getMyMap() const
void close(SUMOTime step)
Closes the detector outputs.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
~MSDetectorControl()
Destructor.
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, int splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
virtual void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)=0
Write the generated output to the given device.
Static storage of an output device and its base (abstract) implementation.
MSDetectorControl()
Constructor.
Intervals myIntervals
Map that hold DetectorFileVec for given intervals.
void addDetectorAndInterval(MSDetectorFileOutput *det, OutputDevice *device, SUMOTime interval, SUMOTime begin=-1)
Adds one of the detectors as a new MSDetectorFileOutput.
Base of value-generating classes (detectors)
void init()
Adds the value collectors to all relevant edges.