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


C++ IStream::serial方法代码示例

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


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

示例1: dataBaseToStream

// ***************************************************************************
void CInterfaceConfig::dataBaseToStream (NLMISC::IStream &f)
{
	if (f.isReading())
	{
		nlwarning("stream is not in writing mode");
		return;
	}

	CInterfaceManager *pIM = CInterfaceManager::getInstance();

	// Save branch of the database
	SDBLeaf leafTmp;
	CCDBNodeBranch *pDB = pIM->getDbBranch ("UI:SAVE");
	if (pDB != NULL)
	{
		// Number of leaf to save
		uint32 nbLeaves = pDB->countLeaves();
		f.serial(nbLeaves);

		for (uint32 i = 0; i < nbLeaves; ++i)
		{
			uint count = i;
			CCDBNodeLeaf *pNL = pDB->findLeafAtCount(count);
			leafTmp.setFrom(pNL);
			f.serial(leafTmp);
		}
	}
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:29,代码来源:interface_config.cpp

示例2: serial

//***********************************************************************************************
void CParticleWorkspace::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	f.xmlPush("PARTICLE_WORKSPACE");
	f.serialVersion(0);
	f.xmlSerial(_Name, "NAME");	
	f.xmlPush("PS_LIST");
	uint32 numNodes = (uint32)_Nodes.size();
	// TODO : avoid to store the number of nodes
	f.xmlSerial(numNodes, "NUM_NODES");		
	if (f.isReading())
	{
		for(uint k = 0; k < numNodes; ++k)
		{		
			_Nodes.push_back(new CNode());						
			_Nodes.back()->init(this);
			f.serial(*_Nodes.back());
		}	
	}
	else
	{
		for(uint k = 0; k < numNodes; ++k)
		{
			f.serial(*_Nodes[k]);
		}		
	}
	f.xmlPop();
	f.xmlPop();
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:29,代码来源:particle_workspace.cpp

示例3: serial

void CScriptData::serial(NLMISC::IStream &f)
{
	uint16 size;
	if (f.isReading())
	{
		Scripts.clear();
		f.serial(size);

		uint32 i = 0;
		for (; i < size; ++i)
		{
			//std::string tmpKey;
			CCustomElementId tmpKey;
			std::vector<std::string> tmpVal;
			f.serial(tmpKey);
			f.serialCont(tmpVal);
			Scripts.insert(make_pair(tmpKey,tmpVal));
		}
	}
	else
	{
		size = (uint16)Scripts.size();
		f.serial(size);	
		for (TScripts::iterator it = Scripts.begin(); it != Scripts.end(); ++it)
		{
			//std::string tmp = it->first;			
			nlWrite(f, serial, it->first);
			nlWrite(f, serialCont, it->second);			
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:31,代码来源:npc_description_messages.cpp

示例4: serial

void CStreamSound::serial(NLMISC::IStream &s)
{
	CSound::serial(s);

	s.serial(_MinDist);
	s.serial(m_Alpha);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:7,代码来源:stream_sound.cpp

示例5:

// ***************************************************************************
void	CVegetable::serial(NLMISC::IStream &f)
{
	/*
	Version 1:
		- add BendFrequencyFactor
	Version 0:
		- base version
	*/
	sint	ver= f.serialVersion(1);

	f.serial(ShapeName);
	f.serial(Density);
	f.serial(MaxDensity);
	f.serial(_CosAngleMin, _CosAngleMax, _CosAngleMiddle, _OOCosAngleDist);
	f.serialEnum(_AngleType);
	f.serial(Sxy, Sz);
	f.serial(Rx, Ry, Rz);
	f.serial(BendFactor);
	f.serial(BendPhase);
	f.serial(Color);
	f.serial(DistType);

	if(ver>=1)
		f.serial(BendFrequencyFactor);
	else
		BendFrequencyFactor= 1;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:28,代码来源:vegetable.cpp

示例6:

void				CSimpleSound::serial(NLMISC::IStream &s)
{
	std::string bufferName;
	CSound::serial(s);

	s.serial(_MinDist);
	s.serial(_Alpha);

	if (s.isReading())
	{
		s.serial(bufferName);
		_Buffername = CStringMapper::map(bufferName);
		setBuffer(NULL);

		// contain % so it need a context to play
		if (bufferName.find ("%") != string::npos)
		{
			_NeedContext = true;
		}
	}
	else
	{
		bufferName = CStringMapper::unmap(_Buffername);
		s.serial(bufferName);
	}
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:26,代码来源:simple_sound.cpp

示例7: serial

// ***************************************************************************
void CCtrlBase::serial(NLMISC::IStream &f)
{
	CViewBase::serial(f);
	f.serial(_ContextHelp);
	f.serial(_OnContextHelp);
	f.serial(_OnContextHelpParams);
	f.serial(_ToolTipSpecialParent);
	f.serialEnum(_ToolTipParent);
	//

	THotSpot tmpToolTipParentPosRef = _ToolTipParentPosRef;
	THotSpot tmpToolTipPosRef = _ToolTipPosRef;
	THotSpot tmpToolTipParentPosRefAlt = _ToolTipParentPosRefAlt;
	THotSpot tmpToolTipPosRefAlt = _ToolTipPosRefAlt;

	f.serialEnum(tmpToolTipParentPosRef);
	f.serialEnum(tmpToolTipPosRef);
	f.serialEnum(tmpToolTipParentPosRefAlt);
	f.serialEnum(tmpToolTipPosRefAlt);

	_ToolTipParentPosRef = tmpToolTipParentPosRef;
	_ToolTipPosRef = tmpToolTipPosRef;
	_ToolTipParentPosRefAlt = tmpToolTipParentPosRefAlt;
	_ToolTipPosRefAlt = tmpToolTipPosRefAlt;	
	//
	nlSerialBitBool(f, _ToolTipInstant);	
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:28,代码来源:ctrl_base.cpp

示例8: serial

///======================================================================================
void CPSFace::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	NL_PS_FUNC(CPSFace_IStream )
	f.serialVersion(1);
	CPSQuad::serial(f);
	CPSRotated3DPlaneParticle::serialPlaneBasisScheme(f);

	if (f.isReading())
	{
		uint32 nbConfigurations;
		f.serial(nbConfigurations);
		if (nbConfigurations)
		{
			f.serial(_MinAngularVelocity, _MaxAngularVelocity);
		}
		hintRotateTheSame(nbConfigurations, _MinAngularVelocity, _MaxAngularVelocity);

		init();
	}
	else
	{
		uint32 nbConfigurations = (uint32)_PrecompBasis.size();
		f.serial(nbConfigurations);
		if (nbConfigurations)
		{
			f.serial(_MinAngularVelocity, _MaxAngularVelocity);
		}
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:30,代码来源:ps_face.cpp

示例9: streamToDataBase

// ***************************************************************************
void CInterfaceConfig::streamToDataBase (NLMISC::IStream &f, uint32 uiDbSaveVersion)
{
	if (!f.isReading())
	{
		nlwarning("stream is not in reading mode");
		return;
	}

	sint32 begPos = f.getPos();
	f.seek (0, NLMISC::IStream::end);
	sint32 endPos = f.getPos();
	if ((begPos - endPos) == 0) return;
	f.seek (begPos, NLMISC::IStream::begin);

	CInterfaceManager *pIM = CInterfaceManager::getInstance();

	// Load branch of the database
	SDBLeaf leafTmp;
	CCDBNodeBranch *pDB = pIM->getDbBranch ("UI:SAVE");
	if (pDB != NULL)
	{
		// Number of leaf to save
		uint32 nbLeaves = 0;
		f.serial(nbLeaves);

		for (uint32 i = 0; i < nbLeaves; ++i)
		{
			f.serial(leafTmp);

			// If there is a define RESET_VER_dbName that exist for this DB, check if version is OK
			bool	wantRead= true;
			// Format dbName for version check
			string	defVerId= "RESET_VER_";
			defVerId+= leafTmp.Name;
			for(uint i=0;i<defVerId.size();i++)
			{
				if(defVerId[i]==':')
					defVerId[i]='_';
			}
			// check if exist
			if(pIM->isDefineExist(defVerId))
			{
				uint32	dbVer;
				fromString(pIM->getDefine(defVerId), dbVer);
				// if the version in the file is older than the version this db want, abort read
				if(uiDbSaveVersion<dbVer)
					wantRead= false;
			}

			// if want read the value from file, read it, else keep the default one
			if(wantRead)
			{
				CCDBNodeLeaf *pNL = pIM->getDbProp(leafTmp.Name,false);
				if (pNL != NULL)
					leafTmp.setTo(pNL);
			}
		}
	}
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:60,代码来源:interface_config.cpp

示例10:

// ***************************************************************************
void					CTrackSampledCommon::CTimeBlock::serial(NLMISC::IStream &f)
{
	(void)f.serialVersion(0);

	f.serial(TimeOffset);
	f.serial(KeyOffset);
	f.serial(Times);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:9,代码来源:track_sampled_common.cpp

示例11:

void	CPrimitivePlugin::TCreatureInfo::serial (NLMISC::IStream &s)
{
	s.serial(HaveRadius);
	s.serial(Radius);
	s.serial(HaveBox);
	s.serial(Width);
	s.serial(Length);
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:8,代码来源:primitive_plugin.cpp

示例12: serial

void CModifierInDB::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	f.serial(Disabled);
	if(Disabled) 
	{
		f.serial(ActivationDate);
		f.serial(SheetId);
	}		
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:9,代码来源:modifiers_in_db.cpp

示例13: throw

///===========================================================================
void	CParticleSystemShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	/* ***********************************************
	 *	WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
	 *	It can be loaded/called through CAsyncFileManager for instance
	 * ***********************************************/

	sint ver = f.serialVersion(6);
	/// version 6 : added sharing flag
	//NLMISC::CVector8 &buf = _ParticleSystemProto.bufferAsVector();
	//f.serialCont(buf);

	if (f.isReading ())
	{
		std::vector<uint8> buf;
		f.serialCont(buf);
		_ParticleSystemProto.fill(&buf[0], (uint32)buf.size());
	}
	else
	{
		f.serialBufferWithSize ((uint8*)_ParticleSystemProto.buffer(), _ParticleSystemProto.length());
	}

	if (ver > 1)
	{
		// serial default tracks
		for (uint k = 0; k < 4; ++k)
		{
			f.serial(_UserParamDefaultTrack[k]);
		}
	}
	if ( ver > 2)
	{
		f.serial (_DefaultPos);
		f.serial (_DefaultScale);
		f.serial (_DefaultRotQuat);
	}
	if ( ver > 3)
	{
		f.serial(_MaxViewDist);
		f.serial(_DestroyWhenOutOfFrustum);
		f.serial(_DestroyModelWhenOutOfRange);
	}
	if ( ver > 4)
	{
		f.serial(_UsePrecomputedBBox);
		if (_UsePrecomputedBBox)
		{
			f.serial(_PrecomputedBBox);
		}
	}
	if ( ver > 5)
	{
		f.serial(_Sharing);
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:57,代码来源:particle_system_shape.cpp

示例14:

// ***************************************************************************
void			CAABBox::serial(NLMISC::IStream &f)
{
	/* ***********************************************
	 *	WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
	 *	It can be loaded/called through CAsyncFileManager for instance
	 * ***********************************************/
	(void)f.serialVersion(0);
	f.serial(Center);
	f.serial(HalfSize);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:11,代码来源:aabbox.cpp

示例15: serial

void CFormBodyEltAtom::serial( NLMISC::IStream& s)
{

	s.xmlPushBegin( "Atom" );
		s.xmlSetAttrib( "Name" );
			s.serial( sxname );
		s.xmlSetAttrib( "Value" );
			s.serial( sxvalue );
	s.xmlPushEnd();
	s.xmlPop();
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:11,代码来源:form_body_elt_atom.cpp


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