1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0024788: Foundation Classes - remove Dico_Dictionary

Class Dico_Dictionary was replaced by NCollection_DataMap/NCollection_IndexedDataMap classes.
Changed argument name in template class NCollection_Datamap to eliminate redefinitions of static members in dependent code.
This commit is contained in:
ski
2016-10-12 18:02:55 +03:00
committed by apn
parent be70005cb5
commit 997e128f88
85 changed files with 1674 additions and 4530 deletions

View File

@@ -12,8 +12,6 @@
// commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Geom2d_CartesianPoint.hxx>
#include <Interface_IntVal.hxx>
#include <Standard_Transient.hxx>
@@ -44,23 +42,22 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
void Transfer_Finder::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 Transfer_Finder::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 Transfer_Finder::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;
}
@@ -69,8 +66,8 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
(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;
}
@@ -166,8 +163,8 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
return hval->ToCString();
}
Handle(Dico_DictionaryOfTransient) Transfer_Finder::AttrList () const
{ return theattrib; }
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Transfer_Finder::AttrList ()
{ return theattrib; }
void Transfer_Finder::SameAttributes (const Handle(Transfer_Finder)& other)
{ if (!other.IsNull()) theattrib = other->AttrList(); }
@@ -176,14 +173,14 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
(const Handle(Transfer_Finder)& other,
const Standard_CString fromname, const Standard_Boolean copied)
{
if (other.IsNull()) return;
Handle(Dico_DictionaryOfTransient) list = other->AttrList();
if (list.IsNull()) return;
if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient;
if (other.IsNull()) return;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list = other->AttrList();
if (list.IsEmpty()) return;
for (Dico_IteratorOfDictionaryOfTransient iter (list,fromname);
iter.More(); iter.Next()) {
TCollection_AsciiString name = iter.Name();
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;
@@ -211,7 +208,7 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
}
theattrib->SetItem (name.ToCString(),newatr);
theattrib.Bind(name,newatr);
}
}

View File

@@ -19,7 +19,9 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
@@ -27,8 +29,8 @@
#include <Standard_CString.hxx>
#include <Interface_ParamType.hxx>
#include <Standard_Real.hxx>
class Dico_DictionaryOfTransient;
class Standard_Transient;
#include <TCollection_AsciiString.hxx>
class Transfer_Finder;
@@ -123,7 +125,7 @@ public:
Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const;
//! Returns the exhaustive list of attributes
Standard_EXPORT Handle(Dico_DictionaryOfTransient) AttrList() const;
Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& AttrList();
//! Gets the list of attributes from <other>, as such, i.e.
//! not copied : attributes are shared, any attribute edited,
@@ -162,7 +164,7 @@ private:
Standard_Integer thecode;
Handle(Dico_DictionaryOfTransient) theattrib;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> theattrib;
};

View File

@@ -35,8 +35,6 @@
#include <Transfer_TransferDeadLoop.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_HArray1OfInteger.hxx>

View File

@@ -12,7 +12,6 @@
// commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_Graph.hxx>
@@ -113,8 +112,7 @@ const Interface_Graph& Transfer_TransientProcess::Graph () const
void Transfer_TransientProcess::SetContext(const Standard_CString name,
const Handle(Standard_Transient)& ctx)
{
if (thectx.IsNull()) thectx = new Dico_DictionaryOfTransient;
thectx->SetItem (name,ctx);
thectx.Bind(name,ctx);
}
@@ -127,8 +125,10 @@ Standard_Boolean Transfer_TransientProcess::GetContext
(const Standard_CString name, const Handle(Standard_Type)& type,
Handle(Standard_Transient)& ctx) const
{
if (thectx.IsNull()) return Standard_False;
if (!thectx->GetItem (name,ctx)) ctx.Nullify();
if (thectx.IsEmpty()) return Standard_False;
if (!thectx.Find(name, ctx))
ctx.Nullify();
if (ctx.IsNull()) return Standard_False;
if (type.IsNull()) return Standard_True;
if (!ctx->IsKind(type)) ctx.Nullify();
@@ -141,7 +141,7 @@ Standard_Boolean Transfer_TransientProcess::GetContext
//purpose :
//=======================================================================
Handle(Dico_DictionaryOfTransient)& Transfer_TransientProcess::Context ()
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Transfer_TransientProcess::Context ()
{
return thectx;
}

View File

@@ -26,11 +26,12 @@
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_DataMap.hxx>
class Interface_InterfaceModel;
class Interface_HGraph;
class Dico_DictionaryOfTransient;
class Interface_Graph;
class Standard_Transient;
class Message_Messenger;
class Interface_EntityIterator;
@@ -80,7 +81,7 @@ public:
//! Returns (modifiable) the whole definition of Context
//! Rather for internal use (ex.: preparing and setting in once)
Standard_EXPORT Handle(Dico_DictionaryOfTransient)& Context();
Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Context();
//! Specific printing to trace an entity : prints label and type
//! (if model is set)
@@ -128,7 +129,7 @@ private:
Handle(Interface_InterfaceModel) themodel;
Handle(Interface_HGraph) thegraph;
Handle(Dico_DictionaryOfTransient) thectx;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thectx;
Handle(TColStd_HSequenceOfTransient) thetrroots;