PropertyTest() : pf("pf","pfd", -1.0),pd("pd","pdd", +1.0), ps("ps","psd", "std::string"), pc("pc","pcd", 'c'), pc1("pc1","pcd1", 'a'), pc2("pc2","pcd1", 'b'), subbag1("s1", "s1d"),subbag2("s2", "s2d") { intref = 99; pi1 = new Property<int>("pi1","pi1d", 0 ); pi2 = new Property<int>("pi2","pi2d", 0 ); pi1ref = dynamic_cast< Property<int>* >( pi1->clone() ); pi2ref = dynamic_cast< Property<int>* >( pi2->clone() ); pc1ref = pc1; pc2ref = pc2; bag.add( pi1 ); bag.add( pi2 ); bag.add( &subbag1 ); subbag1.set().add( &subbag2 ); subbag1.set().add( &pf ); subbag1.set().add( &pd ); subbag2.set().add( &ps ); subbag2.set().add( &pc ); }
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 } };
PropertyBag Light::toXml(void) { PropertyBag xml; xml.add("constantAttenuation", constantAttenuation); xml.add("linearAttenuation", linearAttenuation); xml.add("quadraticAttenuation", quadraticAttenuation); xml.add("lightPosition", lightPosition);; xml.add("pointLight", pointLight); xml.add("lightDirection", lightDirection); xml.add("spotAngle", spotAngle); xml.add("spotExponent", spotExponent); xml.add("enable", enable); return xml; }
PropertyBag ActorSet::save(void) const { PropertyBag xml; for(const_iterator i = begin(); i != end(); ++i) { Actor &a = *(i->second); // Do not save Creatures. We are saving spawns instead and the player data is separate if(!instanceof(a, Creature)) { xml.add("object", a.save()); } } return xml; }