本文整理汇总了C++中tcpip::Storage::writeDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ Storage::writeDouble方法的具体用法?C++ Storage::writeDouble怎么用?C++ Storage::writeDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcpip::Storage
的用法示例。
在下文中一共展示了Storage::writeDouble方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TraCIServerAPI_Simulation::writeStage(tcpip::Storage& outputStorage, const libsumo::TraCIStage& stage) {
outputStorage.writeUnsignedByte(TYPE_COMPOUND);
outputStorage.writeInt(6);
outputStorage.writeUnsignedByte(TYPE_INTEGER);
outputStorage.writeInt(stage.type);
outputStorage.writeUnsignedByte(TYPE_STRING);
outputStorage.writeString(stage.line);
outputStorage.writeUnsignedByte(TYPE_STRING);
outputStorage.writeString(stage.destStop);
outputStorage.writeUnsignedByte(TYPE_STRINGLIST);
outputStorage.writeStringList(stage.edges);
outputStorage.writeUnsignedByte(TYPE_DOUBLE);
outputStorage.writeDouble(stage.travelTime);
outputStorage.writeUnsignedByte(TYPE_DOUBLE);
outputStorage.writeDouble(stage.cost);
outputStorage.writeUnsignedByte(TYPE_STRING);
outputStorage.writeString(stage.intended);
outputStorage.writeUnsignedByte(TYPE_DOUBLE);
outputStorage.writeDouble(stage.depart);
}
示例2: switch
bool
TraCIServerAPI_VehicleType::getVariable(const int variable, const MSVehicleType& v, tcpip::Storage& tempMsg) {
switch (variable) {
case VAR_LENGTH:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getLength());
break;
case VAR_MINGAP:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getMinGap());
break;
case VAR_MAXSPEED:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getMaxSpeed());
break;
case VAR_ACCEL:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getCarFollowModel().getMaxAccel());
break;
case VAR_DECEL:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getCarFollowModel().getMaxDecel());
break;
case VAR_IMPERFECTION:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getCarFollowModel().getImperfection());
break;
case VAR_TAU:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getCarFollowModel().getHeadwayTime());
break;
case VAR_SPEED_FACTOR:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getSpeedFactor());
break;
case VAR_SPEED_DEVIATION:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getSpeedDeviation());
break;
case VAR_VEHICLECLASS:
tempMsg.writeUnsignedByte(TYPE_STRING);
tempMsg.writeString(toString(v.getVehicleClass()));
break;
case VAR_EMISSIONCLASS:
tempMsg.writeUnsignedByte(TYPE_STRING);
tempMsg.writeString(getVehicleEmissionTypeName(v.getEmissionClass()));
break;
case VAR_SHAPECLASS:
tempMsg.writeUnsignedByte(TYPE_STRING);
tempMsg.writeString(getVehicleShapeName(v.getGuiShape()));
break;
case VAR_WIDTH:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v.getGuiWidth());
break;
case VAR_COLOR:
tempMsg.writeUnsignedByte(TYPE_COLOR);
tempMsg.writeUnsignedByte(static_cast<int>(v.getColor().red() * 255. + 0.5));
tempMsg.writeUnsignedByte(static_cast<int>(v.getColor().green() * 255. + 0.5));
tempMsg.writeUnsignedByte(static_cast<int>(v.getColor().blue() * 255. + 0.5));
tempMsg.writeUnsignedByte(255);
break;
default:
break;
}
return true;
}