# | Line 55 | Line 55 | SimInfo::SimInfo(){ | |
---|---|---|
55 | useEAM = 0; | |
56 | ||
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]) { | |
# | Line 529 | Line 539 | void SimInfo::checkCutOffs( void ){ | |
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 | + |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |