1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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,9 +12,6 @@
// commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <IFSelect_DispPerCount.hxx>
#include <IFSelect_DispPerFiles.hxx>
#include <IFSelect_DispPerOne.hxx>
@@ -69,12 +66,8 @@ IMPLEMENT_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared)
// ParamEditor
// Transferts
static const Handle(Dico_DictionaryOfTransient)& listadapt()
{
static Handle(Dico_DictionaryOfTransient) listad;
if (listad.IsNull()) listad = new Dico_DictionaryOfTransient;
return listad;
}
static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> listad;
//=======================================================================
//function : XSControl_Controller
@@ -127,16 +120,15 @@ void XSControl_Controller::SetNames (const Standard_CString theLongName, const S
void XSControl_Controller::Record (const Standard_CString theName) const
{
Standard_Boolean isAlreadyRegistered = Standard_False;
Handle(Standard_Transient)& newadapt = listadapt()->NewItem(theName,isAlreadyRegistered);
if (isAlreadyRegistered) {
Handle(Standard_Transient) thisadapt (this);
if (listad.IsBound(theName)) {
Handle(Standard_Transient) thisadapt(this);
Handle(Standard_Transient) newadapt = listad.ChangeFind(theName);
if (newadapt->IsKind(thisadapt->DynamicType()))
return;
if (!(thisadapt->IsKind(newadapt->DynamicType())) && thisadapt != newadapt)
Standard_DomainError::Raise("XSControl_Controller : Record");
}
newadapt = this;
listad.Bind(theName, this);
}
//=======================================================================
@@ -144,10 +136,10 @@ void XSControl_Controller::Record (const Standard_CString theName) const
//purpose :
//=======================================================================
Handle(XSControl_Controller) XSControl_Controller::Recorded (const Standard_CString theName)
Handle(XSControl_Controller) XSControl_Controller::Recorded(const Standard_CString theName)
{
Handle(Standard_Transient) recorded;
return (listadapt()->GetItem(theName,recorded)?
return (listad.Find(theName, recorded)?
Handle(XSControl_Controller)::DownCast(recorded) :
Handle(XSControl_Controller)());
}
@@ -366,9 +358,7 @@ void XSControl_Controller::AddSessionItem
(const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply)
{
if (theItem.IsNull() || theName[0] == '\0') return;
if (myAdaptorSession.IsNull())
myAdaptorSession = new Dico_DictionaryOfTransient;
myAdaptorSession->SetItem (theName,theItem);
myAdaptorSession.Bind(theName,theItem);
if (toApply && theItem->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier)))
myAdaptorApplied.Append(theItem);
}
@@ -381,8 +371,8 @@ void XSControl_Controller::AddSessionItem
Handle(Standard_Transient) XSControl_Controller::SessionItem (const Standard_CString theName) const
{
Handle(Standard_Transient) item;
if (!myAdaptorSession.IsNull())
myAdaptorSession->GetItem (theName,item);
if (!myAdaptorSession.IsEmpty())
item = myAdaptorSession.Find(theName);
return item;
}
@@ -396,10 +386,10 @@ void XSControl_Controller::Customise (Handle(XSControl_WorkSession)& WS)
WS->SetParams (myParams,myParamUses);
// General
if (!myAdaptorSession.IsNull()) {
Dico_IteratorOfDictionaryOfTransient iter(myAdaptorSession);
for (iter.Start(); iter.More(); iter.Next())
WS->AddNamedItem (iter.Name().ToCString(), iter.Value());
if (!myAdaptorSession.IsEmpty()) {
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(myAdaptorSession);
for (; iter.More(); iter.Next())
WS->AddNamedItem (iter.Key().ToCString(), iter.ChangeValue());
}
if (WS->NamedItem("xst-model-all").IsNull()) {

View File

@@ -28,16 +28,17 @@
#include <MMgt_TShared.hxx>
#include <NCollection_Vector.hxx>
#include <IFSelect_ReturnStatus.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
class IFSelect_WorkLibrary;
class Interface_Protocol;
class IFSelect_Signature;
class Transfer_ActorOfTransientProcess;
class Transfer_ActorOfFinderProcess;
class Dico_DictionaryOfTransient;
class Standard_DomainError;
class XSControl_WorkSession;
class Interface_InterfaceModel;
class Standard_Transient;
class Transfer_FinderProcess;
class TopoDS_Shape;
class Interface_CheckIterator;
@@ -187,7 +188,7 @@ class XSControl_Controller : public MMgt_TShared
//! Customises a WorkSession, by adding to it the recorded items (by AddSessionItem)
Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS);
const Handle(Dico_DictionaryOfTransient) & AdaptorSession() const
const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> & AdaptorSession() const
{ return myAdaptorSession; }
DEFINE_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared)
@@ -209,7 +210,7 @@ class XSControl_Controller : public MMgt_TShared
//szv:Handle(IFSelect_Signature) mySignType;
Handle(Transfer_ActorOfTransientProcess) myAdaptorRead;
Handle(Transfer_ActorOfFinderProcess) myAdaptorWrite;
Handle(Dico_DictionaryOfTransient) myAdaptorSession;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myAdaptorSession;
private:

View File

@@ -12,7 +12,6 @@
// commercial license or contractual agreement.
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <IFSelect_Act.hxx>
#include <IFSelect_CheckCounter.hxx>
#include <IFSelect_Functions.hxx>

View File

@@ -16,7 +16,6 @@
#include <BRepBuilderAPI.hxx>
#include <BRepLib.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <IFSelect_CheckCounter.hxx>
#include <IFSelect_SignatureList.hxx>
#include <Interface_Check.hxx>
@@ -123,8 +122,7 @@ void XSControl_TransferReader::SetGraph(const Handle(Interface_HGraph)& graph)
void XSControl_TransferReader::SetContext(const Standard_CString name,
const Handle(Standard_Transient)& ctx)
{
if (myContext.IsNull()) myContext = new Dico_DictionaryOfTransient;
myContext->SetItem (name,ctx);
myContext.Bind(name,ctx);
}
@@ -137,8 +135,9 @@ Standard_Boolean XSControl_TransferReader::GetContext
(const Standard_CString name, const Handle(Standard_Type)& type,
Handle(Standard_Transient)& ctx) const
{
if (myContext.IsNull()) return Standard_False;
if (!myContext->GetItem (name,ctx)) ctx.Nullify();
if (myContext.IsEmpty()) return Standard_False;
if (!myContext.Find(name, ctx))
ctx.Nullify();
if (ctx.IsNull()) return Standard_False;
if (type.IsNull()) return Standard_True;
if (!ctx->IsKind(type)) ctx.Nullify();
@@ -755,7 +754,8 @@ Standard_Boolean XSControl_TransferReader::BeginTransfer ()
actor = Actor();
myTP->SetActor (actor); // Set proprement dit
myTP->SetErrorHandle (Standard_True);
myTP->Context() = myContext;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& aTPContext = myTP->Context();
aTPContext = myContext;
return Standard_True;
}

View File

@@ -29,7 +29,6 @@
class XSControl_Controller;
class Interface_InterfaceModel;
class Interface_HGraph;
class Dico_DictionaryOfTransient;
class Transfer_ActorOfTransientProcess;
class Transfer_TransientProcess;
class Standard_Transient;
@@ -104,7 +103,7 @@ class XSControl_TransferReader : public MMgt_TShared
//! Returns (modifiable) the whole definition of Context
//! Rather for internal use (ex.: preparing and setting in once)
Handle(Dico_DictionaryOfTransient)& Context()
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Context()
{ return myContext; }
//! Sets a new value for (loaded) file name
@@ -350,7 +349,7 @@ class XSControl_TransferReader : public MMgt_TShared
TCollection_AsciiString myFileName;
Handle(Interface_InterfaceModel) myModel;
Handle(Interface_HGraph) myGraph;
Handle(Dico_DictionaryOfTransient) myContext;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myContext;
Handle(Transfer_ActorOfTransientProcess) myActor;
Handle(Transfer_TransientProcess) myTP;
TColStd_DataMapOfIntegerTransient myResults;

View File

@@ -12,7 +12,6 @@
// commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Geom2d_CartesianPoint.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_CartesianPoint.hxx>
@@ -30,20 +29,20 @@
IMPLEMENT_STANDARD_RTTIEXT(XSControl_Vars,MMgt_TShared)
XSControl_Vars::XSControl_Vars ()
{ thevars = new Dico_DictionaryOfTransient; }
XSControl_Vars::XSControl_Vars() { }
void XSControl_Vars::Set
(const Standard_CString name,
const Handle(Standard_Transient)& val)
{
thevars->SetItem (name,val);
thevars.Bind(name,val);
}
Handle(Standard_Transient) XSControl_Vars::Get ( Standard_CString& name) const
{
Handle(Standard_Transient) val;
if (!thevars->GetItem (name,val)) val.Nullify();
if (!thevars.Find(name, val))
val.Nullify();
return val;
}

View File

@@ -23,8 +23,9 @@
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
class Dico_DictionaryOfTransient;
class Standard_Transient;
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
class Geom_Geometry;
class Geom2d_Curve;
class Geom_Curve;
@@ -92,7 +93,7 @@ protected:
private:
Handle(Dico_DictionaryOfTransient) thevars;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thevars;
};

