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


C++ ObjectRef::get方法代码示例

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


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

示例1: getFreeParticle

std::shared_ptr<Ego::Particle> ParticleHandler::spawnParticle(const Vector3f& spawnPos, const Facing& spawnFacing, const PRO_REF spawnProfile,
                                                              const PIP_REF particleProfile, const ObjectRef spawnAttach, Uint16 vrt_offset, const TEAM_REF spawnTeam,
                                                              const ObjectRef spawnOrigin, const ParticleRef spawnParticleOrigin, const int multispawn, const ObjectRef spawnTarget, const bool onlyOverWater)
{
    const std::shared_ptr<ParticleProfile> &ppip = ProfileSystem::get().ParticleProfileSystem.get_ptr(particleProfile);

    if (!ppip)
    {
        const std::string spawnOriginName = _currentModule->getObjectHandler().exists(spawnOrigin) ? _currentModule->getObjectHandler()[spawnOrigin]->getName() : "INVALID";
        const std::string spawnProfileName = ProfileSystem::get().isValidProfileID(spawnProfile) ? ProfileSystem::get().getProfile(spawnProfile)->getPathname() : "INVALID";
		Log::get().debug("spawn_one_particle() - cannot spawn particle with invalid particle profile == %d, spawn origin == %" PRIuZ " (\"%s\"), spawn profile == %d (\"%s\"))\n",
                         REF_TO_INT(particleProfile), 
                         spawnOrigin.get(), spawnOriginName.c_str(),
                         REF_TO_INT(spawnProfile), spawnProfileName.c_str());

        return Ego::Particle::INVALID_PARTICLE;
    }

    // count all the requests for this particle type
    ppip->_spawnRequestCount++;

    //Try to get a free particle
    std::shared_ptr<Ego::Particle> particle = getFreeParticle(ppip->force);
    if(particle) {
        //Initialize particle and add it into the game
        if(particle->initialize(ParticleRef(_totalParticlesSpawned++), spawnPos, spawnFacing, spawnProfile, particleProfile, spawnAttach, vrt_offset, 
                                spawnTeam, spawnOrigin, ParticleRef(spawnParticleOrigin), multispawn, spawnTarget, onlyOverWater)) 
        {
            _pendingParticles.push_back(particle);
            _particleMap[particle->getParticleID()] = particle;
        }
        else {
            //If we failed to spawn somehow, put it back to the unused pool
            _unusedPool.push_back(particle);
        }        
    }

    if(!particle) {
        const std::string spawnOriginName = _currentModule->getObjectHandler().exists(spawnOrigin) ? _currentModule->getObjectHandler().get(spawnOrigin)->getName() : "INVALID";
        const std::string particleProfileName = LOADED_PIP(particleProfile) ? ProfileSystem::get().ParticleProfileSystem.get_ptr(particleProfile)->_name : "INVALID";
        const std::string spawnProfileName = ProfileSystem::get().isValidProfileID(spawnProfile) ? ProfileSystem::get().getProfile(spawnProfile)->getPathname().c_str() : "INVALID";
        Log::get().debug("spawn_one_particle() - cannot allocate a particle!    owner == %" PRIuZ "(\"%s\"), spawn profile == %d(\"%s\"), particle profile == %d(\"%s\")\n",
                         spawnOrigin.get(), spawnOriginName.c_str(),
                         REF_TO_INT(spawnProfile), spawnProfileName.c_str(),
                         REF_TO_INT(particleProfile), particleProfileName.c_str());        
    }

    return particle;
}
开发者ID:dreamsxin,项目名称:egoboo,代码行数:49,代码来源:ParticleHandler.cpp

示例2: JO

