ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimInfo.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimInfo.cpp (file contents):
Revision 642 by mmeineke, Mon Jul 21 16:23:57 2003 UTC vs.
Revision 658 by tim, Thu Jul 31 15:35:07 2003 UTC

# Line 528 | Line 528 | void SimInfo::checkCutOffs( void ){
528  
529    oldEcr = ecr;
530    oldRcut = rCut;
531 + }
532 +
533 + void SimInfo::addProperty(GenericData* prop){
534 +
535 +  map<string, GenericData*>::iterator result;
536 +  result = properties.find(prop->getID());
537 +  
538 +  //we can't simply use  properties[prop->getID()] = prop,
539 +  //it will cause memory leak if we already contain a propery which has the same name of prop
540 +  
541 +  if(result != properties.end()){
542 +    
543 +    delete (*result).second;
544 +    (*result).second = prop;
545 +      
546 +  }
547 +  else{
548 +
549 +    properties[prop->getID()] = prop;
550 +
551 +  }
552 +    
553   }
554 +
555 + GenericData* SimInfo::getProperty(const string& propName){
556 +
557 +  map<string, GenericData*>::iterator result;
558 +  
559 +  //string lowerCaseName = ();
560 +  
561 +  result = properties.find(propName);
562 +  
563 +  if(result != properties.end())
564 +    return (*result).second;  
565 +  else  
566 +    return NULL;  
567 + }
568 +
569 + vector<GenericData*> SimInfo::getProperties(){
570 +
571 +  vector<GenericData*> result;
572 +  map<string, GenericData*>::iterator i;
573 +  
574 +  for(i = properties.begin(); i != properties.end(); i++)
575 +    result.push_back((*i).second);
576 +    
577 +  return result;
578 + }
579 +
580 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines