+ //=============================================================
+ bool Node::Matches( const AttributeMapType& m ) const
+ {
+ GimmickDebugMessage(2,"'"<<GetLabel()<<"' matching..."<<std::endl);
+ const std::vector<std::string>& id
+ = GetLevelDescriptor().GetIdentifierList();
+ std::vector<std::string>::const_iterator i;
+ for (i = id.begin(); i != id.end(); ++i)
+ {
+ if (mAttributeMap.find(*i)->second != m.find(*i)->second )
+ {
+ GimmickDebugMessage(2,"IDENTIFIER '"<<*i<<"' values do not match"<<std::endl);
+ return false;
+ }
+ GimmickDebugMessage(2,"IDENTIFIER '"<<*i<<"' values match"<<std::endl);
+ }
+ return true;
+ }
+ //=============================================================
+
+ //=============================================================
+ void Node::Print() const
+ {
+ std::string mess;
+ for (int i = 0; i<GetLevel(); ++i) mess += " ";
+ mess += "|_ " + GetLabel();
+ GimmickMessage(1,mess<<std::endl);
+ ChildrenListType::const_iterator j;
+ for (j=GetChildrenList().begin(); j!=GetChildrenList().end(); j++)
+ {
+ (*j)->Print();
+ }
+ }
+ //=============================================================
+
+ //=============================================================
+ std::string Node::GetLabel() const
+ {
+ std::string l;
+ const std::vector<std::string>& label
+ = GetLevelDescriptor().GetLabelList();
+
+ std::vector<std::string>::const_iterator i;
+ for (i = label.begin(); i != label.end(); )
+ {
+ GimmickDebugMessage(9,"LABEL '"<<*i<<"'"<<std::endl);
+ AttributeMapType::const_iterator j = mAttributeMap.find(*i);
+ if (j != mAttributeMap.end())
+ {
+ l += j->second;
+ ++i;
+ if (i != label.end()) l += "|";
+ }
+ else
+ {
+ GimmickError("Node::GetLabel() : LABEL attribute '"
+ <<*i
+ <<"' is not in node attribute map (should be!)" );
+ }
+ }
+ if (l.size()==0) l="?";
+ return l;
+ }
+ //=============================================================