您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ time2string函数代码示例

51自学网 2021-06-03 08:50:16
  C++
这篇教程C++ time2string函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中time2string函数的典型用法代码示例。如果您正苦于以下问题:C++ time2string函数的具体用法?C++ time2string怎么用?C++ time2string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了time2string函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: time2string

voidMSNet::writeOutput() {    // update detector values    myDetectorControl->updateDetectors(myStep);    // check state dumps    if (OptionsCont::getOptions().isSet("netstate-dump")) {        MSXMLRawOut::write(OutputDevice::getDeviceByOption("netstate-dump"), *myEdges, myStep);    }    // emission output    if (OptionsCont::getOptions().isSet("emissions-output")) {        std::string wt = myVehicleControl->getMeanWaitingTime() ? "-1.00" : time2string((SUMOTime) myVehicleControl->getMeanWaitingTime());        std::string tt = myVehicleControl->getMeanTravelTime()<0 ? "-1.00" : time2string((SUMOTime) myVehicleControl->getMeanTravelTime());        OutputDevice::getDeviceByOption("emissions-output")        << "    <emission-state time=/"" << time2string(myStep) << "/" "        << "loaded=/"" << myVehicleControl->getLoadedVehicleNo() << "/" "        << "emitted=/"" << myVehicleControl->getEmittedVehicleNo() << "/" "        << "running=/"" << myVehicleControl->getRunningVehicleNo() << "/" "        << "waiting=/"" << myEmitter->getWaitingVehicleNo() << "/" "        << "ended=/"" << myVehicleControl->getEndedVehicleNo() << "/" "        << "meanWaitingTime=/"" << wt << "/" "        << "meanTravelTime=/"" << tt << "/" ";        if (myLogExecutionTime) {            OutputDevice::getDeviceByOption("emissions-output")            << "duration=/"" << mySimStepDuration << "/" ";        }        OutputDevice::getDeviceByOption("emissions-output") << "/>/n";    }    // write detector values    myDetectorControl->writeOutput(myStep + DELTA_T, false);}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:30,


示例2: time2string

bool MSCalibrator::VehicleRemover::notifyEnter(SUMOTrafficObject& veh, Notification /* reason */, const MSLane* /* enteredLane */) {    if (myParent == nullptr) {        return false;    }    if (myParent->isActive()) {        myParent->updateMeanData();        const bool calibrateFlow = myParent->myCurrentStateInterval->q >= 0;        const int totalWishedNum = myParent->totalWished();        int adaptedNum = myParent->passed() + myParent->myClearedInJam;        MSVehicle* vehicle = dynamic_cast<MSVehicle*>(&veh);        if (calibrateFlow && adaptedNum > totalWishedNum) {#ifdef MSCalibrator_DEBUG            std::cout << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " " << myParent->getID()                      << " vaporizing " << vehicle->getID() << " to reduce flow/n";#endif            if (myParent->scheduleRemoval(vehicle)) {                myParent->myRemoved++;            }        } else if (myParent->invalidJam(myLaneIndex)) {#ifdef MSCalibrator_DEBUG            std::cout << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " " << myParent->getID()                      << " vaporizing " << vehicle->getID() << " to clear jam/n";#endif            if (!myParent->myHaveWarnedAboutClearingJam) {                WRITE_WARNING("Clearing jam at calibrator '" + myParent->myID + "' at time "                              + time2string(MSNet::getInstance()->getCurrentTimeStep()));                myParent->myHaveWarnedAboutClearingJam = true;            }            if (myParent->scheduleRemoval(vehicle)) {                myParent->myClearedInJam++;            }        }    }    return true;}
开发者ID:michele-segata,项目名称:plexe-sumo,代码行数:35,


示例3: getID

voidMSRouteProbe::writeXMLOutput(OutputDevice& dev,                             SUMOTime startTime, SUMOTime stopTime) {    if (myCurrentRouteDistribution.second->getOverallProb() > 0) {        dev.openTag("routeDistribution") << " id=/"" << getID() + "_" + time2string(startTime) << "/"";        const std::vector<const MSRoute*>& routes = myCurrentRouteDistribution.second->getVals();        const std::vector<SUMOReal>& probs = myCurrentRouteDistribution.second->getProbs();        for (unsigned int j = 0; j < routes.size(); ++j) {            const MSRoute* r = routes[j];            dev.openTag("route") << " id=/"" << r->getID() + "_" + time2string(startTime) << "/" edges=/"";            for (MSRouteIterator i = r->begin(); i != r->end(); ++i) {                if (i != r->begin()) {                    dev << " ";                }                dev << (*i)->getID();            }            dev << "/" probability=/"" << probs[j] << "/"";            dev.closeTag();        }        dev.closeTag();        if (myLastRouteDistribution.second != 0) {            MSRoute::checkDist(myLastRouteDistribution.first);        }        myLastRouteDistribution = myCurrentRouteDistribution;        myCurrentRouteDistribution.first = getID() + "_" + toString(stopTime);        myCurrentRouteDistribution.second = new RandomDistributor<const MSRoute*>();        MSRoute::dictionary(myCurrentRouteDistribution.first, myCurrentRouteDistribution.second, false);    }}
开发者ID:namnatulco,项目名称:sumo-complete,代码行数:29,


示例4: sortByBeginTime

voidODMatrix::writeFlows(const SUMOTime begin, const SUMOTime end,                     OutputDevice& dev, bool noVtype,                     const std::string& prefix,                     bool asProbability) {    if (myContainer.size() == 0) {        return;    }    int flowName = 0;    sortByBeginTime();    // recheck begin time    for (std::vector<ODCell*>::const_iterator i = myContainer.begin(); i != myContainer.end(); ++i) {        const ODCell* const c = *i;        if (c->end > begin && c->begin < end) {            dev.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, prefix + toString(flowName++));            dev.writeAttr(SUMO_ATTR_BEGIN, time2string(c->begin));            dev.writeAttr(SUMO_ATTR_END, time2string(c->end));            if (!asProbability) {                dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber));            } else {                const double probability = float(c->vehicleNumber) / STEPS2TIME(c->end - c->begin);                if (probability > 1) {                    WRITE_WARNING("Flow density of " + toString(probability) + " vehicles per second, cannot be represented with a simple probability. Falling back to even spacing.");                    dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber));                } else {                    dev.setPrecision(6);                    dev.writeAttr(SUMO_ATTR_PROB, probability);                    dev.setPrecision();                }            }            writeDefaultAttrs(dev, noVtype, *i);            dev.closeTag();        }    }}
开发者ID:fieryzig,项目名称:sumo,代码行数:35,


示例5: time2string

voidMSPerson::MSPersonStage_Driving::tripInfoOutput(OutputDevice& os) const {    (os.openTag("ride") <<     " depart=/"" << time2string(myDeparted) <<     "/" arrival=/"" << time2string(myArrived) <<     "/"").closeTag(true);}
开发者ID:rudhir-upretee,项目名称:SUMO_Src,代码行数:7,


示例6: if

std::stringGUIVehicle::getStopInfo() const {    std::string result = "";    if (isParking()) {        result += "parking";    } else if (isStopped()) {        result += "stopped";    } else if (hasStops()) {        return "next: " + myStops.front().getDescription();    } else {        return "";    }    if (myStops.front().pars.triggered) {        result += ", triggered";    } else if (myStops.front().pars.containerTriggered) {        result += ", containerTriggered";    } else if (myStops.front().collision) {        result += ", collision";    } else if (myStops.front().pars.until != -1) {        result += ", until=" + time2string(myStops.front().pars.until);    } else {        result += ", duration=" + time2string(myStops.front().duration);    }    return result;}
开发者ID:behrisch,项目名称:sumo,代码行数:25,


示例7: updateMeanData

voidMSCalibrator::writeXMLOutput() {    if (myOutput != nullptr) {        updateMeanData();        const int p = passed();        // meandata will be off if vehicles are removed on the next edge instead of this one        const int discrepancy = myEdgeMeanData.nVehEntered + myEdgeMeanData.nVehDeparted - myEdgeMeanData.nVehVaporized - passed();        assert(discrepancy >= 0);        const std::string ds = (discrepancy > 0 ? "/" vaporizedOnNextEdge=/"" + toString(discrepancy) : "");        const double durationSeconds = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin);        (*myOutput) << "    <interval begin=/"" << time2string(myCurrentStateInterval->begin) <<                    "/" end=/"" << time2string(myCurrentStateInterval->end) <<                    "/" id=/"" << myID <<                    "/" nVehContrib=/"" << p <<                    "/" removed=/"" << myRemoved <<                    "/" inserted=/"" << myInserted <<                    "/" cleared=/"" << myClearedInJam <<                    "/" flow=/"" << p * 3600.0 / durationSeconds <<                    "/" aspiredFlow=/"" << myCurrentStateInterval->q <<                    "/" speed=/"" << myEdgeMeanData.getTravelledDistance() / myEdgeMeanData.getSamples() <<                    "/" aspiredSpeed=/"" << myCurrentStateInterval->v <<                    ds << //optional                    "/"/>/n";    }    myDidSpeedAdaption = false;    myInserted = 0;    myRemoved = 0;    myClearedInJam = 0;    myHaveWarnedAboutClearingJam = false;    reset();}
开发者ID:michele-segata,项目名称:plexe-sumo,代码行数:31,


示例8: throw

void MSInductLoop::writeXMLOutput(OutputDevice &dev,                             SUMOTime startTime, SUMOTime stopTime) throw(IOError) {    SUMOReal t(STEPS2TIME(stopTime-startTime));	unsigned nVehCrossed ;	SUMOReal flow  ;	SUMOReal occupancy = 0;	SUMOReal meanLength, meanSpeed;	dev.openTag("interval");    dev <<" begin=/""<<time2string(startTime)<<"/" end=/""<<        		time2string(stopTime)<<"/" /n";    unsigned totVeh = 0;    for(unsigned stripIndex=0;stripIndex<myStripCount;stripIndex++){    	 int no_vehicles = myVehicleDataCont[stripIndex].size();    	 nVehCrossed  = (unsigned) no_vehicles;    	 flow = ((SUMOReal) no_vehicles / (SUMOReal) t) * (SUMOReal) 3600.0;    	for (std::deque< VehicleData >::const_iterator i=myVehicleDataCont[stripIndex].begin(); i!=myVehicleDataCont[stripIndex].end(); ++i) {			SUMOReal timeOnDetDuringInterval = (*i).leaveTimeM - MAX2(STEPS2TIME(startTime), (*i).entryTimeM);			timeOnDetDuringInterval = MIN2(timeOnDetDuringInterval, t);			occupancy += timeOnDetDuringInterval;		}		for (std::map< MSVehicle*, SUMOReal >::const_iterator i=myVehiclesOnDet[stripIndex].begin(); i!=myVehiclesOnDet[stripIndex].end(); ++i) {			SUMOReal timeOnDetDuringInterval = STEPS2TIME(stopTime) - MAX2(STEPS2TIME(startTime), (*i).second);			occupancy += timeOnDetDuringInterval;		}		occupancy = no_vehicles!=0 ? occupancy / t * (SUMOReal) 100.0 : 0;		meanSpeed = no_vehicles!=0							 ? accumulate(myVehicleDataCont[stripIndex].begin(), myVehicleDataCont[stripIndex].end(), (SUMOReal) 0.0, speedSum) / (SUMOReal) myVehicleDataCont[stripIndex].size()							 : -1;		meanLength = no_vehicles!=0							  ? accumulate(myVehicleDataCont[stripIndex].begin(), myVehicleDataCont[stripIndex].end(), (SUMOReal) 0.0, lengthSum) / (SUMOReal) myVehicleDataCont[stripIndex].size()							  : -1;		if(no_vehicles >= 1){			dev <<"/tstripNum=/""<<stripIndex<<" /"vehicle_id=/""<< (myVehicleDataCont[stripIndex].begin())->idM			<<"/" flow=/""<<flow<<			"/" occupancy=/""<<occupancy<<"/" speed=/""<<meanSpeed<<			"/" length=/""<<meanLength<<			"/" nVehEntered=/""<<no_vehicles<<"/" /n";			totVeh += no_vehicles;		}		else {			dev << "/tstripNum=/""<<stripIndex				<<"/" flow=/""<<flow<<				"/" occupancy=/""<<occupancy<<"/" speed=/""<<meanSpeed<<				"/" length=/""<<meanLength<<				"/" nVehEntered=/""<<no_vehicles<<"/" /n";				totVeh += no_vehicles;		}    }    dev << "total_Vehicles=/" "<<totVeh + myDismissedVehicleNumber <<"/"";    dev.closeTag(true);    reset();}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:56,


示例9: getDestination

voidMSPerson::MSPersonStage_Waiting::routeOutput(OutputDevice& os) const {    os.openTag("stop").writeAttr(SUMO_ATTR_LANE, getDestination().getID());    if (myWaitingDuration >= 0) {        os.writeAttr(SUMO_ATTR_DURATION, time2string(myWaitingDuration));    }    if (myWaitingUntil >= 0) {        os.writeAttr(SUMO_ATTR_UNTIL, time2string(myWaitingUntil));    }    os.closeTag();}
开发者ID:harora,项目名称:ITS,代码行数:11,


示例10: time2string

voidMSContainer::MSContainerStage_Driving::tripInfoOutput(OutputDevice& os, MSTransportable*) const {    os.openTag("transport");    os.writeAttr("waitingTime", time2string(myDeparted - myWaitingSince));    os.writeAttr("vehicle", myVehicleID);    os.writeAttr("depart", time2string(myDeparted));    os.writeAttr("arrival", time2string(myArrived));    os.writeAttr("arrivalPos", toString(myArrivalPos));    os.writeAttr("duration", myArrived > 0 ? time2string(myArrived - myDeparted) : "-1");    os.writeAttr("routeLength", myVehicleDistance);    os.closeTag();}
开发者ID:fieryzig,项目名称:sumo,代码行数:12,


示例11: while

voidMELoop::teleportVehicle(MEVehicle* veh, MESegment* const toSegment) {    const SUMOTime leaveTime = veh->getEventTime();    MESegment* const onSegment = veh->getSegment();    const bool teleporting = (onSegment == 0); // is the vehicle already teleporting?    // try to find a place on the current edge    MESegment* teleSegment = toSegment->getNextSegment();    while (teleSegment != 0 && !teleSegment->hasSpaceFor(veh, leaveTime)) {        // @caution the time to get to the next segment here is ignored XXX        teleSegment = teleSegment->getNextSegment();    }    if (teleSegment != 0) {        if (!teleporting) {            // we managed to teleport in a single jump            WRITE_WARNING("Teleporting vehicle '" + veh->getID() + "'; waited too long, from edge '" + onSegment->getEdge().getID()                          + "':" + toString(onSegment->getIndex())                          + " to edge '" + teleSegment->getEdge().getID()                          + "':" + toString(teleSegment->getIndex())                          + ", time " + time2string(leaveTime) + ".");            MSNet::getInstance()->getVehicleControl().registerTeleportJam();        }        changeSegment(veh, leaveTime, teleSegment, true);        teleSegment->setEntryBlockTime(leaveTime); // teleports should not block normal flow    } else {        // teleport across the current edge and try insertion later        if (!teleporting) {            // announce start of multi-step teleport, arrival will be announced in changeSegment()            WRITE_WARNING("Teleporting vehicle '" + veh->getID() + "'; waited too long, from edge '" + onSegment->getEdge().getID()                          + "':" + toString(onSegment->getIndex()) + ", time " + time2string(leaveTime) + ".");            MSNet::getInstance()->getVehicleControl().registerTeleportJam();            // remove from current segment            onSegment->send(veh, 0, leaveTime);            // mark veh as teleporting            veh->setSegment(0, 0);        }        // @caution microsim uses current travel time teleport duration        const SUMOTime teleArrival = leaveTime + TIME2STEPS(veh->getEdge()->getLength() / veh->getEdge()->getSpeedLimit());        const bool atDest = veh->moveRoutePointer();        if (atDest) {            // teleporting to end of route            changeSegment(veh, teleArrival, 0, true);        } else {            veh->setEventTime(teleArrival);            addLeaderCar(veh, 0);            // teleporting vehicles must react to rerouters            getSegmentForEdge(*veh->getEdge())->addReminders(veh);            veh->activateReminders(MSMoveReminder::NOTIFICATION_JUNCTION);        }    }}
开发者ID:cbrafter,项目名称:sumo,代码行数:50,


示例12: getBestLanesContinuation

voidGUIVehicle::drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r, bool future) const {    const double exaggeration = s.vehicleSize.getExaggeration(s, this);    MSRouteIterator i = future ? myCurrEdge : r.begin();    const std::vector<MSLane*>& bestLaneConts = getBestLanesContinuation();    // draw continuation lanes when drawing the current route where available    int bestLaneIndex = (&r == myRoute ? 0 : (int)bestLaneConts.size());    for (; i != r.end(); ++i) {        const GUILane* lane;        if (bestLaneIndex < (int)bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {            lane = static_cast<GUILane*>(bestLaneConts[bestLaneIndex]);            ++bestLaneIndex;        } else {            const std::vector<MSLane*>* allowed = (*i)->allowedLanes(getVClass());            if (allowed != nullptr && allowed->size() != 0) {                lane = static_cast<GUILane*>((*allowed)[0]);            } else {                lane = static_cast<GUILane*>((*i)->getLanes()[0]);            }        }        GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);    }    // draw stop labels    // (vertical shift for repeated stops at the same position    std::map<std::pair<const MSLane*, double>, int> repeat; // count repeated occurrences of the same position    int stopIndex = 0;    for (const Stop& stop : myStops) {        Position pos = stop.lane->geometryPositionAtOffset(stop.reached ? getPositionOnLane() : stop.getEndPos(*this));        GLHelper::drawBoxLines(stop.lane->getShape().getOrthogonal(pos, 10, true, stop.lane->getWidth()), 0.1);        std::string label = stop.reached ? "stopped" : "stop " + toString(stopIndex);#ifdef _DEBUG        label += " (" + toString(stop.edge - myCurrEdge) + "e)";#endif        if (stop.pars.until >= 0) {            label += " until:" + time2string(stop.pars.until);        }        if (stop.duration >= 0) {            if (STEPS2TIME(stop.duration) > 3600 * 24) {                label += " duration:1day+";            } else {                label += " duration:" + time2string(stop.duration);            }        }        std::pair<const MSLane*, double> stopPos = std::make_pair(stop.lane, stop.getEndPos(*this));        const double textSize = s.vehicleName.size / s.scale;        GLHelper::drawText(label, pos - Position(0, textSize * repeat[stopPos]), 1.0, textSize, s.vehicleName.color);        repeat[stopPos]++;        stopIndex++;    }}
开发者ID:behrisch,项目名称:sumo,代码行数:50,


示例13: STEPS2TIME

voidMSContainer::MSContainerStage_Tranship::tripInfoOutput(OutputDevice& os, MSTransportable*) const {    const SUMOTime duration = myArrived - myDeparted;    // no timeloss is possible    const double distance = mySpeed * STEPS2TIME(duration);    os.openTag("tranship");    os.writeAttr("depart", time2string(myDeparted));    os.writeAttr("departPos", myDepartPos);    os.writeAttr("arrival", time2string(myArrived));    os.writeAttr("arrivalPos", myArrivalPos);    os.writeAttr("duration", time2string(duration));    os.writeAttr("routeLength", distance);    os.writeAttr("maxSpeed", mySpeed);    os.closeTag();}
开发者ID:fieryzig,项目名称:sumo,代码行数:15,


示例14: removeLaneChangeShadow

voidMSAbstractLaneChangeModel::continueLaneChangeManeuver(bool moved) {    if (moved && myHaveShadow) {        // move shadow to next lane        removeLaneChangeShadow();        const int shadowDirection = myLaneChangeMidpointPassed ? -myLaneChangeDirection : myLaneChangeDirection;        myShadowLane = myVehicle.getLane()->getParallelLane(shadowDirection);        if (myShadowLane == 0) {            // abort lane change            WRITE_WARNING("Vehicle '" + myVehicle.getID() + "' could not finish continuous lane change (lane disappeared) time=" +                          time2string(MSNet::getInstance()->getCurrentTimeStep()) + ".");            endLaneChangeManeuver();            return;        }        myHaveShadow = true;    }    myLaneChangeCompletion += (SUMOReal)DELTA_T / (SUMOReal)MSGlobals::gLaneChangeDuration;    if (!myLaneChangeMidpointPassed && myLaneChangeCompletion >=            myVehicle.getLane()->getWidth() / (myVehicle.getLane()->getWidth() + myShadowLane->getWidth())) {        // maneuver midpoint reached, swap myLane and myShadowLane        myLaneChangeMidpointPassed = true;        MSLane* tmp = myVehicle.getLane();        myVehicle.leaveLane(MSMoveReminder::NOTIFICATION_LANE_CHANGE);        myVehicle.enterLaneAtLaneChange(myShadowLane);        myShadowLane = tmp;        if (myVehicle.fixPosition()) {            WRITE_WARNING("vehicle '" + myVehicle.getID() + "' set back by " + toString(myVehicle.getPositionOnLane() - myVehicle.getLane()->getLength()) +                          "m when changing lanes on lane '" + myVehicle.getLane()->getID() + " time=" +                          time2string(MSNet::getInstance()->getCurrentTimeStep()) + ".");        }        myLastLaneChangeOffset = 0;        changed();        myAlreadyMoved = true;    }    // remove shadow as soon as the vehicle leaves the original lane geometrically    if (myLaneChangeMidpointPassed && myHaveShadow) {        const SUMOReal sourceHalfWidth = myShadowLane->getWidth() / 2.0;        const SUMOReal targetHalfWidth = myVehicle.getLane()->getWidth() / 2.0;        if (myLaneChangeCompletion * (sourceHalfWidth + targetHalfWidth) - myVehicle.getVehicleType().getWidth() / 2.0 > sourceHalfWidth) {            removeLaneChangeShadow();        }    }    // finish maneuver    if (!isChangingLanes()) {        assert(myLaneChangeMidpointPassed);        endLaneChangeManeuver();    }}
开发者ID:harora,项目名称:ITS,代码行数:48,


示例15: getID

voidMSLaneSpeedTrigger::myStartElement(int element,                                   const SUMOSAXAttributes& attrs) {    // check whether the correct tag is read    if (element != SUMO_TAG_STEP) {        return;    }    // extract the values    bool ok = true;    SUMOTime next = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, getID().c_str(), ok);    SUMOReal speed = attrs.getOpt<SUMOReal>(SUMO_ATTR_SPEED, getID().c_str(), ok, -1);    // check the values    if (next < 0) {        WRITE_ERROR("Wrong time in vss '" + getID() + "'.");        return;    }    if (speed < 0) {        speed = myDefaultSpeed;    }    // set the values for the next step if they are valid    if (myLoadedSpeeds.size() != 0 && myLoadedSpeeds.back().first == next) {        WRITE_WARNING("Time " + time2string(next) + " was set twice for vss '" + getID() + "'; replacing first entry.");        myLoadedSpeeds.back().second = speed;    } else {        myLoadedSpeeds.push_back(std::make_pair(next, speed));    }}
开发者ID:aarongolliver,项目名称:sumo,代码行数:27,


示例16: time2string

SUMOTimeMSVTypeProbe::execute(SUMOTime currentTime) {    myOutputDevice.openTag("timestep") << " time=/"" << time2string(currentTime) << "/" id=/"" << getID() << "/" vType=/"" << myVType << "/"";    MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl();    MSVehicleControl::constVehIt it = vc.loadedVehBegin();    MSVehicleControl::constVehIt end = vc.loadedVehEnd();    for (; it != end; ++it) {        const MSVehicle* veh = static_cast<const MSVehicle*>((*it).second);        if (myVType == "" || myVType == veh->getVehicleType().getID()) {            if (!veh->isOnRoad()) {                continue;            }            Position pos = veh->getLane()->getShape().positionAtOffset(veh->getPositionOnLane());            myOutputDevice.openTag("vehicle") << " id=/"" << veh->getID()                                              << "/" lane=/"" << veh->getLane()->getID()                                              << "/" pos=/"" << veh->getPositionOnLane()                                              << "/" x=/"" << pos.x()                                              << "/" y=/"" << pos.y();            if (GeoConvHelper::getFinal().usingGeoProjection()) {                GeoConvHelper::getFinal().cartesian2geo(pos);                myOutputDevice.setPrecision(GEO_OUTPUT_ACCURACY);                myOutputDevice << "/" lat=/"" << pos.y() << "/" lon=/"" << pos.x();                myOutputDevice.setPrecision();            }            myOutputDevice << "/" speed=/"" << veh->getSpeed() << "/"";            myOutputDevice.closeTag();        }    }    myOutputDevice.closeTag();    return myFrequency;}
开发者ID:namnatulco,项目名称:sumo-complete,代码行数:32,


示例17: time2string

void MSNet::postSimStepOutput() const{  OptionsCont &oc = OptionsCont::getOptions();  if(oc.getSimulationVerbosity()>1)    std::cout<<"----> void MSNet::postSimStepOutput() const"<<std::endl;  if (myLogExecutionTime) {        std::string msg;        std::ostringstream oss;        oss.setf(std::ios::fixed , std::ios::floatfield);    // use decimal format        oss.setf(std::ios::showpoint);    // print decimal point        oss << std::setprecision(OUTPUT_ACCURACY);        if (mySimStepDuration != 0) {            oss << " (" << mySimStepDuration << "ms ~= "                << (1000. / (SUMOReal) mySimStepDuration) << "*RT, ~"                << ((SUMOReal) myVehicleControl->getRunningVehicleNo() / (SUMOReal) mySimStepDuration * 1000.);        } else {            oss << " (0ms ?*RT. ?";        }        oss << "UPS, vehicles"            << " TOT " << myVehicleControl->getDepartedVehicleNo()            << " ACT " << myVehicleControl->getRunningVehicleNo()            << ")                                              ";        msg = oss.str();        std::string prev = "Step #" + time2string(myStep - DELTA_T);        msg = msg.substr(0, 78 - prev.length());        std::cout << msg;  }  std::cout << (char) 13;}
开发者ID:smendez-hi,项目名称:SUMO-hib,代码行数:29,


示例18: throw

SUMOTimeMSVTypeProbe::execute(SUMOTime currentTime) throw(ProcessError) {    const std::string indent("    ");    myOutputDevice << indent << "<timestep time=/"" <<time2string(currentTime)<< "/" id=/"" << getID() << "/" vtype=/"" << myVType << "/">" << "/n";    MSVehicleControl &vc = MSNet::getInstance()->getVehicleControl();    std::map<std::string, MSVehicle*>::const_iterator it = vc.loadedVehBegin();    std::map<std::string, MSVehicle*>::const_iterator end = vc.loadedVehEnd();    for (; it != end; ++it) {        const MSVehicle *veh=(*it).second;        if (myVType=="" || myVType==veh->getVehicleType().getID()) {            if (!veh->isOnRoad()) {                continue;            }            Position2D pos = veh->getPosition();            myOutputDevice << indent << indent            << "<vehicle id=/"" << veh->getID()            << "/" lane=/"" << veh->getLane().getID()            << "/" pos=/"" << veh->getPositionOnLane()            << "/" x=/"" << pos.x()            << "/" y=/"" << pos.y();            if (GeoConvHelper::usingGeoProjection()) {                GeoConvHelper::cartesian2geo(pos);                myOutputDevice.setPrecision(GEO_OUTPUT_ACCURACY);                myOutputDevice << "/" lat=/"" << pos.y() << "/" lon=/"" << pos.x();                myOutputDevice.setPrecision();            }            myOutputDevice << "/" speed=/"" << veh->getSpeed() << "/"/>" << "/n";        }    }    myOutputDevice << indent << "</timestep>" << "/n";    return myFrequency;}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:33,


示例19: while

MSVehicle * constMSLane::getLastVehicle(const MSVehicle::StripCont &strips) const {    MSVehicle::StripContConstIter strip = strips.begin();    MSVehicle *last = 0;        while (strip != strips.end()) {        last = (*strip)->getLastVehicle();        if (last != 0) break;        strip++;    }    if (last == 0) return last;        for (MSVehicle::StripContConstIter it=strip+1; it != strips.end(); ++it) {        MSVehicle *curr = (*it)->getLastVehicle();        if (!curr) continue;                if (last->getPositionOnLane()-last->getVehicleType().getLength()                 >                 curr->getPositionOnLane()-curr->getVehicleType().getLength())            last = curr;    }    //DEBUG    ///*    std::pair<MSVehicle*, SUMOReal> lvInfo = getLastVehicleInformation();    if (last != lvInfo.first)        MsgHandler::getWarningInstance()->inform("LastVEH_ERR::Lane=" + this->getID() +                 ", time=" + time2string(MSNet::getInstance()->getCurrentTimeStep()) + ".");    //*/    return last;}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:30,


示例20: time2string

// ===========================================================================// method definitions// ===========================================================================voidMSEmissionExport::write(OutputDevice& of, SUMOTime timestep, int precision) {    of.openTag("timestep").writeAttr("time", time2string(timestep));    of.setPrecision(precision);    MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl();    for (MSVehicleControl::constVehIt it = vc.loadedVehBegin(); it != vc.loadedVehEnd(); ++it) {        const SUMOVehicle* veh = it->second;        const MSVehicle* microVeh = dynamic_cast<const MSVehicle*>(veh);        if (veh->isOnRoad()) {            std::string fclass = veh->getVehicleType().getID();            fclass = fclass.substr(0, fclass.find_first_of("@"));            PollutantsInterface::Emissions emiss = PollutantsInterface::computeAll(veh->getVehicleType().getEmissionClass(), veh->getSpeed(), veh->getAcceleration(), veh->getSlope());            of.openTag("vehicle").writeAttr("id", veh->getID()).writeAttr("eclass", PollutantsInterface::getName(veh->getVehicleType().getEmissionClass()));            of.writeAttr("CO2", emiss.CO2).writeAttr("CO", emiss.CO).writeAttr("HC", emiss.HC).writeAttr("NOx", emiss.NOx);            of.writeAttr("PMx", emiss.PMx).writeAttr("fuel", emiss.fuel).writeAttr("electricity", emiss.electricity);            of.writeAttr("noise", HelpersHarmonoise::computeNoise(veh->getVehicleType().getEmissionClass(), veh->getSpeed(), veh->getAcceleration()));            of.writeAttr("route", veh->getRoute().getID()).writeAttr("type", fclass);            if (microVeh != 0) {                of.writeAttr("waiting", microVeh->getWaitingSeconds());                of.writeAttr("lane", microVeh->getLane()->getID());            }            of.writeAttr("pos", veh->getPositionOnLane()).writeAttr("speed", veh->getSpeed());            of.writeAttr("angle", GeomHelper::naviDegree(veh->getAngle())).writeAttr("x", veh->getPosition().x()).writeAttr("y", veh->getPosition().y());            of.closeTag();        }    }    of.setPrecision(OUTPUT_ACCURACY);    of.closeTag();}
开发者ID:cbrafter,项目名称:sumo,代码行数:32,


示例21: GUIParameterTableWindow

GUIParameterTableWindow*GUICalibrator::getParameterWindow(GUIMainWindow& app,                                  GUISUMOAbstractView&) {    GUIParameterTableWindow* ret;    if (isActive()) {        ret = new GUIParameterTableWindow(app, *this, 10);        // add items        ret->mkItem("interval start", false, STEPS2TIME(myCurrentStateInterval->begin));        ret->mkItem("interval end", false, STEPS2TIME(myCurrentStateInterval->end));        ret->mkItem("aspired flow [veh/h]", false, myCurrentStateInterval->q);        ret->mkItem("aspired speed", false, myCurrentStateInterval->v);        ret->mkItem("default speed", false, myDefaultSpeed);        ret->mkItem("required vehicles", true, new FunctionBinding<GUICalibrator, int>(this, &GUICalibrator::totalWished));        ret->mkItem("passed vehicles", true, new FunctionBinding<GUICalibrator, int>(this, &GUICalibrator::passed));        ret->mkItem("inserted vehicles", true, new FunctionBinding<GUICalibrator, int>(this, &GUICalibrator::inserted));        ret->mkItem("removed vehicles", true, new FunctionBinding<GUICalibrator, int>(this, &GUICalibrator::removed));        ret->mkItem("cleared in jam", true, new FunctionBinding<GUICalibrator, int>(this, &GUICalibrator::clearedInJam));    } else {        ret = new GUIParameterTableWindow(app, *this, 1);        const std::string nextStart =            (myCurrentStateInterval != myIntervals.end() ?             time2string(myCurrentStateInterval->begin) :             "simulation end");        ret->mkItem("inactive until", false, nextStart);    }    // close building    ret->closeBuilding();    return ret;}
开发者ID:namnatulco,项目名称:sumo-complete,代码行数:29,


示例22: set_end_time

/* set the current time as end-time in the dialog struct */static int set_end_time( struct dlg_cell* dialog){    struct timeval current_time;    str end_time;    if( !dialog)    {        LM_ERR("dialog is empty!/n");        return -1;    }    if( gettimeofday( &current_time, NULL) < 0)    {        LM_ERR( "failed to set time!/n");        return -1;    }    if( time2string(&current_time, &end_time) < 0) {        LM_ERR( "failed to convert current time to string/n");        return -1;    }    if( dlgb.set_dlg_var( dialog,                          (str*)&cdr_end_str,                          (str*)&end_time) != 0)    {        LM_ERR( "failed to set start time");        return -1;    }    return 0;}
开发者ID:aallamaa,项目名称:kamailio,代码行数:33,


示例23: sort

voidGUIDialog_Breakpoints::rebuildList() {    myTable->clearItems();    sort(myBreakpoints->begin(), myBreakpoints->end());    // set table attributes    myTable->setTableSize((FXint) myBreakpoints->size() + 1, 1);    myTable->setColumnText(0, "Time");    FXHeader* header = myTable->getColumnHeader();    header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());    int k;    for (k = 0; k < 1; k++) {        header->setItemJustify(k, JUSTIFY_CENTER_X);    }    // insert into table    FXint row = 0;    std::vector<int>::iterator j;    for (j = myBreakpoints->begin(); j != myBreakpoints->end(); ++j) {        myTable->setItemText(row, 0, time2string(*j).c_str());        row++;    }    // insert dummy last field    for (k = 0; k < 1; k++) {        myTable->setItemText(row, k, " ");    }}
开发者ID:sazl,项目名称:Senior-Design,代码行数:25,


示例24: WRITE_WARNING

boolMELoop::changeSegment(MEVehicle* veh, SUMOTime leaveTime, MESegment* const toSegment, const bool ignoreLink) {    MESegment* const onSegment = veh->getSegment();    if (MESegment::isInvalid(toSegment)) {        if (onSegment != 0) {            onSegment->send(veh, toSegment, leaveTime);        } else {            WRITE_WARNING("Vehicle '" + veh->getID() + "' teleports beyond arrival edge '" + veh->getEdge()->getID() + "', time " + time2string(leaveTime) + ".");        }        veh->setSegment(toSegment); // signal arrival        MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(veh);        return true;    }    if (toSegment->hasSpaceFor(veh, leaveTime) && (ignoreLink || veh->mayProceed())) {        if (onSegment != 0) {            onSegment->send(veh, toSegment, leaveTime);            toSegment->receive(veh, leaveTime, false, ignoreLink);        } else {            WRITE_WARNING("Vehicle '" + veh->getID() + "' ends teleporting on edge '" + toSegment->getEdge().getID()                          + "':" + toString(toSegment->getIndex()) + ", time " + time2string(leaveTime) + ".");            // this is not quite correct but suffices for interrogation by            // subsequent methods (veh->getSpeed() needs segment != 0)            veh->setSegment(myEdges2FirstSegments[veh->getEdge()->getNumericalID()]);            toSegment->receive(veh, leaveTime, false, true);        }        return true;    }    return false;}
开发者ID:cbrafter,项目名称:sumo,代码行数:29,


示例25: user_isr

/* Interrupt Service Routine */void user_isr( void ) {  // check flag  if(IFS(0) & 0x100){    // clearing flag    IFS(0) = 0;    timeoutcount++;    if (timeoutcount == 10){      time2string( textstring, mytime );      display_string( 3, textstring );      display_update();      tick( &mytime );      timeoutcount = 0;    }  }      // code for counting LED  if(IFS(0) & 0x80){    // clearing flag    IFS(0) = 0;    // for LEDs ticking    * portE =  * portE + 0x1;    // only for the last 8 bits    * E = * E & 0xFF00;  }  return;}
开发者ID:GaPhil,项目名称:COMPUTER-HARDWARE-ENGINEERING-IS1200,代码行数:30,


示例26: time2string

voidROPerson::Ride::saveAsXML(OutputDevice& os, const bool extended) const {    os.openTag(SUMO_TAG_RIDE);    std::string comment = "";    if (extended && cost >= 0.) {        os.writeAttr(SUMO_ATTR_COST, cost);    }    if (from != nullptr) {        os.writeAttr(SUMO_ATTR_FROM, from->getID());    }    if (to != nullptr) {        os.writeAttr(SUMO_ATTR_TO, to->getID());    }    if (destStop != "") {        os.writeAttr(SUMO_ATTR_BUS_STOP, destStop);        const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);        if (name != "") {            comment =  " <!-- " + name + " -->";        }    }    os.writeAttr(SUMO_ATTR_LINES, lines);    if (intended != "" && intended != lines) {        os.writeAttr(SUMO_ATTR_INTENDED, intended);    }    if (depart >= 0) {        os.writeAttr(SUMO_ATTR_DEPART, time2string(depart));    }    os.closeTag(comment);}
开发者ID:behrisch,项目名称:sumo,代码行数:29,


示例27: labwork

/* This function is called repetitively from the main program */void labwork( void ){  delay( 1000 );  time2string( textstring, mytime );  display_string( 3, textstring );  display_update();  getbtns();  if (getbtns() == 1)    mytime += (getsw() << 4);    if (getbtns() == 2)    mytime += (getsw() << 8);  if (getbtns() == 4)    mytime += (getsw() << 12);  volatile int* porte = (volatile int*) 0xbf886110;  tick( &mytime );  *porte += 1;  display_image(96, icon);}
开发者ID:robertab,项目名称:is1500,代码行数:26,


示例28: time2string

SUMOTimeMSVTypeProbe::execute(SUMOTime currentTime) {    myOutputDevice.openTag("timestep") << " time=/"" << time2string(currentTime) << "/" id=/"" << getID() << "/" vType=/"" << myVType << "/"";    MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl();    for (MSVehicleControl::constVehIt it = vc.loadedVehBegin(); it != vc.loadedVehEnd(); ++it) {        const SUMOVehicle* veh = it->second;        const MSVehicle* microVeh = dynamic_cast<const MSVehicle*>(veh);        if (myVType == "" || myVType == veh->getVehicleType().getID()) {            if (veh->isOnRoad()) {                Position pos = veh->getPosition();                myOutputDevice.openTag("vehicle").writeAttr("id", veh->getID());                if (microVeh != 0) {                    myOutputDevice.writeAttr("lane", microVeh->getLane()->getID());                }                myOutputDevice.writeAttr("pos", veh->getPositionOnLane());                myOutputDevice.writeAttr("x", pos.x()).writeAttr("y", pos.y());                if (GeoConvHelper::getFinal().usingGeoProjection()) {                    GeoConvHelper::getFinal().cartesian2geo(pos);                    myOutputDevice.setPrecision(GEO_OUTPUT_ACCURACY);                    myOutputDevice.writeAttr("lat", pos.y()).writeAttr("lon", pos.x());                    myOutputDevice.setPrecision();                }                myOutputDevice.writeAttr("speed", veh->getSpeed());                myOutputDevice.closeTag();            }        }    }    myOutputDevice.closeTag();    return myFrequency;}
开发者ID:RamonHPSilveira,项目名称:urbansim,代码行数:30,



注:本文中的time2string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ timeChanged函数代码示例
C++ time函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。