43 #ifdef CHECK_MEMORY_LEAKS
45 #endif // CHECK_MEMORY_LEAKS
59 for (std::vector<MSMeanData*>::const_iterator i =
myMeanData.begin(); i !=
myMeanData.end(); ++i) {
104 const std::vector<SumoXMLTag>
106 std::vector<SumoXMLTag> result;
108 result.push_back(i->first);
127 for (std::map<std::string, MSDetectorFileOutput*>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
128 (*j).second->detectorUpdate(step);
131 for (std::vector<MSMeanData*>::const_iterator i =
myMeanData.begin(); i !=
myMeanData.end(); ++i) {
132 (*i)->detectorUpdate(step);
145 for (DetectorFileVec::iterator it = dfVec.begin(); it != dfVec.end(); ++it) {
168 detAndFileVec.push_back(std::make_pair(det, device));
169 myIntervals.insert(std::make_pair(key, detAndFileVec));
173 if (find_if(detAndFileVec.begin(), detAndFileVec.end(), bind2nd(
detectorEquals(), det)) == detAndFileVec.end()) {
174 detAndFileVec.push_back(std::make_pair(det, device));
177 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.
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)
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, SUMOTime splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
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
const std::vector< SumoXMLTag > getAvailableTypes() const
Returns the list of available detector types.
void close(SUMOTime step)
Closes the detector outputs.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
~MSDetectorControl()
Destructor.
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.