]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOTreeNode.cpp
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOTreeNode.cpp
index 8f03924236e30d7e0dd2b824d9d17e4a288028d2..6bb7d3a7d8bc42ce3d0eda23e3ef8332691f2171 100644 (file)
@@ -25,12 +25,35 @@ namespace creaImageIO
               a!= GetTree()->GetAttributeDescriptorList(GetLevel()).end();
               ++a)
            {
-             UnsafeSetAttribute( a->GetName(), "" );
+             UnsafeSetAttribute( a->GetKey(), "" );
            }
        }
     }
     //=============================================================
 
+    //=============================================================
+    /// Ctor with parent and attributes map 
+    Node::Node(Node* parent, const AttributeMapType& attr)
+     : mParent(parent),
+       mData(0),
+       mChildrenLoaded(false)
+    {
+      if (parent) 
+       {
+         // Insert into parent's children list
+         parent->GetChildrenList().push_back(this);
+         // Initialize attributes
+         LevelDescriptor::AttributeDescriptorListType::const_iterator a;
+         for (a = GetTree()->GetAttributeDescriptorList(GetLevel()).begin();
+              a!= GetTree()->GetAttributeDescriptorList(GetLevel()).end();
+              ++a)
+           {
+             UnsafeSetAttribute( a->GetKey(), attr[a->GetKey()] );
+           }
+       }
+      
+    }
+    //=============================================================
 
 
     //=============================================================
@@ -85,16 +108,22 @@ namespace creaImageIO
     AttributeMapType::iterator i = mAttributeMap.find(k);
     if (i==mAttributeMap.end())
       {
-       std::cout<<"[Gimmick!] Node::SetAttribute : no attribute with name '"
+       std::cout<<"[Gimmick!] Node::SetAttribute : no attribute with key '"
                 <<k<<"'"<<std::endl;
-       creaError( "[Gimmick!] Node::SetAttribute : no attribute with name '"
+       creaError( "[Gimmick!] Node::SetAttribute : no attribute with key '"
                   <<k<<"'");
       }
     i->second = v;
   }
-  //=============================================================
-
+    //=============================================================
 
+    //=============================================================
+    bool Node::Matches(  const AttributeMapType& ) const
+    {
+      // TO DO 
+      return false;
+    }
+    //=============================================================
   }
 
 }