本文整理汇总了C++中tcpip::Storage::readStringList方法的典型用法代码示例。如果您正苦于以下问题:C++ Storage::readStringList方法的具体用法?C++ Storage::readStringList怎么用?C++ Storage::readStringList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcpip::Storage
的用法示例。
在下文中一共展示了Storage::readStringList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
TraCIServer::readTypeCheckingStringList(tcpip::Storage& inputStorage, std::vector<std::string>& into) {
if (inputStorage.readUnsignedByte() != TYPE_STRINGLIST) {
return false;
}
into = inputStorage.readStringList();
return true;
}
示例2: switch
bool
TraCIServerAPI_Lane::processSet(TraCIServer &server, tcpip::Storage &inputStorage,
tcpip::Storage &outputStorage) {
std::string warning = ""; // additional description for response
// variable
int variable = inputStorage.readUnsignedByte();
if (variable!=VAR_MAXSPEED&&variable!=VAR_LENGTH&&variable!=LANE_ALLOWED&&variable!=LANE_DISALLOWED) {
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_ERR, "Change Lane State: unsupported variable specified", outputStorage);
return false;
}
// id
std::string id = inputStorage.readString();
MSLane *l = MSLane::dictionary(id);
if (l==0) {
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_ERR, "Lane '" + id + "' is not known", outputStorage);
return false;
}
// process
int valueDataType = inputStorage.readUnsignedByte();
switch (variable) {
case VAR_MAXSPEED: {
// speed
if (valueDataType!=TYPE_FLOAT) {
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_ERR, "The speed must be given as a float.", outputStorage);
return false;
}
SUMOReal val = inputStorage.readFloat();
l->setMaxSpeed(val);
}
break;
case VAR_LENGTH: {
// speed
if (valueDataType!=TYPE_FLOAT) {
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_ERR, "The length must be given as a float.", outputStorage);
return false;
}
SUMOReal val = inputStorage.readFloat();
l->setLength(val);
}
break;
case LANE_ALLOWED: {
if (valueDataType!=TYPE_STRINGLIST) {
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_ERR, "Allowed classes must be given as a list of strings.", outputStorage);
return false;
}
std::vector<SUMOVehicleClass> allowed;
parseVehicleClasses(inputStorage.readStringList(), allowed);
l->setAllowedClasses(allowed);
l->getEdge().rebuildAllowedLanes();
}
break;
case LANE_DISALLOWED: {
if (valueDataType!=TYPE_STRINGLIST) {
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_ERR, "Not allowed classes must be given as a list of strings.", outputStorage);
return false;
}
std::vector<SUMOVehicleClass> disallowed;
parseVehicleClasses(inputStorage.readStringList(), disallowed);
l->setNotAllowedClasses(disallowed);
l->getEdge().rebuildAllowedLanes();
}
break;
default:
break;
}
server.writeStatusCmd(CMD_SET_LANE_VARIABLE, RTYPE_OK, warning, outputStorage);
return true;
}