mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -16,8 +16,6 @@
|
||||
//svv#2 21.02.00 : porting on SIL
|
||||
//smh#14 17.03.2000 : FRA62479 Clearing of gtool.
|
||||
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
@@ -39,7 +37,7 @@
|
||||
#include <TColStd_Array1OfTransient.hxx>
|
||||
#include <TColStd_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel, MMgt_TShared)
|
||||
|
||||
// Un Modele d`Interface est un ensemble ferme d`Entites d`interface : chacune
|
||||
// est dans un seul modele a la fois; elle y a un numero (Number) qui permet de
|
||||
@@ -47,13 +45,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel,MMgt_TShared)
|
||||
// performantes, de fournir un identifieur numerique
|
||||
// Il est a meme d`etre utilise dans des traitements de Graphe
|
||||
// STATICS : les TEMPLATES
|
||||
static const Handle(Dico_DictionaryOfTransient)& templates()
|
||||
{
|
||||
static Handle(Dico_DictionaryOfTransient) atemp;
|
||||
if (atemp.IsNull()) atemp = new Dico_DictionaryOfTransient;
|
||||
return atemp;
|
||||
}
|
||||
|
||||
static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> atemp;
|
||||
|
||||
static const Handle(Standard_Type)& typerep()
|
||||
{
|
||||
@@ -1004,7 +996,7 @@ Standard_Integer Interface_InterfaceModel::NextNumberForLabel
|
||||
Standard_Boolean Interface_InterfaceModel::HasTemplate
|
||||
(const Standard_CString name)
|
||||
{
|
||||
return templates()->HasItem(name);
|
||||
return atemp.IsBound(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1018,7 +1010,7 @@ Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
|
||||
{
|
||||
Handle(Interface_InterfaceModel) model,newmod;
|
||||
if (!HasTemplate(name)) return model;
|
||||
model = Handle(Interface_InterfaceModel)::DownCast(templates()->Item(name));
|
||||
model = Handle(Interface_InterfaceModel)::DownCast(atemp.ChangeFind(name));
|
||||
newmod = model->NewEmptyModel();
|
||||
newmod->GetFromAnother (model);
|
||||
return newmod;
|
||||
@@ -1033,10 +1025,7 @@ Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
|
||||
Standard_Boolean Interface_InterfaceModel::SetTemplate
|
||||
(const Standard_CString name, const Handle(Interface_InterfaceModel)& model)
|
||||
{
|
||||
Standard_Boolean deja;
|
||||
Handle(Standard_Transient)& newmod = templates()->NewItem(name,deja);
|
||||
newmod = model;
|
||||
return deja;
|
||||
return atemp.Bind(name, model);
|
||||
}
|
||||
|
||||
|
||||
@@ -1049,10 +1038,10 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates
|
||||
{
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list = new
|
||||
TColStd_HSequenceOfHAsciiString();
|
||||
if (templates().IsNull()) return list;
|
||||
for (Dico_IteratorOfDictionaryOfTransient iter(templates());
|
||||
iter.More(); iter.Next()) {
|
||||
list->Append (new TCollection_HAsciiString (iter.Name()) );
|
||||
if (atemp.IsEmpty()) return list;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(atemp);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
list->Append (new TCollection_HAsciiString (iter.Key()) );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@@ -12,11 +12,8 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfInteger.hxx>
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
@@ -25,8 +22,8 @@
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
static Handle(Dico_DictionaryOfTransient) thedic;
|
||||
static Handle(Dico_DictionaryOfInteger) thelist;
|
||||
static NCollection_DataMap<TCollection_AsciiString, Handle(TCollection_HAsciiString)> thedic;
|
||||
static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thelist;
|
||||
static Handle(TColStd_HSequenceOfHAsciiString) thedup;
|
||||
static Standard_Boolean theprint = Standard_True;
|
||||
static Standard_Boolean therec = Standard_False;
|
||||
@@ -156,13 +153,13 @@ Standard_Integer Interface_MSG::Read (Standard_IStream& S)
|
||||
(Standard_OStream& S, const Standard_CString rootkey)
|
||||
{
|
||||
Standard_Integer nb = 0;
|
||||
if (thedic.IsNull()) return nb;
|
||||
if (thedic.IsEmpty()) return nb;
|
||||
if (rootkey[0] != '\0') S<<"@@ ROOT:"<<rootkey<<endl;
|
||||
Dico_IteratorOfDictionaryOfTransient iter (thedic,rootkey);
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
S<<"@"<<iter.Name()<<"\n";
|
||||
Handle(TCollection_HAsciiString) str =
|
||||
Handle(TCollection_HAsciiString)::DownCast(iter.Value());
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(TCollection_HAsciiString)>::Iterator iter(thedic);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
if (!iter.Key().StartsWith(rootkey)) continue;
|
||||
S<<"@"<<iter.Key()<<"\n";
|
||||
const Handle(TCollection_HAsciiString) str = iter.Value();
|
||||
if (str.IsNull()) continue;
|
||||
nb ++;
|
||||
S<<str->ToCString()<<"\n";
|
||||
@@ -183,16 +180,17 @@ Standard_Boolean Interface_MSG::IsKey (const Standard_CString key)
|
||||
Standard_CString Interface_MSG::Translated (const Standard_CString key)
|
||||
{
|
||||
if (!therun) return key;
|
||||
if (!thedic.IsNull()) {
|
||||
if (!thedic.IsEmpty()) {
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
if (thedic->GetItem(key,str)) return str->ToCString();
|
||||
if (thedic.Find(key, str))
|
||||
return str->ToCString();
|
||||
}
|
||||
if (theprint) cout<<" ** Interface_MSG:Translate ?? "<<key<<" **"<<endl;
|
||||
if (therec) {
|
||||
Standard_Boolean deja;
|
||||
if (thelist.IsNull()) thelist = new Dico_DictionaryOfInteger;
|
||||
Standard_Integer& nb = thelist->NewItem (key,deja);
|
||||
if (!deja) nb = 0; nb ++;
|
||||
if (thelist.IsBound(key)) {
|
||||
thelist.ChangeFind(key)++;
|
||||
} else
|
||||
thelist.Bind(key, 1);
|
||||
}
|
||||
if (theraise) Standard_DomainError::Raise ("Interface_MSG : Translate");
|
||||
return key;
|
||||
@@ -200,15 +198,16 @@ Standard_CString Interface_MSG::Translated (const Standard_CString key)
|
||||
|
||||
|
||||
void Interface_MSG::Record
|
||||
(const Standard_CString key, const Standard_CString item)
|
||||
(const Standard_CString key, const Standard_CString item)
|
||||
{
|
||||
if (thedic.IsNull()) thedic = new Dico_DictionaryOfTransient;
|
||||
Standard_Boolean deja;
|
||||
Handle(TCollection_HAsciiString) dup;
|
||||
Handle(Standard_Transient)& res = thedic->NewItem (key,deja);
|
||||
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (item);
|
||||
res = str;
|
||||
if (!deja) return;
|
||||
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString(item);
|
||||
if (thedic.IsBound(key)) {
|
||||
thedic.ChangeFind(key) = str;
|
||||
} else {
|
||||
thedic.Bind(key,str);
|
||||
return;
|
||||
}
|
||||
if (theprint) cout<<" ** Interface_MSG:Record ?? "<<key<<" ** "<<item<<" **"<<endl;
|
||||
if (therec) {
|
||||
if (thedup.IsNull()) thedup = new TColStd_HSequenceOfHAsciiString();
|
||||
@@ -248,10 +247,10 @@ void Interface_MSG::PrintTrace (Standard_OStream& S)
|
||||
S<<" ** "<<dup->ToCString()<<endl;
|
||||
}
|
||||
|
||||
if (thelist.IsNull()) return;
|
||||
Dico_IteratorOfDictionaryOfInteger iter (thelist);
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
S<<"** MSG(NB="<<iter.Value()<<"): "<<iter.Name()<<endl;
|
||||
if (thelist.IsEmpty()) return;
|
||||
NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thelist);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
S<<"** MSG(NB="<<iter.Value()<<"): "<<iter.Key()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,10 +12,6 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfInteger.hxx>
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
@@ -144,7 +140,7 @@ Standard_Boolean Interface_Static::Init
|
||||
{
|
||||
if (name[0] == '\0') return Standard_False;
|
||||
|
||||
if (MoniTool_TypedValue::Stats()->HasItem(name)) return Standard_False;
|
||||
if (MoniTool_TypedValue::Stats().IsBound(name)) return Standard_False;
|
||||
Handle(Interface_Static) item;
|
||||
if (type == Interface_ParamMisc) {
|
||||
Handle(Interface_Static) other = Interface_Static::Static(init);
|
||||
@@ -153,7 +149,7 @@ Standard_Boolean Interface_Static::Init
|
||||
}
|
||||
else item = new Interface_Static (family,name,type,init);
|
||||
|
||||
MoniTool_TypedValue::Stats()->SetItem (name,item);
|
||||
MoniTool_TypedValue::Stats().Bind (name,item);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -213,15 +209,15 @@ Standard_Boolean Interface_Static::Init
|
||||
Handle(Interface_Static) Interface_Static::Static
|
||||
(const Standard_CString name)
|
||||
{
|
||||
Handle(Interface_Static) result;
|
||||
MoniTool_TypedValue::Stats()->GetItem (name,result);
|
||||
return result;
|
||||
Handle(Standard_Transient) result;
|
||||
MoniTool_TypedValue::Stats().Find(name, result);
|
||||
return Handle(Interface_Static)::DownCast(result);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Interface_Static::IsPresent (const Standard_CString name)
|
||||
{
|
||||
return MoniTool_TypedValue::Stats()->HasItem (name);
|
||||
return MoniTool_TypedValue::Stats().IsBound (name);
|
||||
}
|
||||
|
||||
|
||||
@@ -392,8 +388,8 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_Static::Items
|
||||
Standard_Integer modup = (mode / 100); // 0 any, 1 non-update, 2 update
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list =
|
||||
new TColStd_HSequenceOfHAsciiString();
|
||||
Dico_IteratorOfDictionaryOfTransient iter(MoniTool_TypedValue::Stats());
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(MoniTool_TypedValue::Stats());
|
||||
for (; iter.More(); iter.Next()) {
|
||||
Handle(Interface_Static) item =
|
||||
Handle(Interface_Static)::DownCast(iter.Value());
|
||||
if (item.IsNull()) continue;
|
||||
@@ -409,7 +405,7 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_Static::Items
|
||||
if (ok && (modup == 1)) ok = !item->UpdatedStatus();
|
||||
if (ok && (modup == 2)) ok = item->UpdatedStatus();
|
||||
|
||||
if (ok) list->Append (new TCollection_HAsciiString (iter.Name()) );
|
||||
if (ok) list->Append (new TCollection_HAsciiString (iter.Key()) );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Character.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
class Dico_DictionaryOfInteger;
|
||||
class TCollection_HAsciiString;
|
||||
class Standard_Transient;
|
||||
class Interface_InterfaceError;
|
||||
@@ -284,7 +283,7 @@ private:
|
||||
Standard_Real therealup;
|
||||
TCollection_AsciiString theunidef;
|
||||
Handle(TColStd_HArray1OfAsciiString) theenums;
|
||||
Handle(Dico_DictionaryOfInteger) theeadds;
|
||||
NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theeadds;
|
||||
Interface_StaticSatisfies thesatisf;
|
||||
TCollection_AsciiString thesatisn;
|
||||
Standard_Boolean theupdate;
|
||||
|
@@ -12,8 +12,6 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfInteger.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Interface_ParamType.hxx>
|
||||
#include <MoniTool_ValueType.hxx>
|
||||
class Dico_DictionaryOfInteger;
|
||||
class TCollection_HAsciiString;
|
||||
class Standard_Transient;
|
||||
class Interface_InterfaceError;
|
||||
@@ -101,7 +100,7 @@ private:
|
||||
Handle(Standard_Type) theotyp;
|
||||
TCollection_AsciiString theunidef;
|
||||
Handle(TColStd_HArray1OfAsciiString) theenums;
|
||||
Handle(Dico_DictionaryOfInteger) theeadds;
|
||||
NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theeadds;
|
||||
TCollection_AsciiString thesatisn;
|
||||
Handle(TCollection_HAsciiString) thehval;
|
||||
Handle(Standard_Transient) theoval;
|
||||
|
Reference in New Issue
Block a user