当前位置: 首页>>代码示例>>C++>>正文


C++ CStream::ReadBuffer方法代码示例

本文整理汇总了C++中mrpt::utils::CStream::ReadBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CStream::ReadBuffer方法的具体用法?C++ CStream::ReadBuffer怎么用?C++ CStream::ReadBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mrpt::utils::CStream的用法示例。


在下文中一共展示了CStream::ReadBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)

	};
}
开发者ID:mangi020,项目名称:mrpt,代码行数:37,代码来源:CHolonomicND.cpp

示例2: 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)

	};
}
开发者ID:3660628,项目名称:mrpt,代码行数:30,代码来源:CMatrixB.cpp

示例3: 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)

	};
}
开发者ID:Insomnia-,项目名称:mrpt,代码行数:24,代码来源:CMemoryChunk.cpp

示例4: readFromStreamRender

void  CRenderizable::readFromStreamRender(mrpt::utils::CStream &in)
{
	// MRPT 0.9.5 svn 2774 (Dec 14th 2011):
	// See comments in CRenderizable::writeToStreamRender() for the employed serialization mechanism.
	//

	// Read signature:
	union {
		uint8_t  magic_signature[2+2];  // (the extra 4 bytes will be used only for the old format)
		uint32_t magic_signature_uint32;  // So we can interpret the 4bytes above as a 32bit number cleanly.
	};

	in >> magic_signature[0] >> magic_signature[1];

	const bool is_new_format = (magic_signature[0]==0xFF) && ((magic_signature[1]&0x80)!=0);

	if (is_new_format)
	{
		// NEW FORMAT:
		uint8_t serialization_version = (magic_signature[1] & 0x1F);
		const bool all_scales_unity = ((magic_signature[1]&0x40)!=0);
		const bool all_scales_equal_but_not_unity = ((magic_signature[1]&0x20)!=0);

		switch(serialization_version)
		{
		case 0:
			{
			// "m_name"
			uint16_t nameLen;
			in >> nameLen;
			m_name.resize(nameLen);
			if (nameLen) in.ReadBuffer((void*)(&m_name[0]),m_name.size());

			// Color, as u8:
			in >> m_color.R >> m_color.G >> m_color.B >> m_color.A;

			// the rest of fields:
			float x,y,z,yaw,pitch,roll;
			in >> x >> y >> z >> yaw >> pitch >> roll;
			m_pose.x(x); m_pose.y(y); m_pose.z(z);
			m_pose.setYawPitchRoll( yaw,pitch,roll );

			if (all_scales_unity)
					m_scale_x=m_scale_y=m_scale_z=1;
			else {
				if (all_scales_equal_but_not_unity)
				{
					in >> m_scale_x;
					m_scale_y = m_scale_z = m_scale_x;
				}
				else in >> m_scale_x >> m_scale_y >> m_scale_z;
			}

			in >> m_show_name
			   >> m_visible;
			}
			break;
		default:
			THROW_EXCEPTION_CUSTOM_MSG1("Can't parse CRenderizable standard data field: corrupt data stream or format in a newer MRPT format? (serialization version=%u)",static_cast<unsigned int>(serialization_version))
		};
	}
	else
	{
开发者ID:Insomnia-,项目名称:mrpt,代码行数:63,代码来源:CRenderizable.cpp


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