mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +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:
@@ -12,7 +12,6 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfInteger.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_Described.hxx>
|
||||
@@ -24,19 +23,19 @@
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_ESDescr,StepData_EDescr)
|
||||
|
||||
StepData_ESDescr::StepData_ESDescr (const Standard_CString name)
|
||||
: thenom (name) { thenames = new Dico_DictionaryOfInteger; }
|
||||
: thenom (name) { }
|
||||
|
||||
void StepData_ESDescr::SetNbFields (const Standard_Integer nb)
|
||||
{
|
||||
Standard_Integer minb,i, oldnb = NbFields();
|
||||
thenames->Clear();
|
||||
thenames.Clear();
|
||||
if (nb == 0) { thedescr.Nullify(); return; }
|
||||
Handle(TColStd_HArray1OfTransient) li = new TColStd_HArray1OfTransient(1,nb);
|
||||
if (oldnb == 0) { thedescr = li; return; }
|
||||
minb = (oldnb > nb ? nb : oldnb);
|
||||
for (i = 1; i <= minb; i ++) {
|
||||
DeclareAndCast(StepData_PDescr,pde,thedescr->Value(i));
|
||||
if (!pde.IsNull()) thenames->SetItem (pde->Name(),i);
|
||||
if (!pde.IsNull()) thenames.Bind(pde->Name(),i);
|
||||
li->SetValue (i, pde);
|
||||
}
|
||||
thedescr = li;
|
||||
@@ -52,7 +51,7 @@ void StepData_ESDescr::SetNbFields (const Standard_Integer nb)
|
||||
pde->SetFrom (descr);
|
||||
pde->SetName (name);
|
||||
thedescr->SetValue (num,pde);
|
||||
thenames->SetItem (name,num);
|
||||
thenames.Bind(name,num);
|
||||
}
|
||||
|
||||
void StepData_ESDescr::SetBase (const Handle(StepData_ESDescr)& base)
|
||||
@@ -100,7 +99,8 @@ void StepData_ESDescr::SetNbFields (const Standard_Integer nb)
|
||||
Standard_Integer StepData_ESDescr::Rank (const Standard_CString name) const
|
||||
{
|
||||
Standard_Integer rank;
|
||||
if (!thenames->GetItem (name,rank)) return 0;
|
||||
if (!thenames.Find(name, rank))
|
||||
return 0;
|
||||
return rank;
|
||||
}
|
||||
|
||||
|
@@ -26,9 +26,10 @@
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Dico_DictionaryOfInteger;
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
class StepData_PDescr;
|
||||
class TCollection_AsciiString;
|
||||
class StepData_Described;
|
||||
|
||||
|
||||
@@ -117,7 +118,7 @@ private:
|
||||
|
||||
TCollection_AsciiString thenom;
|
||||
Handle(TColStd_HArray1OfTransient) thedescr;
|
||||
Handle(Dico_DictionaryOfInteger) thenames;
|
||||
NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thenames;
|
||||
Handle(StepData_ESDescr) thebase;
|
||||
Handle(StepData_ESDescr) thesuper;
|
||||
|
||||
|
@@ -12,12 +12,12 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_Field.hxx>
|
||||
#include <StepData_FreeFormEntity.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_FreeFormEntity,MMgt_TShared)
|
||||
|
||||
@@ -81,20 +81,20 @@ void StepData_FreeFormEntity::SetStepType (const Standard_CString typenam)
|
||||
if (!afr) return afr;
|
||||
// remise en ordre avec un dictionnaire
|
||||
e1 = ent; e2.Nullify();
|
||||
Handle(Dico_DictionaryOfTransient) dic = new Dico_DictionaryOfTransient;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> dic;
|
||||
while (!e1.IsNull()) {
|
||||
dic->SetItem (e1->StepType(), e1);
|
||||
dic.Bind(e1->StepType(), e1);
|
||||
e1 = e1->Next();
|
||||
}
|
||||
// d abord effacer les next en cours ...
|
||||
Dico_IteratorOfDictionaryOfTransient iter(dic);
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(dic);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
e1 = GetCasted(StepData_FreeFormEntity,iter.Value());
|
||||
if (!e1.IsNull()) e1->SetNext(e2);
|
||||
}
|
||||
// ... puis les remettre dans l ordre
|
||||
e1.Nullify();
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
for (iter.Reset(); iter.More(); iter.Next()) {
|
||||
e2 = GetCasted(StepData_FreeFormEntity,iter.Value());
|
||||
if (!e1.IsNull()) e1->SetNext(e2);
|
||||
e1 = e2;
|
||||
|
@@ -11,13 +11,11 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Interface_DataMapIteratorOfDataMapOfTransientInteger.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_Protocol.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_Described.hxx>
|
||||
#include <StepData_ECDescr.hxx>
|
||||
#include <StepData_EDescr.hxx>
|
||||
@@ -125,17 +123,16 @@ void StepData_Protocol::AddDescr
|
||||
// Simple : memorisee selon son nom
|
||||
// sinon que faire ? on memorise selon le numero passe en alpha-num ...
|
||||
// (temporaire)
|
||||
if (thedscnam.IsNull()) thedscnam = new Dico_DictionaryOfTransient;
|
||||
if (!sd.IsNull()) thedscnam->SetItem (sd->TypeName(),sd);
|
||||
if (!sd.IsNull()) thedscnam.Bind(sd->TypeName(),sd);
|
||||
char fonom[10];
|
||||
sprintf(fonom,"%d",CN);
|
||||
thedscnam->SetItem (fonom,adescr);
|
||||
thedscnam.Bind(fonom,adescr);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean StepData_Protocol::HasDescr () const
|
||||
{
|
||||
return !thedscnam.IsNull();
|
||||
return !thedscnam.IsEmpty();
|
||||
}
|
||||
|
||||
|
||||
@@ -143,10 +140,14 @@ Handle(StepData_EDescr) StepData_Protocol::Descr
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(StepData_EDescr) dsc;
|
||||
if (thedscnam.IsNull()) return dsc;
|
||||
if (thedscnam.IsEmpty()) return dsc;
|
||||
char fonom[10];
|
||||
sprintf(fonom,"%d",num);
|
||||
if (!thedscnam->GetItem (fonom,dsc)) dsc.Nullify();
|
||||
Handle(Standard_Transient) aTDsc;
|
||||
if (thedscnam.Find(fonom, aTDsc))
|
||||
dsc = Handle(StepData_EDescr)::DownCast(aTDsc);
|
||||
else
|
||||
dsc.Nullify();
|
||||
return dsc;
|
||||
}
|
||||
|
||||
@@ -155,8 +156,10 @@ Handle(StepData_EDescr) StepData_Protocol::Descr
|
||||
(const Standard_CString name, const Standard_Boolean anylevel) const
|
||||
{
|
||||
Handle(StepData_EDescr) sd;
|
||||
if (!thedscnam.IsNull()) {
|
||||
if (thedscnam->GetItem (name,sd)) return sd;
|
||||
if (!thedscnam.IsEmpty()) {
|
||||
Handle(Standard_Transient) aTSd;
|
||||
if (thedscnam.Find(name, aTSd))
|
||||
return Handle(StepData_EDescr)::DownCast(aTSd);
|
||||
}
|
||||
if (!anylevel) return sd;
|
||||
|
||||
@@ -211,8 +214,7 @@ Handle(StepData_ECDescr) StepData_Protocol::ECDescr
|
||||
void StepData_Protocol::AddPDescr
|
||||
(const Handle(StepData_PDescr)& pdescr)
|
||||
{
|
||||
if (thepdescr.IsNull()) thepdescr = new Dico_DictionaryOfTransient;
|
||||
thepdescr->SetItem (pdescr->Name(),pdescr);
|
||||
thepdescr.Bind(pdescr->Name(),pdescr);
|
||||
}
|
||||
|
||||
|
||||
@@ -220,8 +222,10 @@ Handle(StepData_PDescr) StepData_Protocol::PDescr
|
||||
(const Standard_CString name, const Standard_Boolean anylevel) const
|
||||
{
|
||||
Handle(StepData_PDescr) sd;
|
||||
if (!thepdescr.IsNull()) {
|
||||
if (thepdescr->GetItem (name,sd)) return sd;
|
||||
if (!thepdescr.IsEmpty()) {
|
||||
Handle(Standard_Transient) aTSd;
|
||||
if (thepdescr.Find(name, aTSd))
|
||||
return Handle(StepData_PDescr)::DownCast(aTSd);
|
||||
}
|
||||
if (!anylevel) return sd;
|
||||
|
||||
@@ -239,8 +243,7 @@ Handle(StepData_PDescr) StepData_Protocol::PDescr
|
||||
void StepData_Protocol::AddBasicDescr
|
||||
(const Handle(StepData_ESDescr)& esdescr)
|
||||
{
|
||||
if (thedscbas.IsNull()) thedscbas = new Dico_DictionaryOfTransient;
|
||||
thedscbas->SetItem (esdescr->TypeName(),esdescr);
|
||||
thedscbas.Bind(esdescr->TypeName(),esdescr);
|
||||
}
|
||||
|
||||
|
||||
@@ -248,8 +251,10 @@ Handle(StepData_EDescr) StepData_Protocol::BasicDescr
|
||||
(const Standard_CString name, const Standard_Boolean anylevel) const
|
||||
{
|
||||
Handle(StepData_EDescr) sd;
|
||||
if (!thedscbas.IsNull()) {
|
||||
if (thedscbas->GetItem (name,sd)) return sd;
|
||||
if (!thedscbas.IsEmpty()) {
|
||||
Handle(Standard_Transient) aTSd;
|
||||
if (thedscbas.Find(name, aTSd))
|
||||
return Handle(StepData_EDescr)::DownCast(aTSd);
|
||||
}
|
||||
if (!anylevel) return sd;
|
||||
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
class Dico_DictionaryOfTransient;
|
||||
class Interface_Protocol;
|
||||
class Standard_Transient;
|
||||
class Interface_InterfaceModel;
|
||||
@@ -149,9 +148,9 @@ private:
|
||||
|
||||
|
||||
Interface_DataMapOfTransientInteger thedscnum;
|
||||
Handle(Dico_DictionaryOfTransient) thedscnam;
|
||||
Handle(Dico_DictionaryOfTransient) thepdescr;
|
||||
Handle(Dico_DictionaryOfTransient) thedscbas;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscnam;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thepdescr;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscbas;
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user