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

Comparing trunk/OOPSE/libmdtools/StuntDouble.cpp (file contents):
Revision 1108 by tim, Wed Apr 14 15:37:41 2004 UTC vs.
Revision 1118 by tim, Mon Apr 19 03:52:27 2004 UTC

# Line 520 | Line 520 | void StuntDouble::getEulerAngles(double eulers[3]){
520                 objType );
521        painCave.isFatal = 1;
522        simError();    
523 +  }
524 + }
525 +
526 + void StuntDouble::addProperty(GenericData* data){
527 +  map<string, GenericData*>::iterator result;
528 +  result = properties.find(data->getID());
529 +  
530 +  //we can't simply use  properties[prop->getID()] = prop,
531 +  //it will cause memory leak if we already contain a propery which has the same name of prop
532 +  
533 +  if(result != properties.end()){
534 +    delete (*result).second;
535 +    (*result).second = data;      
536    }
537 +  else
538 +    properties[data->getID()] = data;
539 +
540 +  
541   }
542 + void StuntDouble::removeProperty(const string& propName){
543 +  map<string, GenericData*>::iterator result;
544 +    
545 +  result = properties.find(propName);
546 +  
547 +  if(result != properties.end())
548 +    properties.erase(result);
549 +  
550 + }
551 + GenericData* StuntDouble::getProperty(const string& propName){
552 +  map<string, GenericData*>::iterator result;
553 +  
554 +  
555 +  result = properties.find(propName);
556 +  
557 +  if(result != properties.end())
558 +    return (*result).second;  
559 +  else  
560 +    return NULL;    
561 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines