--- trunk/OOPSE/libmdtools/SimInfo.cpp 2003/07/21 16:23:57 642 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2003/07/31 15:35:07 658 @@ -528,4 +528,53 @@ void SimInfo::checkCutOffs( void ){ oldEcr = ecr; oldRcut = rCut; +} + +void SimInfo::addProperty(GenericData* prop){ + + map::iterator result; + result = properties.find(prop->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 = prop; + + } + else{ + + properties[prop->getID()] = prop; + + } + } + +GenericData* SimInfo::getProperty(const string& propName){ + + map::iterator result; + + //string lowerCaseName = (); + + result = properties.find(propName); + + if(result != properties.end()) + return (*result).second; + else + return NULL; +} + +vector SimInfo::getProperties(){ + + vector result; + map::iterator i; + + for(i = properties.begin(); i != properties.end(); i++) + result.push_back((*i).second); + + return result; +} + +