本文整理汇总了C++中readObject函数的典型用法代码示例。如果您正苦于以下问题:C++ readObject函数的具体用法?C++ readObject怎么用?C++ readObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readObject
//----------------------------------------------------------------------
void WalkmeshFileSerializer::readObject( Ogre::DataStreamPtr &stream
,WalkmeshFileSerializer::Triangle &pDest)
{
readObject( stream, pDest.a );
readObject( stream, pDest.b );
readObject( stream, pDest.c );
}
示例2: readString
//---------------------------------------------------------------------
void SkeletonSerializer::readBone(DataStreamPtr& stream, Skeleton* pSkel)
{
// char* name
String name = readString(stream);
// unsigned short handle : handle of the bone, should be contiguous & start at 0
unsigned short handle;
readShorts(stream, &handle, 1);
// Create new bone
Bone* pBone = pSkel->createBone(name, handle);
// Vector3 position : position of this bone relative to parent
Vector3 pos;
readObject(stream, pos);
pBone->setPosition(pos);
// Quaternion orientation : orientation of this bone relative to parent
Quaternion q;
readObject(stream, q);
pBone->setOrientation(q);
#if OGRE_SERIALIZER_VALIDATE_CHUNKSIZE
// Hack to fix chunk size validation:
mChunkSizeStack.back() += calcStringSize(name);
#endif
// TODO: don't depend on mCurrentstreamLen in next skeleton format!
// Currently we use wrong chunk sizes, but we can't fix it, because we depend on mCurrentstreamLen
// Do we have scale?
if (mCurrentstreamLen > calcBoneSizeWithoutScale(pSkel, pBone))
{
Vector3 scale;
readObject(stream, scale);
pBone->setScale(scale);
}
}
示例3: readObject
core::Error readObject(const json::Object& object,
const std::string& name1, T1* pValue1,
const std::string& name2, T2* pValue2,
const std::string& name3, T3* pValue3,
const std::string& name4, T4* pValue4,
const std::string& name5, T5* pValue5,
const std::string& name6, T6* pValue6,
const std::string& name7, T7* pValue7,
const std::string& name8, T8* pValue8,
const std::string& name9, T9* pValue9,
const std::string& name10, T10* pValue10)
{
Error error = readObject(object,
name1, pValue1,
name2, pValue2,
name3, pValue3,
name4, pValue4,
name5, pValue5,
name6, pValue6,
name7, pValue7,
name8, pValue8,
name9, pValue9);
if (error)
return error;
return readObject(object, name10, pValue10);
}
示例4: throw
void PersistEngine::read(PersistObject *&object) throw(PersistException)
{
uint32_t id = 0;
read(id);
// Is the ID a NULL object?
if (id == NullObject) {
object = NULL;
return;
}
// Do we already have this object in memory?
if (id < myArchiveVector.size()) {
object = myArchiveVector[id];
return;
}
// Okay - read the identifier for the class in...
std::string className = readClass();
// is the pointer already initialized? if so then no need to reallocate
if (object != NULL) {
readObject(object);
return;
}
// Create the object (of the relevant type)
object = TypeManager::createInstanceOf(className.c_str());
if (object) {
// Okay then - we can make this object
readObject(object);
}
else
throw(PersistException(std::string("Unable to instantiate object of class ")+className));
}
示例5: readString
//---------------------------------------------------------------------
void SkeletonSerializer::readBone(DataStreamPtr& stream, Skeleton* pSkel)
{
// char* name
String name = readString(stream);
// unsigned short handle : handle of the bone, should be contiguous & start at 0
unsigned short handle;
readShorts(stream, &handle, 1);
// Create new bone
Bone* pBone = pSkel->createBone(name, handle);
// Vector3 position : position of this bone relative to parent
Vector3 pos;
readObject(stream, pos);
pBone->setPosition(pos);
// Quaternion orientation : orientation of this bone relative to parent
Quaternion q;
readObject(stream, q);
pBone->setOrientation(q);
// Do we have scale?
if (mCurrentstreamLen > calcBoneSizeWithoutScale(pSkel, pBone))
{
Vector3 scale;
readObject(stream, scale);
pBone->setScale(scale);
}
}
示例6: readFloats
//---------------------------------------------------------------------
void SkeletonSerializer::readKeyFrame(DataStreamPtr& stream, NodeAnimationTrack* track,
Skeleton* pSkel)
{
// float time : The time position (seconds)
float time;
readFloats(stream, &time, 1);
TransformKeyFrame *kf = track->createNodeKeyFrame(time);
// Quaternion rotate : Rotation to apply at this keyframe
Quaternion rot;
readObject(stream, rot);
kf->setRotation(rot);
// Vector3 translate : Translation to apply at this keyframe
Vector3 trans;
readObject(stream, trans);
kf->setTranslate(trans);
// Do we have scale?
if (mCurrentstreamLen > calcKeyFrameSizeWithoutScale(pSkel, kf))
{
Vector3 scale;
readObject(stream, scale);
kf->setScale(scale);
}
}
示例7: readObject
CompareData::CompareData (SharedPtr<DataBlock> a, SharedPtr<DataBlock> b)
: Operation ("CompareData")
, m_a (a)
, m_b (b)
{
readObject(SharedPtr<Object>(a));
readObject(SharedPtr<Object>(b));
}
示例8: readInts
void LodConfigSerializer::readLodProfile()
{
uint32 size = 0;
readInts(mStream, &size, 1);
mLodConfig->advanced.profile.clear();
while(size--){
ProfiledEdge pv;
readObject(mStream, pv.src);
readObject(mStream, pv.dst);
readFloats(mStream, &pv.cost, 1);
mLodConfig->advanced.profile.push_back(pv);
}
}
示例9: switch
void Uc::import(File & f) {
for (;;) {
Q3CString s;
switch (f.read(s)) {
case -1:
f.eof();
throw 0;
case ')':
return;
case ATOM:
if ((s == "logical_models") ||
(s == "logical_presentations")) {
f.read("(");
f.read("list");
f.read("unit_reference_list");
readObjects(f);
}
else
readObject(f, s);
break;
default:
f.syntaxError(s);
}
}
}
示例10: while
static Obj *readDict( istream& is )
{
string lhs;
Obj *rhs;
map<string,Obj*> ret;
is.get();
while( true ) {
eat( is );
if( is.peek() == '}' ) {
is.get();
return new DictObj( ret );
}
lhs = readID( is );
eat( is );
if( is.get() != '=' ) {
throw ParseError( "Parse error: expected equals." );
}
rhs = readObject( is );
ret[ lhs ] = rhs;
eat( is );
int ch = is.peek();
if( ch == ';' ) {
is.get();
} else if( ch != '}' ) {
throw ParseError( "Parse error: expected semicolon or brace." );
}
}
}
示例11: readObjectParam
core::Error readObjectParam(const json::Array& params,
unsigned int index,
const std::string& name1, T1* pValue1,
const std::string& name2, T2* pValue2,
const std::string& name3, T3* pValue3,
const std::string& name4, T4* pValue4,
const std::string& name5, T5* pValue5,
const std::string& name6, T6* pValue6,
const std::string& name7, T7* pValue7,
const std::string& name8, T8* pValue8,
const std::string& name9, T9* pValue9,
const std::string& name10, T10* pValue10)
{
json::Object object;
Error error = json::readParam(params, index, &object);
if (error)
return error;
return readObject(object,
name1, pValue1,
name2, pValue2,
name3, pValue3,
name4, pValue4,
name5, pValue5,
name6, pValue6,
name7, pValue7,
name8, pValue8,
name9, pValue9,
name10, pValue10);
}
示例12: read2ByteBool
//---------------------------------------------------------------------
void
BackgroundFileSerializer::readObject( Ogre::DataStreamPtr &stream, Page &pDest )
{
read2ByteBool( stream, pDest.enabled );
if( !pDest.enabled ) return;
readShort( stream, pDest.unknown_02 );
readShort( stream, pDest.value_size );
if( pDest.value_size != 1 && pDest.value_size != 2 )
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS
,"Page value_size other then 1 and 2 is not supported"
,"BackgroundFileSerializer::readObject" );
}
size_t color_count( BackgroundFile::PAGE_DATA_SIZE );
pDest.colors.clear();
pDest.data.clear();
if( pDest.value_size == 2 )
{
pDest.colors.reserve( color_count );
for( size_t i( color_count ); i--; )
{
Color colourDest;
readObject( stream, colourDest );
pDest.colors.push_back( colourDest );
}
}
else
{
pDest.data.resize( color_count );
stream->read( &pDest.data[0], color_count );
}
}
示例13: throw
//------------------------------------------------------------------------------
void IFile::load(const char *fileName) throw (std::ios_base::failure)
{
if (loaded_)
{
unload();
loaded_ = false;
}
fileName_ = std::string(fileName);
fileIn_.close(); //TODO: necessary?
fileIn_.open(fileName, std::ios::binary | std::ios::in);
if (fileIn_.fail())
{
fileIn_.close();
throw std::ios_base::failure("Cant read file: \"" + fileName_ + "\"");
}
else
{
readObject(fileIn_);
loaded_ = true;
}
}
示例14:
bool SceneTutorial27::InitObjects()
{
if( ! readObject("Data/Object2.txt", obj) ) {
return false;
}
return true;
}
示例15: createCondensedObjects
static std::vector<readObject> createCondensedObjects(std::vector<T> reads) {
std::vector<readObject> ans;
readVec::allSetCondensedSeq(reads);
for (const auto& read : reads) {
ans.emplace_back(readObject(seqInfo(read.seqBase_.name_, read.condensedSeq,
read.condensedSeqQual)));
}
return ans;
}