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 626 by mmeineke, Wed Jul 16 21:30:56 2003 UTC vs.
Revision 660 by tim, Thu Jul 31 19:59:34 2003 UTC

# Line 33 | Line 33 | SimInfo::SimInfo(){
33    the_integrator = NULL;
34    setTemp = 0;
35    thermalTime = 0.0;
36 +  currentTime = 0.0;
37    rCut = 0.0;
38    ecr = 0.0;
39    est = 0.0;
# Line 56 | Line 57 | void SimInfo::setBox(double newBox[3]) {
57    wrapMeSimInfo( this );
58   }
59  
60 + SimInfo::~SimInfo(){
61 +
62 +  map<string, GenericData*>::iterator i;
63 +  
64 +  for(i = properties.begin(); i != properties.end(); i++)
65 +    delete (*i).second;
66 +
67 +  
68 + }
69 +
70   void SimInfo::setBox(double newBox[3]) {
71    
72    int i, j;
# Line 527 | Line 538 | void SimInfo::checkCutOffs( void ){
538  
539    oldEcr = ecr;
540    oldRcut = rCut;
541 + }
542 +
543 + void SimInfo::addProperty(GenericData* prop){
544 +
545 +  map<string, GenericData*>::iterator result;
546 +  result = properties.find(prop->getID());
547 +  
548 +  //we can't simply use  properties[prop->getID()] = prop,
549 +  //it will cause memory leak if we already contain a propery which has the same name of prop
550 +  
551 +  if(result != properties.end()){
552 +    
553 +    delete (*result).second;
554 +    (*result).second = prop;
555 +      
556 +  }
557 +  else{
558 +
559 +    properties[prop->getID()] = prop;
560 +
561 +  }
562 +    
563   }
564 +
565 + GenericData* SimInfo::getProperty(const string& propName){
566 +
567 +  map<string, GenericData*>::iterator result;
568 +  
569 +  //string lowerCaseName = ();
570 +  
571 +  result = properties.find(propName);
572 +  
573 +  if(result != properties.end())
574 +    return (*result).second;  
575 +  else  
576 +    return NULL;  
577 + }
578 +
579 + vector<GenericData*> SimInfo::getProperties(){
580 +
581 +  vector<GenericData*> result;
582 +  map<string, GenericData*>::iterator i;
583 +  
584 +  for(i = properties.begin(); i != properties.end(); i++)
585 +    result.push_back((*i).second);
586 +    
587 +  return result;
588 + }
589 +
590 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines