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


C++ PropertyBag类代码示例

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


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

示例1: load

void ComponentExitMapOnUse::load(const PropertyBag &data)
{
	resetMembers();
	nextMap = data.getFileName("nextMap");
	sfxOnFail = data.getFileName("sfxOnFailed");
	requiresCoins = data.getBool("requiresCoins");
}
开发者ID:foxostro,项目名称:heroman,代码行数:7,代码来源:ComponentExitMapOnUse.cpp

示例2: decomposeProperty

    void decomposeProperty(const Sample<T>& sample, PropertyBag& targetbag)
    {
        std::string tname = detail::DataSourceTypeInfo<T>::getType();
        targetbag.setType("Sample");
        //std::string str;

        assert( targetbag.empty() );

        bool result =true;
        //std::stringstream out;
        //out << i+1;
        //str = out.str();

        Property<PropertyBag>* el_bag = new Property<PropertyBag>("SampleValue", "Sample Value"); 
        Property<T> el("SampleValue" , "Sample value ",sample.ValueGet())  ;
        if(    el.getTypeInfo()->decomposeType(el.getDataSource(),el_bag->value()) )
        {
            //log(Debug)<<"Element type "<<el.getType()<<" is a bag"<<endlog();
            targetbag.add( el_bag ); // Put variables in the bag
        }
        else
        {
            //log(Debug)<<"Element type "<<el.getType()<<" is not a bag"<<endlog();
            //For Property
            targetbag.add( new Property<T>("SampleValue" ,"Sample Value",sample.ValueGet() )); // Put variables in the bag
        }
    };
开发者ID:jeljaik,项目名称:orocos-bfl-berdy,代码行数:27,代码来源:SampleComposition.hpp

示例3: load

void ComponentPhysicsGeom::load(const PropertyBag &data)
{
	resetMembers();

	desiredHeight = data.getFloat("height");
	collisionRadius = data.getFloat("radius");

	// Create as physics geometry
	if(geom){dGeomDestroy(geom);} geom=0;
	createGeom(data.getString("physicsGeometryType"));

	// Set initial position
	{
		vec3 position;
		if(data.get("position", position)) // optional tag
		{
			setPosition(position);
		}
	}

	// Declare the initial state
	getParentBlackBoard().relayMessage(MessagePositionHasBeenSet(getPosition()));
	getParentBlackBoard().relayMessage(MessageOrientationHasBeenSet(getOrientation()));
	getParentBlackBoard().relayMessage(MessageRequestSetHeight(desiredHeight));
}
开发者ID:foxostro,项目名称:heroman,代码行数:25,代码来源:ComponentPhysicsGeom.cpp

示例4: load

void Monster::load(const PropertyBag &xml)
{
	Creature::load(xml);

	if(xml.exists("preferredSpell")) {
		xml.get_optional("preferredSpell", preferredSpell);
	} else {
		preferredSpell = 0;
	}

	switch(preferredSpell)
	{
	case 0: spell = new SpellFireBall	(&getZone(), m_ID, "data/spells/fireball.xml");		break; // Fireball
	case 1: spell = new SpellFireBall	(&getZone(), m_ID, "data/spells/arctic-wind.xml");	break; // Arctic Wind
	case 2: spell = new SpellIncinerate	(&getZone(), m_ID, "data/spells/incinerate.xml");		break; // Incinerate
	case 3: spell = new SpellFireBall	(&getZone(), m_ID, "data/spells/chill.xml");		break; // Chill
	case 4: spell = new SpellHeal		(&getZone(), m_ID, "data/spells/heal.xml");			break; // Heal
	case 5: spell = new SpellFireBall	(&getZone(), m_ID, "data/spells/ice-blast.xml");		break; // Ice Blast
	case 6: spell = 0; break; // Reserved for "Resurrect" Spell
	default: spell = 0; break;
	};

	if(spell!=0)
	{
		spell->available = true;
	}
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:27,代码来源:Monster.cpp

示例5: load

void PowerupHeal::load(const PropertyBag &xml)
{
	Powerup::load(xml);

	xml.get("healValue", healValue);
	xml.get("healTime", healTime);
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:7,代码来源:PowerupHeal.cpp

示例6: load

void ComponentRenderAsModel::load(const PropertyBag &data)
{
	resetMembers();
	const FileName modelFileName = data.getFileName("model");
	loadModel(modelFileName);
	data.get("independentModelOrientation", independentModelOrientation);
}
开发者ID:foxostro,项目名称:heroman,代码行数:7,代码来源:ComponentRenderAsModel.cpp

示例7: load

void ComponentSpinAround::load(const PropertyBag &data)
{
	resetMembers();
	rotationSpeed = data.getFloat("rotationSpeed");
	bounceHeight = data.getFloat("bounceHeight");
	bounceSpeed = data.getFloat("bounceSpeed");
}
开发者ID:foxostro,项目名称:heroman,代码行数:7,代码来源:ComponentSpinAround.cpp

示例8: load

void GateOpener::load(const PropertyBag &xml)
{
	Listener::load(xml);

	xml.get("gateName", gateName);
	xml.get("open", open);
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:7,代码来源:GateOpener.cpp

示例9: composeProperty

    bool composeProperty(const PropertyBag& bag, WeightedSample<T>& weightedSample)
    {
        //log(Debug) << "composeProperty of WeightedSample " << endlog();
        std::string tname = detail::DataSourceTypeInfo<T>::getType();
        if ( bag.getType() == std::string("WeightedSample") ) {
            // Get values of sample
            Property<PropertyBag>* el_bag =  bag.getProperty<PropertyBag>("WeightedSampleValue");

            if(el_bag==NULL){
                // Works for properties in WeightedSample
                PropertyBase* element = bag.getItem( 0 );
                //log(Debug)<<element->getName()<<", "<< element->getDescription()<<endlog();
                Property<T> my_property_t (element->getName(),element->getDescription());
                if(my_property_t.getType()!=element->getType())
                {
                    log(Error)<< "Type of "<< element->getName() << " does not match type of WeightedSample"<< "OR "<<"Could not read WeightedSample Value "<<endlog();
                    return false;
                }
                else{
                    my_property_t.getTypeInfo()->composeType(element->getDataSource(),my_property_t.getDataSource());
                    weightedSample.ValueSet( my_property_t.get());
                }
            }
            else{
                // Works for propertybags in WeightedSample
                const std::string el_bagType = el_bag->getType();
                Property<T > el_p(el_bag->getName(),el_bag->getDescription());
                if(!(el_p.getDataSource()->composeType(el_bag->getDataSource()))){
                    log(Error)<<"Could not compose WeightedSampleValue "<<endlog();
                    return false;
                }
                if(el_p.ready()){
                    weightedSample.ValueSet( el_p.get());
                }else{
                    log(Error)<<"Property of WeightedSampleValue was not ready for use"<<endlog();
                    return false;
                }
            }
            // Get weight of sample
            Property<double>* weightProp =  bag.getProperty<double>("WeightedSampleWeight");

            if(!weightProp)
            {
                log(Error)<< "Error reading weight of WeightedSample"<<endlog();
                return false;
            }
            else{
                weightedSample.WeightSet( weightProp->get());
            }
        }
        else {
            Logger::log() << Logger::Error << "Composing Property< WeightedSample<T> > :"
                          << " type mismatch, got type '"<< bag.getType()
                          << "', expected type "<<tname<<"."<<Logger::endl;
            return false;
        }
        return true;
    };
开发者ID:jeljaik,项目名称:orocos-bfl-berdy,代码行数:58,代码来源:SampleComposition.hpp

示例10: in

    bool ImageDisplayComponent::configureHook(){
        Logger::In in("ImageDisplayComponent");

        // Load config file
        if ( this->marshalling()->readProperties( this->getName() + ".cpf" ) == false)
            return false;

        log(Info) << "Loading Ports to display from file." <<endlog();
        PropertyDemarshaller dem( config.get() );
        PropertyBag bag;
        if (dem.deserialize( bag ) == false ) {
            log(Error) << "Reading file "<< config.get() << " failed."<<endlog();
            return false;
        }

        bool ok = true;
        PropertyBag::const_iterator it = bag.getProperties().begin();
        while ( it != bag.getProperties().end() ){
            Property<std::string>* compName = dynamic_cast<Property<std::string>* >( *it );
            if ( !compName )
                log(Error) << "Expected Property \""
                           << (*it)->getName() <<"\" to be of type string."<< endlog();
            else if ( compName->getName() == "ImagePort" ) {
                string cname = compName->value().substr(0, compName->value().find("."));
                string pname = compName->value().substr( compName->value().find(".")+1, string::npos);
                ok &= this->addDisplayPort(cname, pname);
            }
            else {
                log(Error) << "Expected \"Component\", \"Port\" or \"Data\", got "
                           << compName->getName() << endlog();
                ok = false;
            }
            ++it;
        }
        deleteProperties( bag );

        // Create window for every dataport
        for(Reports::iterator it = root.begin(); it != root.end(); ++it ) {
            // Update the dataport
            (it->get<2>())->execute();
            // Get the base dataport
            DataSourceBase::shared_ptr source = it->get<3>();
            // Convert to Dataport<IplImage>
            DataSource<IplImage>::shared_ptr clone = AdaptDataSource<IplImage>()( source.get() );
            IplImage localImage = clone->get();
            string dataportName = it->get<0>();
            cvNamedWindow(dataportName.data(),CV_WINDOW_AUTOSIZE);
            cvShowImage(dataportName.data(),&localImage);
        }

        // Enter main loop of the window, and update the window if needed
        int key;
        key = cvWaitKey(3);
        // Magic number 3


        return ok;
    }
开发者ID:ptroja,项目名称:orocos-ocl,代码行数:58,代码来源:DisplayImageComponent.cpp

示例11: load

void Spawn::load(const PropertyBag &xml)
{
	Listener::load(xml);

	xml.get("monsterDataFile", monsterDataFile);
	xml.get("minMonsters", minMonsters);
	xml.get("maxMonsters", maxMonsters);
	xml.get("separationDistance", separationDistance);
}
开发者ID:foxostro,项目名称:arbarlith2,代码行数:9,代码来源:Spawn.cpp

示例12: serialize

            virtual void serialize(const PropertyBag &v)
			{
                for (
                    PropertyBag::const_iterator i = v.getProperties().begin();
                    i != v.getProperties().end();
                    i++ )
                {
                    this->serialize( *i );
                }
			}
开发者ID:phamelin,项目名称:orocos-ocl,代码行数:10,代码来源:TableMarshaller.hpp

示例13: load

void ComponentBrainShooter::load(const PropertyBag &data)
{
	resetMembers();

	data.get("fov", fov); // optional tag
	data.get("maxSightDistance", maxSightDistance); // optional tag
	data.get("shootDistance", shootDistance); // optional tag

	wanderAngle = FRAND_RANGE(0.0f, 2.0f * (float)M_PI);
}
开发者ID:foxostro,项目名称:heroman,代码行数:10,代码来源:ComponentBrainShooter.cpp

示例14: while

    // todo
bool operator==(const PropertyBag& a, const PropertyBag& b) {
    if( a.size() == b.size() ) {
        PropertyBag::const_iterator ita = a.begin();
        PropertyBag::const_iterator itb = b.begin();
        while ( ita != a.end() ) {
            //if ( (*ita)->equals(*itb) )
                return false;
        }
    }
    return false;
}
开发者ID:cottsay,项目名称:rtt,代码行数:12,代码来源:property_composition_test.cpp

示例15: ASSERT

void ParticleSystem::loadParticleEmitters(const PropertyBag &data)
{
	const size_t nEmitters = data.getNumInstances("emitter");
	ASSERT(nEmitters>0, "particle system does not specify any emitters");
	for(size_t i=0; i<nEmitters; ++i)
	{
		const PropertyBag emitterData = data.getBag("emitter", i);
		ParticleEmitter *emitter = new ParticleEmitter(emitterData, this);
		emitters.push_back(emitter);
	}
}
开发者ID:foxostro,项目名称:heroman,代码行数:11,代码来源:ParticleSystem.cpp


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