--- trunk/OOPSE/libmdtools/StuntDouble.cpp 2004/04/14 15:37:41 1108 +++ trunk/OOPSE/libmdtools/StuntDouble.cpp 2004/04/19 03:52:27 1118 @@ -520,5 +520,42 @@ void StuntDouble::getEulerAngles(double eulers[3]){ objType ); painCave.isFatal = 1; simError(); + } +} + +void StuntDouble::addProperty(GenericData* data){ + map::iterator result; + result = properties.find(data->getID()); + + //we can't simply use properties[prop->getID()] = prop, + //it will cause memory leak if we already contain a propery which has the same name of prop + + if(result != properties.end()){ + delete (*result).second; + (*result).second = data; } + else + properties[data->getID()] = data; + + } +void StuntDouble::removeProperty(const string& propName){ + map::iterator result; + + result = properties.find(propName); + + if(result != properties.end()) + properties.erase(result); + +} +GenericData* StuntDouble::getProperty(const string& propName){ + map::iterator result; + + + result = properties.find(propName); + + if(result != properties.end()) + return (*result).second; + else + return NULL; +} \ No newline at end of file