本文整理汇总了C++中vector_double::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ vector_double::push_back方法的具体用法?C++ vector_double::push_back怎么用?C++ vector_double::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector_double
的用法示例。
在下文中一共展示了vector_double::push_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fixGPStimestamp
void fixGPStimestamp(CObservationGPSPtr &obs, vector_double &time_changes, std::map<std::string,double> &DeltaTimes )
{
if (!obs->has_GGA_datum && !obs->has_RMC_datum) return;
CObservationGPS::TUTCTime theTime;
bool hasTime=false;
if (obs->has_GGA_datum && obs->GGA_datum.fix_quality>0)
{
theTime = obs->GGA_datum.UTCTime;
hasTime = true;
}
else
if (obs->has_RMC_datum && obs->RMC_datum.validity_char=='A' )
{
theTime = obs->RMC_datum.UTCTime;
hasTime = true;
}
// The last known delta_time for this sensor name
if (DeltaTimes.find( obs->sensorLabel )==DeltaTimes.end())
DeltaTimes[obs->sensorLabel] = 0;
double &DeltaTime = DeltaTimes[obs->sensorLabel];
if ( hasTime )
{
TTimeParts timparts;
mrpt::system::timestampToParts( obs->timestamp, timparts);
DeltaTime = 3600*theTime.hour + 60*theTime.minute + theTime.sec;
DeltaTime -= 3600*timparts.hour + 60*timparts.minute + timparts.second;
if (theTime.hour < timparts.hour-2)
{
// The GPS time is one day ahead the "timestamp"
DeltaTime += 3600*24;
}
else if (timparts.hour > theTime.hour+2)
{
// The "timstamp" is one day ahead the GPS time:
DeltaTime -= 3600*24;
}
// Instead of delta, just replace:
timparts.hour = theTime.hour;
timparts.minute = theTime.minute;
timparts.second = theTime.sec;
obs->timestamp = buildTimestampFromParts(timparts);
}
else
{
// Use last delta
obs->timestamp += mrpt::system::secondsToTimestamp(DeltaTime);
}
// Fix timestamp:
time_changes.push_back( DeltaTime );
}