View File

@@ -13,8 +13,6 @@
//:i1 pdn 03.04.99 BUC60301
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Geom2d_Point.hxx>
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
@@ -148,7 +146,7 @@ Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc)
//purpose :
//=======================================================================
void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransient)& context)
void XSControl_WorkSession::SetAllContext(const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& context)
{
myContext = context;
myTransferReader->Context() = context;
@@ -162,8 +160,8 @@ void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransien
void XSControl_WorkSession::ClearContext ()
{
myContext.Nullify();
myTransferReader->Context().Nullify();
myContext.Clear();
myTransferReader->Context().Clear();
}

View File

@@ -25,7 +25,6 @@
#include <XSControl_TransferWriter.hxx>
class XSControl_Controller;
class XSControl_TransferReader;
class Dico_DictionaryOfTransient;
class XSControl_Vars;
class Message_Messenger;
class Transfer_TransientProcess;
@@ -85,12 +84,12 @@ class XSControl_WorkSession : public IFSelect_WorkSession
//! Returns the current Context List, Null if not defined
//! The Context is given to the TransientProcess for TransferRead
const Handle(Dico_DictionaryOfTransient) & Context() const
const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> & Context() const
{ return myContext; }
//! Sets the current Context List, as a whole
//! Sets it to the TransferReader
Standard_EXPORT void SetAllContext (const Handle(Dico_DictionaryOfTransient)& theContext);
Standard_EXPORT void SetAllContext (const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& theContext);
//! Clears the whole current Context (nullifies it)
Standard_EXPORT void ClearContext();
@@ -198,7 +197,7 @@ class XSControl_WorkSession : public IFSelect_WorkSession
Handle(XSControl_Controller) myController;
Handle(XSControl_TransferReader) myTransferReader;
Handle(XSControl_TransferWriter) myTransferWriter;
Handle(Dico_DictionaryOfTransient) myContext;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myContext;
Handle(XSControl_Vars) myVars;
};