本文整理汇总了C++中OptionsCont::isSet方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsCont::isSet方法的具体用法?C++ OptionsCont::isSet怎么用?C++ OptionsCont::isSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsCont
的用法示例。
在下文中一共展示了OptionsCont::isSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loader
void
loadJTRDefinitions(RONet& net, OptionsCont& oc) {
// load the turning definitions (and possible sink definition)
if (oc.isSet("turn-ratio-files")) {
ROJTRTurnDefLoader loader(net);
std::vector<std::string> ratio_files = oc.getStringVector("turn-ratio-files");
for (std::vector<std::string>::const_iterator i = ratio_files.begin(); i != ratio_files.end(); ++i) {
if (!XMLSubSys::runParser(loader, *i)) {
throw ProcessError();
}
}
}
if (MsgHandler::getErrorInstance()->wasInformed() && oc.getBool("ignore-errors")) {
MsgHandler::getErrorInstance()->clear();
}
// parse sink edges specified at the input/within the configuration
if (oc.isSet("sink-edges")) {
std::vector<std::string> edges = oc.getStringVector("sink-edges");
for (std::vector<std::string>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
ROJTREdge* edge = static_cast<ROJTREdge*>(net.getEdge(*i));
if (edge == 0) {
throw ProcessError("The edge '" + *i + "' declared as a sink is not known.");
}
edge->setSink();
}
}
}
示例2: done
void
NBHeightMapper::loadIfSet(OptionsCont& oc) {
if (oc.isSet("heightmap.geotiff")) {
// parse file(s)
std::vector<std::string> files = oc.getStringVector("heightmap.geotiff");
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
PROGRESS_BEGIN_MESSAGE("Parsing from GeoTIFF '" + *file + "'");
int numFeatures = Singleton.loadTiff(*file);
MsgHandler::getMessageInstance()->endProcessMsg(
" done (parsed " + toString(numFeatures) +
" features, Boundary: " + toString(Singleton.getBoundary()) + ").");
}
}
if (oc.isSet("heightmap.shapefiles")) {
// parse file(s)
std::vector<std::string> files = oc.getStringVector("heightmap.shapefiles");
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
PROGRESS_BEGIN_MESSAGE("Parsing from shape-file '" + *file + "'");
int numFeatures = Singleton.loadShapeFile(*file);
MsgHandler::getMessageInstance()->endProcessMsg(
" done (parsed " + toString(numFeatures) +
" features, Boundary: " + toString(Singleton.getBoundary()) + ").");
}
}
}
示例3:
void
MSFrame::setMSGlobals(OptionsCont& oc) {
// pre-initialise the network
// set whether empty edges shall be printed on dump
MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges");
#ifdef HAVE_INTERNAL_LANES
// set whether internal lanes shall be used
MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links");
#else
MSGlobals::gUsingInternalLanes = false;
#endif
// set the grid lock time
MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport"));
MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents");
MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors");
#ifdef HAVE_INTERNAL
MSGlobals::gStateLoaded = oc.isSet("load-state");
MSGlobals::gUseMesoSim = oc.getBool("mesosim");
MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited");
if (MSGlobals::gUseMesoSim) {
MSGlobals::gUsingInternalLanes = false;
}
#endif
#ifdef HAVE_SUBSECOND_TIMESTEPS
DELTA_T = string2time(oc.getString("step-length"));
#endif
if (oc.isSet("routeDist.maxsize")) {
MSRoute::setMaxRouteDistSize(oc.getInt("routeDist.maxsize"));
}
}
示例4: loadPolyFiles
// ===========================================================================
// method definitions
// ===========================================================================
void
PCLoaderDlrNavteq::loadIfSet(OptionsCont& oc, PCPolyContainer& toFill,
PCTypeMap& tm) {
if (oc.isSet("dlr-navteq-poly-files")) {
loadPolyFiles(oc, toFill, tm);
}
if (oc.isSet("dlr-navteq-poi-files")) {
loadPOIFiles(oc, toFill, tm);
}
}
示例5: builder
/**
* loads the net
* The net is in this meaning made up by the net itself and the dynamic
* weights which may be supplied in a separate file
*/
void
initNet(RONet& net, ROLoader& loader, OptionsCont& oc) {
// load the net
RODUAEdgeBuilder builder(oc.getBool("weights.expand"), oc.getBool("weights.interpolate"));
loader.loadNet(net, builder);
// load the weights when wished/available
if (oc.isSet("weight-files")) {
loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false);
}
if (oc.isSet("lane-weight-files")) {
loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true);
}
}
示例6: throw
void
NBTrafficLightLogicCont::applyOptions(OptionsCont &oc) throw() {
// check whether any offsets shall be manipulated by setting
// them to half of the duration
if (oc.isSet("tl-logics.half-offset")) {
myHalfOffsetTLS = oc.getStringVector("tl-logics.half-offset");
}
// check whether any offsets shall be manipulated by setting
// them to a quarter of the duration
if (oc.isSet("tl-logics.quarter-offset")) {
myQuarterOffsetTLS = oc.getStringVector("tl-logics.quarter-offset");
}
}
示例7:
void
NBTrafficLightLogicCont::applyOptions(OptionsCont& oc) {
// check whether any offsets shall be manipulated by setting
// them to half of the duration
if (oc.isSet("tls.half-offset")) {
std::vector<std::string> ids = oc.getStringVector("tls.half-offset");
myHalfOffsetTLS.insert(ids.begin(), ids.end());
}
// check whether any offsets shall be manipulated by setting
// them to a quarter of the duration
if (oc.isSet("tls.quarter-offset")) {
std::vector<std::string> ids = oc.getStringVector("tls.quarter-offset");
myHalfOffsetTLS.insert(ids.begin(), ids.end());
}
}
示例8: writeNodes
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods
// ---------------------------------------------------------------------------
void
NWWriter_XML::writeNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
// check whether plain-output files shall be generated
if (oc.isSet("plain-output-prefix")) {
writeNodes(oc, nb.getNodeCont());
writeEdgesAndConnections(oc, nb.getNodeCont(), nb.getEdgeCont());
writeTrafficLights(oc, nb.getTLLogicCont(), nb.getEdgeCont());
}
if (oc.isSet("junctions.join-output")) {
writeJoinedJunctions(oc, nb.getNodeCont());
}
if (oc.isSet("street-sign-output")) {
writeStreetSigns(oc, nb.getEdgeCont());
}
}
示例9: Handler
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods
// ---------------------------------------------------------------------------
void
NIImporter_ITSUMO::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
// check whether the option is set (properly)
if (!oc.isSet("itsumo-files")) {
return;
}
/* Parse file(s)
* Each file is parsed twice: first for nodes, second for edges. */
std::vector<std::string> files = oc.getStringVector("itsumo-files");
// load nodes, first
Handler Handler(nb);
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
// nodes
if (!FileHelpers::exists(*file)) {
WRITE_ERROR("Could not open itsumo-file '" + *file + "'.");
return;
}
Handler.setFileName(*file);
PROGRESS_BEGIN_MESSAGE("Parsing nodes from itsumo-file '" + *file + "'");
if (!XMLSubSys::runParser(Handler, *file)) {
return;
}
PROGRESS_DONE_MESSAGE();
}
}
示例10: handler
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods (interface in this case)
// ---------------------------------------------------------------------------
void
NIImporter_RobocupRescue::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
// check whether the option is set (properly)
if (!oc.isSet("robocup-dir")) {
return;
}
// build the handler
NIImporter_RobocupRescue handler(nb.getNodeCont(), nb.getEdgeCont());
// parse file(s)
std::vector<std::string> files = oc.getStringVector("robocup-dir");
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
// nodes
std::string nodesName = (*file) + "/node.bin";
if (!FileHelpers::exists(nodesName)) {
WRITE_ERROR("Could not open robocup-node-file '" + nodesName + "'.");
return;
}
PROGRESS_BEGIN_MESSAGE("Parsing robocup-nodes from '" + nodesName + "'");
handler.loadNodes(nodesName);
PROGRESS_DONE_MESSAGE();
// edges
std::string edgesName = (*file) + "/road.bin";
if (!FileHelpers::exists(edgesName)) {
WRITE_ERROR("Could not open robocup-road-file '" + edgesName + "'.");
return;
}
PROGRESS_BEGIN_MESSAGE("Parsing robocup-roads from '" + edgesName + "'");
handler.loadEdges(edgesName);
PROGRESS_DONE_MESSAGE();
}
}
示例11: nodesHandler
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods
// ---------------------------------------------------------------------------
void
NIImporter_MATSim::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
// check whether the option is set (properly)
if (!oc.isSet("matsim-files")) {
return;
}
/* Parse file(s)
* Each file is parsed twice: first for nodes, second for edges. */
std::vector<std::string> files = oc.getStringVector("matsim-files");
// load nodes, first
NodesHandler nodesHandler(nb.getNodeCont());
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
// nodes
if (!FileHelpers::isReadable(*file)) {
WRITE_ERROR("Could not open matsim-file '" + *file + "'.");
return;
}
nodesHandler.setFileName(*file);
PROGRESS_BEGIN_MESSAGE("Parsing nodes from matsim-file '" + *file + "'");
if (!XMLSubSys::runParser(nodesHandler, *file)) {
return;
}
PROGRESS_DONE_MESSAGE();
}
// load edges, then
EdgesHandler edgesHandler(nb.getNodeCont(), nb.getEdgeCont(), oc.getBool("matsim.keep-length"),
oc.getBool("matsim.lanes-from-capacity"), NBCapacity2Lanes(oc.getFloat("lanes-from-capacity.norm")));
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
// edges
edgesHandler.setFileName(*file);
PROGRESS_BEGIN_MESSAGE("Parsing edges from matsim-file '" + *file + "'");
XMLSubSys::runParser(edgesHandler, *file);
PROGRESS_DONE_MESSAGE();
}
}
示例12:
void
MSBaseVehicle::initMoveReminderOutput(const OptionsCont& oc) {
if (oc.isSet("movereminder-output.vehicles")) {
const std::vector<std::string> vehicles = oc.getStringVector("movereminder-output.vehicles");
myShallTraceMoveReminders.insert(vehicles.begin(), vehicles.end());
}
}
示例13: loader
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods (interface in this case)
// ---------------------------------------------------------------------------
void
NIImporter_ArcView::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
if (!oc.isSet("shapefile-prefix")) {
return;
}
// check whether the correct set of entries is given
// and compute both file names
std::string dbf_file = oc.getString("shapefile-prefix") + ".dbf";
std::string shp_file = oc.getString("shapefile-prefix") + ".shp";
std::string shx_file = oc.getString("shapefile-prefix") + ".shx";
// check whether the files do exist
if (!FileHelpers::isReadable(dbf_file)) {
WRITE_ERROR("File not accessible: " + dbf_file);
}
if (!FileHelpers::isReadable(shp_file)) {
WRITE_ERROR("File not accessible: " + shp_file);
}
if (!FileHelpers::isReadable(shx_file)) {
WRITE_ERROR("File not accessible: " + shx_file);
}
if (MsgHandler::getErrorInstance()->wasInformed()) {
return;
}
// load the arcview files
NIImporter_ArcView loader(oc,
nb.getNodeCont(), nb.getEdgeCont(), nb.getTypeCont(),
dbf_file, shp_file, oc.getBool("speed-in-kmh"));
loader.load();
}
示例14: buildOnRamp
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// NBRampsComputer
// ---------------------------------------------------------------------------
void
NBRampsComputer::computeRamps(NBNetBuilder& nb, OptionsCont& oc) {
SUMOReal minHighwaySpeed = oc.getFloat("ramps.min-highway-speed");
SUMOReal maxRampSpeed = oc.getFloat("ramps.max-ramp-speed");
SUMOReal rampLength = oc.getFloat("ramps.ramp-length");
bool dontSplit = oc.getBool("ramps.no-split");
std::set<NBEdge*> incremented;
// check whether on-off ramps shall be guessed
if (oc.getBool("ramps.guess")) {
NBNodeCont& nc = nb.getNodeCont();
NBEdgeCont& ec = nb.getEdgeCont();
NBDistrictCont& dc = nb.getDistrictCont();
std::set<NBNode*> potOnRamps;
std::set<NBNode*> potOffRamps;
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NBNode* cur = (*i).second;
if (mayNeedOnRamp(cur, minHighwaySpeed, maxRampSpeed)) {
potOnRamps.insert(cur);
}
if (mayNeedOffRamp(cur, minHighwaySpeed, maxRampSpeed)) {
potOffRamps.insert(cur);
}
}
for (std::set<NBNode*>::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) {
buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
}
for (std::set<NBNode*>::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) {
buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
}
}
// check whether on-off ramps shall be guessed
if (oc.isSet("ramps.set")) {
std::vector<std::string> edges = oc.getStringVector("ramps.set");
NBNodeCont& nc = nb.getNodeCont();
NBEdgeCont& ec = nb.getEdgeCont();
NBDistrictCont& dc = nb.getDistrictCont();
for (std::vector<std::string>::iterator i = edges.begin(); i != edges.end(); ++i) {
NBEdge* e = ec.retrieve(*i);
if (e == 0) {
WRITE_WARNING("Can not build on ramp on edge '" + *i + "' - the edge is not known.");
continue;
}
NBNode* from = e->getFromNode();
if (from->getIncomingEdges().size() == 2 && from->getOutgoingEdges().size() == 1) {
buildOnRamp(from, nc, ec, dc, rampLength, dontSplit, incremented);
}
// load edge again to check offramps
e = ec.retrieve(*i);
if (e == 0) {
WRITE_WARNING("Can not build off ramp on edge '" + *i + "' - the edge is not known.");
continue;
}
NBNode* to = e->getToNode();
if (to->getIncomingEdges().size() == 1 && to->getOutgoingEdges().size() == 2) {
buildOffRamp(to, nc, ec, dc, rampLength, dontSplit, incremented);
}
}
}
}
示例15: loader
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods (interface in this case)
// ---------------------------------------------------------------------------
void
NIImporter_Vissim::loadNetwork(const OptionsCont &oc, NBNetBuilder &nb) {
if (!oc.isSet("vissim")) {
return;
}
// load the visum network
NIImporter_Vissim loader(nb, oc.getString("vissim"));
loader.load(oc);
}