本文整理汇总了C++中SUMOSAXAttributes::getBool方法的典型用法代码示例。如果您正苦于以下问题:C++ SUMOSAXAttributes::getBool方法的具体用法?C++ SUMOSAXAttributes::getBool怎么用?C++ SUMOSAXAttributes::getBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUMOSAXAttributes
的用法示例。
在下文中一共展示了SUMOSAXAttributes::getBool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iss
void
MSStateHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) {
MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl();
switch (element) {
case SUMO_TAG_SNAPSHOT: {
myTime = attrs.getInt(SUMO_ATTR_TIME);
const std::string& version = attrs.getString(SUMO_ATTR_VERSION);
if (version != VERSION_STRING) {
WRITE_WARNING("State was written with sumo version " + version + " (present: " + VERSION_STRING + ")!");
}
break;
}
case SUMO_TAG_DELAY: {
vc.setState(attrs.getInt(SUMO_ATTR_NUMBER), attrs.getInt(SUMO_ATTR_END),
attrs.getFloat(SUMO_ATTR_DEPART), attrs.getFloat(SUMO_ATTR_TIME));
break;
}
case SUMO_TAG_ROUTE: {
const std::string id = attrs.getString(SUMO_ATTR_ID);
if (MSRoute::dictionary(id) == 0) {
MSEdgeVector edges;
MSEdge::parseEdgesList(attrs.getString(SUMO_ATTR_EDGES), edges, id);
MSRoute* r = new MSRoute(id, edges, attrs.getBool(SUMO_ATTR_STATE),
0, std::vector<SUMOVehicleParameter::Stop>());
MSRoute::dictionary(id, r);
}
break;
}
case SUMO_TAG_ROUTE_DISTRIBUTION: {
const std::string id = attrs.getString(SUMO_ATTR_ID);
if (MSRoute::dictionary(id) == 0) {
RandomDistributor<const MSRoute*>* dist = new RandomDistributor<const MSRoute*>();
std::vector<std::string> routeIDs;
std::istringstream iss(attrs.getString(SUMO_ATTR_PROBS));
SUMOSAXAttributes::parseStringVector(attrs.getString(SUMO_ATTR_ROUTES), routeIDs);
for (std::vector<std::string>::const_iterator it = routeIDs.begin(); it != routeIDs.end(); ++it) {
SUMOReal prob;
iss >> prob;
const MSRoute* r = MSRoute::dictionary(*it);
assert(r != 0);
dist->add(prob, r, false);
r->addReference();
}
MSRoute::dictionary(id, dist, attrs.getBool(SUMO_ATTR_STATE));
}
break;
}
case SUMO_TAG_VTYPE: {
myCurrentVType = SUMOVehicleParserHelper::beginVTypeParsing(attrs, getFileName());
break;
}
case SUMO_TAG_VTYPE_DISTRIBUTION: {
const std::string id = attrs.getString(SUMO_ATTR_ID);
if (vc.getVType(id) == 0) {
RandomDistributor<MSVehicleType*>* dist = new RandomDistributor<MSVehicleType*>();
std::vector<std::string> typeIDs;
std::istringstream iss(attrs.getString(SUMO_ATTR_PROBS));
SUMOSAXAttributes::parseStringVector(attrs.getString(SUMO_ATTR_VTYPES), typeIDs);
for (std::vector<std::string>::const_iterator it = typeIDs.begin(); it != typeIDs.end(); ++it) {
SUMOReal prob;
iss >> prob;
MSVehicleType* t = vc.getVType(*it);
assert(t != 0);
dist->add(prob, t, false);
}
vc.addVTypeDistribution(id, dist);
}
break;
}