本文整理汇总了C++中mrpt::utils::CStream类的典型用法代码示例。如果您正苦于以下问题:C++ CStream类的具体用法?C++ CStream怎么用?C++ CStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFromStream
/*---------------------------------------------------------------
readFromStream
---------------------------------------------------------------*/
void CLogFileRecord_ND::readFromStream(mrpt::utils::CStream &in,int version)
{
switch(version)
{
case 0:
{
int32_t n;
in >> n;
gaps_ini.resize(n);
gaps_end.resize(n);
in.ReadBuffer( &(*gaps_ini.begin()), sizeof(gaps_ini[0]) * n );
in.ReadBuffer( &(*gaps_end.begin()), sizeof(gaps_end[0]) * n );
in >> n;
gaps_eval.resize(n);
in.ReadBuffer( &(*gaps_eval.begin()), sizeof(gaps_eval[0]) * n );
in >> selectedSector >> evaluation >> riskEvaluation >> n;
situation = (CHolonomicND::TSituations) n;
} break;
case 1:
{
uint32_t n;
in >> gaps_ini >> gaps_end >> gaps_eval;
in >> selectedSector >> evaluation >> riskEvaluation >> n;
situation = (CHolonomicND::TSituations) n;
} break;
default:
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
};
}
示例2: dumpToTextStream
/** Dump the options of the metric map in human-readable format */
void TMetricMapInitializer::dumpToTextStream(mrpt::utils::CStream &out) const
{
out.printf("-------------------------TMetricMapInitializer --------------------------\n");
out.printf("================ C++ Class: '%s'\n", this->metricMapClassType->className);
this->genericMapParams.dumpToTextStream(out);
// Class-specific:
this->dumpToTextStream_map_specific(out);
}
示例3: dumpToStream
void Message_NMEA_ZDA::dumpToStream( mrpt::utils::CStream &out ) const
{
out.printf("[NMEA ZDA datum]\n");
out.printf(" UTC time-stamp: %02u:%02u:%02.03f\n",
fields.UTCTime.hour,
fields.UTCTime.minute,
fields.UTCTime.sec
);
out.printf(" Date (DD/MM/YY): %02u/%02u/%04u\n ",
(unsigned)fields.date_day,(unsigned)fields.date_month, (unsigned)fields.date_year);
}
示例4:
/*---------------------------------------------------------------
dumpToTextStream
---------------------------------------------------------------*/
void CMultiMetricMapPDF::TPredictionParams::dumpToTextStream(mrpt::utils::CStream &out) const
{
out.printf("\n----------- [CMultiMetricMapPDF::TPredictionParams] ------------ \n\n");
out.printf("pfOptimalProposal_mapSelection = %i\n", pfOptimalProposal_mapSelection );
out.printf("ICPGlobalAlign_MinQuality = %f\n", ICPGlobalAlign_MinQuality );
KLD_params.dumpToTextStream(out);
icp_params.dumpToTextStream(out);
out.printf("\n");
}
示例5: getAsString
void COutputLogger::TMsg::writeToStream(mrpt::utils::CStream& out) const {
const std::string str = getAsString();
out.printf("%s", str.c_str());
#ifdef _MSC_VER
OutputDebugStringA(str.c_str());
#endif
}
示例6: readFromStream
/*---------------------------------------------------------------
readFromStream
---------------------------------------------------------------*/
void CMatrixB::readFromStream(mrpt::utils::CStream &in, int version)
{
switch(version)
{
case 0:
{
uint32_t size_bool;
in >> size_bool;
if ( size_bool != sizeof(m_Val[0][0]) )
THROW_EXCEPTION("Error: size of 'bool' is different in serialized data!")
uint32_t nRows,nCols;
// First, write the number of rows and columns:
in >> nRows >> nCols;
setSize(nRows,nCols);
if (nRows>0 && nCols>0)
for (unsigned int i=0;i<nRows;i++)
in.ReadBuffer(m_Val[i],sizeof(m_Val[0][0])*m_Cols);
} break;
default:
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
};
}
示例7:
void CGasConcentrationGridMap2D::TMapDefinition::dumpToTextStream_map_specific(mrpt::utils::CStream &out) const
{
out.printf("MAP TYPE = %s\n", mrpt::utils::TEnumType<CGasConcentrationGridMap2D::TMapRepresentation>::value2name(mapType).c_str() );
LOADABLEOPTS_DUMP_VAR(min_x , float);
LOADABLEOPTS_DUMP_VAR(max_x , float);
LOADABLEOPTS_DUMP_VAR(min_y , float);
LOADABLEOPTS_DUMP_VAR(max_y , float);
LOADABLEOPTS_DUMP_VAR(resolution , float);
this->insertionOpts.dumpToTextStream(out);
}
示例8:
/*---------------------------------------------------------------
dumpToTextStream
---------------------------------------------------------------*/
void CIncrementalMapPartitioner::TOptions::dumpToTextStream(mrpt::utils::CStream &out) const
{
out.printf("\n----------- [CIncrementalMapPartitioner::TOptions] ------------ \n\n");
out.printf("partitionThreshold = %f\n",partitionThreshold);
out.printf("gridResolution = %f\n",gridResolution);
out.printf("minDistForCorrespondence = %f\n",minDistForCorrespondence);
out.printf("forceBisectionOnly = %c\n",forceBisectionOnly ? 'Y':'N');
out.printf("useMapMatching = %c\n",useMapMatching ? 'Y':'N');
out.printf("minimumNumberElementsEachCluster = %i\n",minimumNumberElementsEachCluster);
}
示例9: sizeof
/*---------------------------------------------------------------
Implements the writing to a CStream capability of CSerializable objects
---------------------------------------------------------------*/
void CWirelessPowerGridMap2D::writeToStream(mrpt::utils::CStream &out, int *version) const
{
if (version)
*version = 5;
else
{
dyngridcommon_writeToStream(out);
// To ensure compatibility: The size of each cell:
uint32_t n = static_cast<uint32_t>(sizeof( TRandomFieldCell ));
out << n;
// Save the map contents:
n = static_cast<uint32_t>(m_map.size());
out << n;
// Save the "m_map": This requires special handling for big endian systems:
#if MRPT_IS_BIG_ENDIAN
for (uint32_t i=0;i<n;i++)
{
out << m_map[i].kf_mean << m_map[i].dm_mean << m_map[i].dmv_var_mean;
}
#else
// Little endian: just write all at once:
out.WriteBuffer( &m_map[0], sizeof(m_map[0])*m_map.size() ); // TODO: Do this endianness safe!!
#endif
// Version 1: Save the insertion options:
out << uint8_t(m_mapType)
<< m_cov
<< m_stackedCov;
out << insertionOptions.sigma
<< insertionOptions.cutoffRadius
<< insertionOptions.R_min
<< insertionOptions.R_max
<< insertionOptions.KF_covSigma
<< insertionOptions.KF_initialCellStd
<< insertionOptions.KF_observationModelNoise
<< insertionOptions.KF_defaultCellMeanValue
<< insertionOptions.KF_W_size;
// New in v3:
out << m_average_normreadings_mean << m_average_normreadings_var << uint64_t(m_average_normreadings_count);
out << genericMapParams; // v4
}
}
示例10: writeToStream
/*---------------------------------------------------------------
writeToStream
---------------------------------------------------------------*/
void CMemoryChunk::writeToStream(mrpt::utils::CStream &out, int *out_Version) const
{
if (out_Version)
*out_Version = 0;
else
{
out << static_cast<uint64_t>(m_bytesWritten);
if (m_bytesWritten)
{
ASSERT_(m_memory.get())
out.WriteBuffer(m_memory.get(),m_bytesWritten);
}
}
}
示例11: writeToStreamRender
void CRenderizable::writeToStreamRender(mrpt::utils::CStream &out) const
{
// MRPT 0.9.5 svn 2774 (Dec 14th 2011):
// Added support of versioning at this level of serialization too.
// Should have been done from the beginning, terrible mistake on my part.
// Now, the only solution is something as ugly as this:
//
// For reference: In the past this started as:
// out << m_name << (float)(m_color.R) << (float)(m_color.G) << (float)(m_color.B) << (float)(m_color.A);
// ...
const uint8_t serialization_version = 0; // can't be >31 (but it would be mad geting to that situation!)
const bool all_scales_equal = (m_scale_x==m_scale_y && m_scale_z==m_scale_x);
const bool all_scales_unity = (all_scales_equal && m_scale_x==1.0f);
const uint8_t magic_signature[2] = {
0xFF,
// bit7: fixed to 1 to mark this new header format
// bit6: whether the 3 scale{x,y,z} are equal to 1.0
// bit5: whether the 3 scale{x,y,z} are equal to each other
static_cast<uint8_t>( serialization_version | (all_scales_unity ? 0xC0 : (all_scales_equal ? 0xA0 : 0x80) ) )
};
out << magic_signature[0] << magic_signature[1];
// "m_name"
const uint16_t nameLen = static_cast<uint16_t>(m_name.size());
out << nameLen;
if (nameLen) out.WriteBuffer(m_name.c_str(),m_name.size());
// Color, as u8:
out << m_color.R << m_color.G << m_color.B << m_color.A;
// the rest of fields:
out << (float)m_pose.x() << (float)m_pose.y() << (float)m_pose.z()
<< (float)m_pose.yaw() << (float)m_pose.pitch() << (float)m_pose.roll();
if (!all_scales_unity)
{
if (all_scales_equal)
out << m_scale_x;
else out << m_scale_x << m_scale_y << m_scale_z;
}
out << m_show_name
<< m_visible;
}
示例12: writeToStream
/*---------------------------------------------------------------
writeToStream
---------------------------------------------------------------*/
void CMatrixB::writeToStream(mrpt::utils::CStream &out, int *out_Version) const
{
if (out_Version)
*out_Version = 0;
else
{
out << (uint32_t)sizeof(m_Val[0][0]);
// First, write the number of rows and columns:
out << (uint32_t)m_Rows << (uint32_t)m_Cols;
if (m_Rows>0 && m_Cols>0)
for (unsigned int i=0;i<m_Rows;i++)
out.WriteBuffer(m_Val[i],sizeof(m_Val[0][0])*m_Cols);
}
}
示例13: readFromStream
/*---------------------------------------------------------------
readFromStream
---------------------------------------------------------------*/
void CMemoryChunk::readFromStream(mrpt::utils::CStream &in, int version)
{
switch(version)
{
case 0:
{
uint64_t N;
in >> N;
resize(N);
m_bytesWritten = N;
m_position = 0;
if (N)
in.ReadBuffer( m_memory.get(), N );
} break;
default:
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
};
}
示例14:
/*---------------------------------------------------------------
dumpToTextStream
---------------------------------------------------------------*/
void CHMTSLAM::TOptions::dumpToTextStream(mrpt::utils::CStream &out) const
{
out.printf("\n----------- [CHMTSLAM::TOptions] ------------ \n\n");
LOADABLEOPTS_DUMP_VAR( LOG_OUTPUT_DIR, string );
LOADABLEOPTS_DUMP_VAR( LOG_FREQUENCY, int);
LOADABLEOPTS_DUMP_VAR( SLAM_METHOD, int);
LOADABLEOPTS_DUMP_VAR( SLAM_MIN_DIST_BETWEEN_OBS, float );
LOADABLEOPTS_DUMP_VAR_DEG( SLAM_MIN_HEADING_BETWEEN_OBS );
LOADABLEOPTS_DUMP_VAR( MIN_ODOMETRY_STD_XY, float );
LOADABLEOPTS_DUMP_VAR_DEG( MIN_ODOMETRY_STD_PHI );
LOADABLEOPTS_DUMP_VAR( random_seed, int );
AA_options.dumpToTextStream(out);
pf_options.dumpToTextStream(out);
KLD_params.dumpToTextStream(out);
defaultMapsInitializers.dumpToTextStream(out);
TLC_grid_options.dumpToTextStream(out);
TLC_fabmap_options.dumpToTextStream(out);
}
示例15: if
/*---------------------------------------------------------------
dumpToTextStream
---------------------------------------------------------------*/
void COccupancyGridMap2D::TLikelihoodOptions::dumpToTextStream(mrpt::utils::CStream &out) const
{
out.printf("\n----------- [COccupancyGridMap2D::TLikelihoodOptions] ------------ \n\n");
out.printf("likelihoodMethod = ");
switch (likelihoodMethod)
{
case lmMeanInformation: out.printf("lmMeanInformation"); break;
case lmRayTracing: out.printf("lmRayTracing"); break;
case lmConsensus: out.printf("lmConsensus"); break;
case lmCellsDifference: out.printf("lmCellsDifference"); break;
case lmLikelihoodField_Thrun: out.printf("lmLikelihoodField_Thrun"); break;
case lmLikelihoodField_II: out.printf("lmLikelihoodField_II"); break;
case lmConsensusOWA: out.printf("lmConsensusOWA"); break;
default:
out.printf("UNKNOWN!!!"); break;
}
out.printf("\n");
out.printf("enableLikelihoodCache = %c\n", enableLikelihoodCache ? 'Y':'N');
out.printf("LF_stdHit = %f\n", LF_stdHit );
out.printf("LF_zHit = %f\n", LF_zHit );
out.printf("LF_zRandom = %f\n", LF_zRandom );
out.printf("LF_maxRange = %f\n", LF_maxRange );
out.printf("LF_decimation = %u\n", LF_decimation );
out.printf("LF_maxCorrsDistance = %f\n", LF_maxCorrsDistance );
out.printf("LF_useSquareDist = %c\n", LF_useSquareDist ? 'Y':'N');
out.printf("LF_alternateAverageMethod = %c\n", LF_alternateAverageMethod ? 'Y':'N');
out.printf("MI_exponent = %f\n", MI_exponent );
out.printf("MI_skip_rays = %u\n", MI_skip_rays );
out.printf("MI_ratio_max_distance = %f\n", MI_ratio_max_distance );
out.printf("rayTracing_useDistanceFilter = %c\n", rayTracing_useDistanceFilter ? 'Y':'N');
out.printf("rayTracing_decimation = %u\n", rayTracing_decimation );
out.printf("rayTracing_stdHit = %f\n", rayTracing_stdHit );
out.printf("consensus_takeEachRange = %u\n", consensus_takeEachRange );
out.printf("consensus_pow = %.02f\n", consensus_pow);
out.printf("OWA_weights = [");
for (size_t i=0;i<OWA_weights.size();i++)
{
if (i<3 || i>(OWA_weights.size()-3))
out.printf("%.03f ",OWA_weights[i]);
else if (i==3 && OWA_weights.size()>6)
out.printf(" ... ");
}
out.printf("] (size=%u)\n",(unsigned)OWA_weights.size());
out.printf("\n");
}