// commercial license or contractual agreement.
-#include <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <MoniTool_AttrList.hxx>
#include <MoniTool_IntVal.hxx>
#include <MoniTool_RealVal.hxx>
void MoniTool_AttrList::SetAttribute
(const Standard_CString name, const Handle(Standard_Transient)& val)
{
- if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient;
- theattrib->SetItem (name,val);
+ theattrib.Bind(name,val);
}
Standard_Boolean MoniTool_AttrList::RemoveAttribute
(const Standard_CString name)
{
- if (theattrib.IsNull()) return Standard_False;
- return theattrib->RemoveItem (name);
+ if (theattrib.IsEmpty()) return Standard_False;
+ return theattrib.UnBind(name);
}
Standard_Boolean MoniTool_AttrList::GetAttribute
(const Standard_CString name, const Handle(Standard_Type)& type,
Handle(Standard_Transient)& val) const
{
- if (theattrib.IsNull()) { val.Nullify(); return Standard_False; }
- if (!theattrib->GetItem (name,val)) { val.Nullify(); return Standard_False; }
+ if (theattrib.IsEmpty()) { val.Nullify(); return Standard_False; }
+ if (!theattrib.Find(name, val)) { val.Nullify(); return Standard_False; }
if (!val->IsKind(type)) { val.Nullify(); return Standard_False; }
return Standard_True;
}
(const Standard_CString name) const
{
Handle(Standard_Transient) atr;
- if (theattrib.IsNull()) return atr;
- if (!theattrib->GetItem (name,atr)) atr.Nullify();
+ if (theattrib.IsEmpty()) return atr;
+ if (!theattrib.Find(name, atr))
+ atr.Nullify();
return atr;
}
return hval->ToCString();
}
- Handle(Dico_DictionaryOfTransient) MoniTool_AttrList::AttrList () const
+ const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& MoniTool_AttrList::AttrList () const
{ return theattrib; }
void MoniTool_AttrList::SameAttributes (const MoniTool_AttrList& other)
(const MoniTool_AttrList& other,
const Standard_CString fromname, const Standard_Boolean copied)
{
- Handle(Dico_DictionaryOfTransient) list = other.AttrList();
- if (list.IsNull()) return;
- if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient;
-
- for (Dico_IteratorOfDictionaryOfTransient iter (list,fromname);
- iter.More(); iter.Next()) {
- TCollection_AsciiString name = iter.Name();
+ const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list = other.AttrList();
+ if (list.IsEmpty()) return;
+
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(list);
+ for (; iter.More(); iter.Next()) {
+ TCollection_AsciiString name = iter.Key();
+ if (!name.StartsWith(fromname))
+ continue;
Handle(Standard_Transient) atr = iter.Value();
Handle(Standard_Transient) newatr = atr;
}
}
-
- theattrib->SetItem (name.ToCString(),newatr);
-
+ theattrib.Bind(name, newatr);
}
}