QString Stringify::JO(ObjectRef o)
{
    if (stack.contains(o.getPointer())) {
        ctx->throwTypeError();
        return QString();
    }

    Scope scope(ctx);

    QString result;
    stack.push(o.getPointer());
    QString stepback = indent;
    indent += gap;

    QStringList partial;
    if (propertyList.isEmpty()) {
        ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly);
        ScopedValue name(scope);

        ScopedValue val(scope);
        while (1) {
            name = it.nextPropertyNameAsString(val);
            if (name->isNull())
                break;
            QString key = name->toQString();
            QString member = makeMember(key, val);
            if (!member.isEmpty())
                partial += member;
        }
    } else {
        ScopedString s(scope);
        for (int i = 0; i < propertyList.size(); ++i) {
            bool exists;
            s = propertyList.at(i);
            ScopedValue v(scope, o->get(s, &exists));
            if (!exists)
                continue;
            QString member = makeMember(s->toQString(), v);
            if (!member.isEmpty())
                partial += member;
        }
    }

    if (partial.isEmpty()) {
        result = QStringLiteral("{}");
    } else if (gap.isEmpty()) {
        result = QStringLiteral("{") + partial.join(QLatin1Char(',')) + QStringLiteral("}");
    } else {
        QString separator = QStringLiteral(",\n") + indent;
        result = QStringLiteral("{\n") + indent + partial.join(separator) + QStringLiteral("\n") + stepback + QStringLiteral("}");
    }

    indent = stepback;
    stack.pop();
    return result;
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:56,代码来源:qv4jsonobject.cpp

示例3: testObjectBlock

void testObjectBlock (void)
{
    /*ObjectRef<int> obj;
    obj.allocate();
    *obj.get() = 18;*/

    ObjectRef<TestDummyClass> ptr;
    ptr.allocate();
    ptr.get()->i = 19;
    ptr.get()->j = 20;

    ObjectRef<TestDummyClass> ptr1 = ptr;
}
开发者ID:ArsenyChernyaev,项目名称:corecvs,代码行数:13,代码来源:main_test_buffer.cpp

示例4: GetList

void DomSerializer::GetList(const char* key, std::list<ObjectRef>& value, Object& model, bool required)
{
	// Find the node corresponding to the object list wanting to be populated
	DOMNode* listNode = FindElementByName(m_node, CStdString(key));

	// Create a new serializer and affect it to this object
	if (listNode)
	{
		// Iterate over the nodes #####
		DOMNode* node = listNode->getFirstChild();
		while(node)
		{
			// Create a new object instance
			ObjectRef newObject = model.NewInstance();
			try
			{
				DomSerializer serializer(newObject.get());
				serializer.DeSerialize(node);
				value.push_back(newObject);

			}
			catch (CStdString& e)
			{
				// For now, do not interrupt the deserialization process.
				// in the future, we might let this exception go through if the node has been
				// recognized to bear the proper tag name
				;
			}
			node = node->getNextSibling();
		}

	}
	else if (required)
	{
		throw(CStdString("DomSerializer::GetList: required node missing:") + key);
	}
}
开发者ID:havoc83,项目名称:oreka,代码行数:37,代码来源:DomSerializer.cpp

示例5: svc

int CommandLineServer::svc(void)
{
	for (bool active = true;active == true;)
	{
		char buf[2048];
		ACE_Time_Value timeout;
		timeout.sec(3600);
		int i = 0;

		// Display prompt
		char prompt[] = "\r\n>";
		peer().send(prompt, 3, MSG_NOSIGNAL);

		// Get one command line
		bool foundCRLF = false;
		while(active && !foundCRLF && i<2040)
		{
			ssize_t size = peer().recv(buf+i, 2040-i, &timeout);

			if (size == 0 || size == -1)
			{
				active = false;
			}
			else
			{
				for(int j=0; j<size && !foundCRLF;j++)
				{
					if(buf[i+j] == '\r' || buf[i+j] == '\n')
					{
						foundCRLF = true;
						buf[i+j] = '\0';
						CStdString command(buf);
						try
						{
							CStdString className = SingleLineSerializer::FindClass(command);
							ObjectRef objRef = ObjectFactory::GetSingleton()->NewInstance(className);
							if (objRef.get())
							{
								objRef->DeSerializeSingleLine(command);
								ObjectRef response = objRef->Process();
								CStdString responseString = response->SerializeSingleLine();
								peer().send((PCSTR)responseString, responseString.GetLength(), MSG_NOSIGNAL);
							}
							else
							{
								CStdString error = "Unrecognized command";
								peer().send(error, error.GetLength(), MSG_NOSIGNAL);							;
							}
						}
						catch (CStdString& e)
						{
							peer().send(e, e.GetLength(), MSG_NOSIGNAL);							;
						}
					}
				}
				i += size;
			}
		}
	}
	return 0;
}
开发者ID:HiPiH,项目名称:Oreka,代码行数:61,代码来源:MultiThreadedServer.cpp


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