Salome HOME
BUG 0020024: a --gdb-session option to runSalome ...
[modules/kernel.git] / src / DF / DF_Attribute.cxx
1 #include "DF_definitions.hxx"
2 #include "DF_Label.hxx"
3 #include "DF_Attribute.hxx"
4
5 using namespace std;
6
7 //Class DF_Attribute is used to store some data defined by the DF_Attribute type
8
9 //Constructor
10 DF_Attribute::DF_Attribute()
11 {
12   _node = NULL;
13 }
14
15 DF_Attribute::~DF_Attribute()
16 {
17   //Remove an attribute from a map of the node's attributes to 
18   //avoid double deletion on the node destruction
19   if(_node) {
20     map<string, DF_Attribute*>::iterator mi;
21     for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) {
22        if(mi->second == this) {
23          _node->_attributes.erase(mi);
24        }         
25     }
26   }
27 }
28
29  //Returns a Label on which this Attribute is located.
30 DF_Label DF_Attribute::Label() const
31 {
32    return DF_Label(_node);
33 }
34
35  //Searches an Attribute with given ID located on the same Label as this Attribute.
36 DF_Attribute* DF_Attribute::FindAttribute(const string& theID) const
37 {
38   if(!_node) return NULL;
39   return Label().FindAttribute(theID);
40 }
41
42