42std::vector<std::string>
43MeanData::getIDList() {
44 std::vector<std::string> ids;
45 for (
const auto& item :
MSNet::getInstance()->getDetectorControl().getMeanData()) {
46 ids.push_back(item.first);
48 std::sort(ids.begin(), ids.end());
53MeanData::getIDCount() {
54 return (
int)getIDList().size();
59MeanData::getParameter(
const std::string& ,
const std::string& ) {
66MeanData::setParameter(
const std::string& ,
const std::string& ,
const std::string& ) {
76MeanData::getMeanData(
const std::string&
id) {
78 auto it = mdMap.find(
id);
79 if (it == mdMap.end() || it->second.size() == 0) {
80 throw TraCIException(
"MeanData '" +
id +
"' is not known");
82 if (it->second.size() > 1) {
85 return it->second.front();
89std::shared_ptr<VariableWrapper>
90MeanData::makeWrapper() {
91 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
96MeanData::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
99 return wrapper->wrapStringList(objID, variable, getIDList());
101 return wrapper->wrapInt(objID, variable, getIDCount());
104 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
107 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
#define WRITE_WARNINGF(...)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
const std::map< std::string, std::vector< MSMeanData * > > & getMeanData() const
Data collector for edges/lanes.
The simulated network and simulation perfomer.
MSDetectorControl & getDetectorControl()
Returns the detector control.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
C++ TraCI client API implementation.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_PARAMETER_WITH_KEY