| 109 | |
| 110 | |
| 111 | TaggedObject * |
| 112 | MapOfTaggedObjects::removeComponent(int tag) |
| 113 | { |
| 114 | TaggedObject *removed =0; |
| 115 | MAP_TAGGED_ITERATOR theEle; |
| 116 | |
| 117 | // return 0 if component does not exist, otherwise remove it |
| 118 | theEle = theMap.find(tag); |
| 119 | if (theEle == theMap.end()) // the object has not been added |
| 120 | return 0; |
| 121 | else { // the object exists so we remove it |
| 122 | removed = (*theEle).second; |
| 123 | int ok = int(theMap.erase(tag)); |
| 124 | if (ok != 1) { // ensure the map did remove the object |
| 125 | opserr << "MapOfTaggedObjects::removeComponent - map STL failed to remove object with tag " << |
| 126 | tag << "\n"; |
| 127 | return 0; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | return removed; |
| 132 | } |
| 133 | |
| 134 | |
| 135 | int |
no test coverage detected