1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +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

@ -5,7 +5,6 @@ n Bnd
n BVH n BVH
n CSLib n CSLib
n Convert n Convert
n Dico
n ElCLib n ElCLib
n ElSLib n ElSLib
n Expr n Expr

View File

@ -1081,6 +1081,9 @@ The following obsolete features have been removed:
* Class *NCollection_QuickSort* has been removed. * Class *NCollection_QuickSort* has been removed.
The code that used the tools provided by that class should be corrected manually. The code that used the tools provided by that class should be corrected manually.
The recommended approach is to use sorting algorithms provided by STL. The recommended approach is to use sorting algorithms provided by STL.
* Package *Dico* has been removed.
The code that used the tools provided by that package should be corrected manually.
The recommended approach is to use NCollection_DataMap and NCollection_IndexedDataMap classes.
@subsection upgrade_occt710_correction_of_TObj_Model Correction in TObj_Model class @subsection upgrade_occt710_correction_of_TObj_Model Correction in TObj_Model class

View File

@ -1,467 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//#include <Dico_Dictionary.ixx> pas en gxx
#include <Standard_NoSuchObject.hxx>
#include <string.h>
// thecars[0] : caractere de consigne, caracterisant la cellule
// thecars[1] : indicateur de presence : 0 rien, ==thecar[0] item present
// thecars[2] : caractere du Sub ou 0
// thecars[3] : caractere du Next ou 0
// REMARQUE : Fonctions d acces dupliquees : TCollection_AsciiString / CString
// C est a chaque fois le MEME CODE, mais Length et Value ne sont pas obtenues
// de la meme maniere ...
// SearchCell pas duplique : la version String appelle la version CString
// Les autres fonctions doivent d abord evaluer la longueur de <name>
// Sur String, methode Length, mais sur CString, il faut evaluer par strlen
// String serait donc meilleur (plus systematique) MAIS suppose, sur appel
// CString, de constituer une TCollection_AsciiString ce qui peut couter ...
// CONCLUSION : Fonctions d acces par Nom dupliquees, pour optimisation
Dico_Dictionary::Dico_Dictionary ()
{
thecars[0] = thecars[1] = thecars[2] = thecars[3] = '\0';
thesub.Nullify(); thenext.Nullify();
}
void Dico_Dictionary::SetChar (const char car) { thecars[0] = car; }
// .... HasItem ....
Standard_Boolean Dico_Dictionary::HasItem
(const Standard_CString name, const Standard_Boolean exact) const
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name,strlen(name),name[0],1, acell,reslev,stat);
if (stat != 0 || reslev != 0) return Standard_False;
if (acell->HasIt()) return Standard_True;
if (!exact) { if (!acell->Complete(acell)) return Standard_False; }
return (acell->HasIt());
}
Standard_Boolean Dico_Dictionary::HasItem
(const TCollection_AsciiString& name, const Standard_Boolean exact) const
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name.ToCString(),name.Length(),name.Value(1),1, acell,reslev,stat);
if (stat != 0 || reslev != 0) return Standard_False;
if (acell->HasIt()) return Standard_True;
if (!exact) { if (!acell->Complete(acell)) return Standard_False; }
return (acell->HasIt());
}
// .... Item ....
const TheItem& Dico_Dictionary::Item
(const Standard_CString name, const Standard_Boolean exact) const
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name,strlen(name),name[0],1, acell,reslev,stat);
if (stat != 0 || reslev != 0)
Standard_NoSuchObject::Raise("Dictionary : Item");
if (acell->HasIt()) return acell->It();
if (!exact) { if (!acell->Complete(acell)) return acell->It(); }
if (!acell->HasIt()) Standard_NoSuchObject::Raise("Dictionary : Item");
return (acell->It());
}
const TheItem& Dico_Dictionary::Item
(const TCollection_AsciiString& name, const Standard_Boolean exact) const
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name.ToCString(),name.Length(),name.Value(1),1, acell,reslev,stat);
if (stat != 0 || reslev != 0)
Standard_NoSuchObject::Raise("Dictionary : Item");
if (acell->HasIt()) return acell->It();
if (!exact) { if (!acell->Complete(acell)) return acell->It(); }
if (!acell->HasIt()) Standard_NoSuchObject::Raise("Dictionary : Item");
return (acell->It());
}
// .... GetItem ....
Standard_Boolean Dico_Dictionary::GetItem
(const Standard_CString name,
TheItem& anitem, const Standard_Boolean exact) const
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name,strlen(name),name[0],1, acell,reslev,stat);
if (stat != 0 || reslev != 0) return Standard_False;
if (acell->HasIt()) { anitem = acell->It(); return Standard_True; }
if (!exact) { if (!acell->Complete(acell)) return Standard_False; }
anitem = acell->It();
return (acell->HasIt());
}
Standard_Boolean Dico_Dictionary::GetItem
(const TCollection_AsciiString& name,
TheItem& anitem, const Standard_Boolean exact) const
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name.ToCString(),name.Length(),name.Value(1),1, acell,reslev,stat);
if (stat != 0 || reslev != 0) return Standard_False;
if (acell->HasIt()) { anitem = acell->It(); return Standard_True; }
if (!exact) { if (!acell->Complete(acell)) return Standard_False; }
anitem = acell->It();
return (acell->HasIt());
}
// .... SetItem ....
void Dico_Dictionary::SetItem
(const Standard_CString name,
const TheItem& anitem, const Standard_Boolean exact)
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
Standard_Size namlen = strlen(name);
SearchCell (name,namlen,name[0],1, acell,reslev,stat);
if (!exact && !acell->HasIt())
{ if (acell->Complete(acell)) { acell->SetIt(anitem); return; } }
if (stat < 0) { cout<<"Dictionary walk back not performed"<<endl; return; }
NewCell (name,namlen, acell,reslev,stat);
acell->SetIt(anitem);
}
void Dico_Dictionary::SetItem
(const TCollection_AsciiString& name,
const TheItem& anitem, const Standard_Boolean exact)
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
Standard_CString namval = name.ToCString();
Standard_Integer namlen = name.Length();
SearchCell (namval,namlen,name.Value(1),1, acell,reslev,stat);
if (!exact && !acell->HasIt())
{ if (acell->Complete(acell)) { acell->SetIt(anitem); return; } }
if (stat < 0) { cout<<"Dictionary walk back not performed"<<endl; return; }
NewCell (namval,namlen, acell,reslev,stat);
acell->SetIt(anitem);
}
// .... NewItem ....
TheItem& Dico_Dictionary::NewItem
(const Standard_CString name,
Standard_Boolean& isvalued, const Standard_Boolean exact)
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
Standard_Size namlen = strlen(name);
SearchCell (name,namlen,name[0],1, acell,reslev,stat);
if (stat == 0 && reslev == 0) {
isvalued = acell->HasIt(); // ancien statut
acell->DeclIt(); // nouveau statut = value d office
return acell->ItAdr();
}
if (!exact) {
if (acell->Complete(acell))
{ isvalued = acell->HasIt(); acell->DeclIt(); return acell->ItAdr(); }
}
if (stat < 0) { Standard_NoSuchObject::Raise("Dictionary : NewItem"); }
NewCell (name,namlen, acell,reslev,stat);
isvalued = acell->HasIt(); // ancien statut
acell->DeclIt(); // nouveau statut = value d office
return acell->ItAdr();
}
TheItem& Dico_Dictionary::NewItem
(const TCollection_AsciiString& name,
Standard_Boolean& isvalued, const Standard_Boolean exact)
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
Standard_Integer namlen = name.Length();
Standard_CString namval = name.ToCString();
SearchCell (namval,namlen,name.Value(1),1, acell,reslev,stat);
if (stat == 0 && reslev == 0) {
isvalued = acell->HasIt(); // ancien statut
acell->DeclIt(); // nouveau statut = value d office
return acell->ItAdr();
}
if (!exact) {
if (acell->Complete(acell))
{ isvalued = acell->HasIt(); acell->DeclIt(); return acell->ItAdr(); }
}
if (stat < 0) { Standard_NoSuchObject::Raise("Dictionary : NewItem"); }
NewCell (namval,namlen, acell,reslev,stat);
isvalued = acell->HasIt(); // ancien statut
acell->DeclIt(); // nouveau statut = value d office
return acell->ItAdr();
}
// .... RemoveItem ....
Standard_Boolean Dico_Dictionary::RemoveItem
(const Standard_CString name,
const Standard_Boolean cln, const Standard_Boolean exact)
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name,strlen(name),name[0],1, acell,reslev,stat);
// if (stat != 0) { cout<<"Dictionary : RemoveItem not found"<<endl; return; }
if (stat != 0) return Standard_False;
if (!exact && !acell->HasIt())
{ if (!acell->Complete(acell)) return Standard_False; }
acell->RemoveIt();
if (cln) Clean();
return Standard_True;
}
Standard_Boolean Dico_Dictionary::RemoveItem
(const TCollection_AsciiString& name,
const Standard_Boolean cln, const Standard_Boolean exact)
{
Handle(Dico_Dictionary) acell;
Standard_Integer stat;
Standard_Size reslev;
SearchCell (name.ToCString(),name.Length(),name.Value(1),1, acell,reslev,stat);
// if (stat != 0) { cout<<"Dictionary : RemoveItem not found"<<endl; return; }
if (stat != 0) return Standard_False;
if (!exact && !acell->HasIt())
{ if (!acell->Complete(acell)) return Standard_False; }
acell->RemoveIt();
if (cln) Clean();
return Standard_True;
}
// .... Methodes d Interet General ....
void Dico_Dictionary::Clean ()
{
if (HasSub()) {
thesub->Clean();
if (!thesub->HasIt() && !thesub->HasSub()) { // alors prendre son Next
if (thesub->HasNext()) {
thesub = thesub->Next();
thecars[2] = thesub->CellChar();
} else {
thesub.Nullify();
thecars[2] = '\0';
}
}
}
if (HasNext()) {
thenext->Clean();
if (!thenext->HasIt() && !thenext->HasSub()) { // alors prendre son Next
if (thenext->HasNext()) {
thenext = thenext->Next();
thecars[3] = thenext->CellChar();
} else {
thenext.Nullify();
thecars[3] = '\0';
}
}
}
}
Standard_Boolean Dico_Dictionary::IsEmpty () const
{
if (thecars[1] != '\0') return Standard_False;
if (!thesub.IsNull())
{ if (!thesub->IsEmpty()) return Standard_False; }
if (!thenext.IsNull())
{ if (!thenext->IsEmpty()) return Standard_False; }
return Standard_True;
}
void Dico_Dictionary::Clear ()
{
thecars[0] = thecars[1] = thecars[2] = thecars[3] = '\0';
thesub.Nullify(); thenext.Nullify();
}
Handle(Dico_Dictionary) Dico_Dictionary::Copy () const
{
Handle(Dico_Dictionary) newdic = new Dico_Dictionary;
// Handle(Dico_Dictionary)::DownCast(ShallowCopy());
newdic->GetCopied(this); // qui doit gerer completement thecars et item
return newdic;
}
// ########################################################################
// .... Routines internes ....
Standard_Boolean Dico_Dictionary::HasSub () const
{ return (thecars[2] != '\0'); }
Handle(Dico_Dictionary) Dico_Dictionary::Sub () const { return thesub; }
Standard_Boolean Dico_Dictionary::HasNext () const
{ return (thecars[3] != '\0'); }
Handle(Dico_Dictionary) Dico_Dictionary::Next () const { return thenext; }
void Dico_Dictionary::SetSub (const Handle(Dico_Dictionary)& acell)
{
thesub = acell; thecars[2] = '\0';
if (!acell.IsNull()) thecars[2] = acell->CellChar();
}
void Dico_Dictionary::SetNext (const Handle(Dico_Dictionary)& acell)
{
thenext = acell; thecars[3] = '\0';
if (!acell.IsNull()) thecars[3] = acell->CellChar();
}
// .... SearchCell ....
void Dico_Dictionary::SearchCell
(const Standard_CString name, const Standard_Size lmax,
const Standard_Character car, const Standard_Size level,
Handle(Dico_Dictionary)& acell,
Standard_Size& reslev, Standard_Integer& stat) const
{
reslev = lmax - level;
if (car > thecars[0]) {
if (thecars[3] == '\0') { acell = this; stat = 1; return; }
else { // ici, HasNext
if (thecars[3] > car) { acell = this; stat = 1; return; }
Standard_Integer stat2;
Standard_Size lev2;
thenext->SearchCell (name,lmax,car,level,acell,lev2,stat2);
if (stat2 < 0) { acell = this; stat = 1; return; }
else { stat = stat2; reslev = lev2; return; }
}
}
else if (car == thecars[0]) {
if (reslev == 0 || thecars[2] == '\0') // c-a-d !HasSub
{ acell = this; stat = 0; return; }
else {
Standard_Character carsub = name[level]; // caractere no (level+1);
if (thecars[2] > carsub) { acell = this; stat = 0; return; }
Standard_Integer stat2;
Standard_Size lev2;
thesub->SearchCell (name,lmax,carsub,level+1,acell,lev2,stat2);
if (stat2 < 0) { acell = this; stat = 0; return; }
else { stat = stat2; reslev = lev2; return; }
}
}
else /*if (car < thecars[0])*/{ acell = this; stat = -1; return; }
}
// .... NewCell ....
void Dico_Dictionary::NewCell
(const Standard_CString name, const Standard_Size namlen,
Handle(Dico_Dictionary)& acell,
const Standard_Size reslev, const Standard_Integer stat)
{
Standard_Size level = namlen - reslev;
if (stat > 0) { // Creer une cellule next
Handle(Dico_Dictionary) newcell = new Dico_Dictionary;
newcell->SetChar( name[level-1] ); // caractere no level
if (acell->HasNext()) newcell->SetNext(acell->Next());
acell->SetNext(newcell);
acell = newcell;
}
// A present, voir les sous-niveaux
for (Standard_Size i = level+1; i <= namlen; i ++) {
Handle(Dico_Dictionary) newcell = new Dico_Dictionary;
newcell->SetChar(name[i-1]);
if (acell->HasSub()) newcell->SetNext(acell->Sub());
acell->SetSub(newcell);
acell = newcell;
}
}
Standard_Boolean Dico_Dictionary::Complete
(Handle(Dico_Dictionary)& newcell) const
{
if (!HasSub()) { newcell = this; return HasIt(); }
if (HasIt()) { newcell = this; return Standard_False; }
if (thesub->HasNext()) { newcell = this; return Standard_False; }
return thesub->Complete (newcell);
}
// ## ## ## ## ## ## ## ## ## ## ## ## ##
// .... Actions Internes Unitaires ....
Standard_Boolean Dico_Dictionary::HasIt () const
{ return (thecars[1] != '\0'); }
const TheItem& Dico_Dictionary::It () const { return theitem; }
TheItem& Dico_Dictionary::ItAdr () { return theitem; }
void Dico_Dictionary::SetIt (const TheItem& anitem)
{ theitem = anitem; thecars[1] = thecars[0]; }
void Dico_Dictionary::DeclIt () { thecars[1] = thecars[0]; }
void Dico_Dictionary::RemoveIt () { thecars[1] = '\0'; }
Standard_Character Dico_Dictionary::CellChar () const
{ return thecars[0]; }
void Dico_Dictionary::GetCopied (const Handle(Dico_Dictionary)& fromcell)
{
thecars[0] = fromcell->CellChar();
// On reprend l item s ilyena un
if (fromcell->HasIt()) {
thecars[1] = thecars[0];
theitem = fromcell->It();
}
else thecars[1] = '\0';
// On saute les noeuds vides
if (fromcell->HasSub()) {
thesub = fromcell->Sub()->Copy();
while (!thesub->HasIt() && !thesub->HasSub()) {
thesub = thesub->Next();
if (thesub.IsNull()) { thecars[2] = '\0'; break; }
else thecars[2] = thesub->CellChar();
}
}
if (fromcell->HasNext()) {
thenext = fromcell->Next()->Copy();
while (!thenext->HasIt() && !thenext->HasSub()) {
thenext = thenext->Next();
if (thenext.IsNull()) { thecars[3] = '\0'; break; }
else thecars[3] = thenext->CellChar();
}
}
}

View File

@ -1,209 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Dico_DictionaryOfInteger_HeaderFile
#define _Dico_DictionaryOfInteger_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Character.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Size.hxx>
class Standard_NoSuchObject;
class Dico_IteratorOfDictionaryOfInteger;
class Dico_StackItemOfDictionaryOfInteger;
class TCollection_AsciiString;
class Dico_DictionaryOfInteger;
DEFINE_STANDARD_HANDLE(Dico_DictionaryOfInteger, MMgt_TShared)
class Dico_DictionaryOfInteger : public MMgt_TShared
{
public:
//! Creates a Dictionary cell.
//! A Dictionary is always created then handled by its first cell
//! After creating a Dictionary, user can call methods HasItem,
//! Item, SetItem ... (internal cells and entries are also
//! defined as objects from the same class)
//! Also iteration can be made, by an Iterator on this Dictionary
Standard_EXPORT Dico_DictionaryOfInteger();
//! Returns True if an Item is bound to a Name in the Dictionnary
//! <exact> : if True, commands exact matching
//! if False, accept completion, only if ONE AND ONLY ONE
//! Dictionnary Entry has <name> as beginning of its name
Standard_EXPORT Standard_Boolean HasItem (const Standard_CString name, const Standard_Boolean exact = Standard_False) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean HasItem (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Returns item bound to a name in the Dictionnary
//! <exact> : same as for HasItem
Standard_EXPORT const Standard_Integer& Item (const Standard_CString name, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT const Standard_Integer& Item (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Gathers HasItem and Item, in a less regular but faster way
//! If return is True, <anitem> is returned too, else it is not
//! <exact> : same as for HasItem
Standard_EXPORT Standard_Boolean GetItem (const Standard_CString name, Standard_Integer& anitem, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean GetItem (const TCollection_AsciiString& name, Standard_Integer& anitem, const Standard_Boolean exact = Standard_True) const;
//! Binds an item to a dictionnary entry
//! If <name> is already known in the dictionary, its value
//! is changed. Else, the dictionary entry is created.
//! If <exact> is given False, completion is tried, it is accepted
//! If it gives a UNIQUE entry : hence this one will be modified
//! Else, new entry is created with the exact name given
Standard_EXPORT void SetItem (const Standard_CString name, const Standard_Integer& anitem, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT void SetItem (const TCollection_AsciiString& name, const Standard_Integer& anitem, const Standard_Boolean exact = Standard_True);
//! Returns the Item AS AN ADDRESS which corresponds to a Name,
//! in order to be changed or set.
//! If this name is not yet recorded, the Dictionary creates it.
//! <isvalued> is returned True if the Item is recorded in the
//! Dictionary, False else, in that case the Item is reserved and
//! the name is noted as beeing valued now.
Standard_EXPORT Standard_Integer& NewItem (const Standard_CString name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Integer& NewItem (const TCollection_AsciiString& name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Removes a dictionary entry given by its name then Returns True
//! If the entry does not exists, Does nothing then Returns False
//! <exact> : as for HasItem, if completion works, the found entry
//! is removed (else returned value is False)
//! <cln> commands cleaning dictionary (to recover memory space)
//! For an isolated call, it is recommanded to give it at True
//! For a sequence of calls, rather give False, then call Clean
Standard_EXPORT Standard_Boolean RemoveItem (const Standard_CString name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean RemoveItem (const TCollection_AsciiString& name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Deletes physically in one step the entries which were removed
//! (can be used for a more efficient Memory Management : first
//! Remove several Items (<cln> = False), then Clean the Memory)
Standard_EXPORT void Clean();
//! Returns True if no Item is recorded
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Clears all the Dictionary : all recorded Items are removed
Standard_EXPORT void Clear();
//! Copies the Dictionary as a Tree, without Copying the Items
Standard_EXPORT Handle(Dico_DictionaryOfInteger) Copy() const;
//! Internal routine used for completion (returns True if success)
Standard_EXPORT Standard_Boolean Complete (Handle(Dico_DictionaryOfInteger)& acell) const;
friend class Dico_IteratorOfDictionaryOfInteger;
DEFINE_STANDARD_RTTI_INLINE(Dico_DictionaryOfInteger,MMgt_TShared)
protected:
private:
//! Defines cell's character (internal use, to build dict. tree)
Standard_EXPORT void SetChar (const Standard_Character car);
//! Returns True if this cell has a subcell
Standard_EXPORT Standard_Boolean HasSub() const;
//! Returns subcell
Standard_EXPORT Handle(Dico_DictionaryOfInteger) Sub() const;
//! Returns True if this cell has a next cell
Standard_EXPORT Standard_Boolean HasNext() const;
//! Returns next cell
Standard_EXPORT Handle(Dico_DictionaryOfInteger) Next() const;
//! Defines subcell
Standard_EXPORT void SetSub (const Handle(Dico_DictionaryOfInteger)& acell);
//! Defines next cell
Standard_EXPORT void SetNext (const Handle(Dico_DictionaryOfInteger)& acell);
//! Internal method used to get an entry from a given name
Standard_EXPORT void SearchCell (const Standard_CString name, const Standard_Size lmax, const Standard_Character car, const Standard_Size level, Handle(Dico_DictionaryOfInteger)& acell, Standard_Size& reslev, Standard_Integer& stat) const;
//! Internal method used to create a new entry for a name
Standard_EXPORT void NewCell (const Standard_CString name, const Standard_Size namlen, Handle(Dico_DictionaryOfInteger)& acell, const Standard_Size reslev, const Standard_Integer stat);
//! Returns True if a cell has an associated item value
Standard_EXPORT Standard_Boolean HasIt() const;
//! Returns item value associated to a cell
Standard_EXPORT const Standard_Integer& It() const;
//! Returns item address associated to a cell
Standard_EXPORT Standard_Integer& ItAdr();
//! Binds an item value to a cell
Standard_EXPORT void SetIt (const Standard_Integer& anitem);
//! Declares a cell as Valued : used by NewItem (when an Item
//! is created if it did not exist and is returned)
Standard_EXPORT void DeclIt();
//! Removes item bound to a cell (cancels effect of DeclIt)
Standard_EXPORT void RemoveIt();
//! Returns cell's character as a node feature
Standard_EXPORT Standard_Character CellChar() const;
//! Performs Copy from an original <fromcell> to <me>
//! Called by Copy
Standard_EXPORT void GetCopied (const Handle(Dico_DictionaryOfInteger)& fromcell);
Standard_Character thecars[4];
Handle(Dico_DictionaryOfInteger) thesub;
Handle(Dico_DictionaryOfInteger) thenext;
Standard_Integer theitem;
};
#endif // _Dico_DictionaryOfInteger_HeaderFile

View File

@ -1,47 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Standard_Type.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_StackItemOfDictionaryOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Standard_Integer
#define TheItem_hxx <Standard_Integer.hxx>
#define Dico_Iterator Dico_IteratorOfDictionaryOfInteger
#define Dico_Iterator_hxx <Dico_IteratorOfDictionaryOfInteger.hxx>
#define Dico_StackItem Dico_StackItemOfDictionaryOfInteger
#define Dico_StackItem_hxx <Dico_StackItemOfDictionaryOfInteger.hxx>
#define Handle_Dico_StackItem Handle(Dico_StackItemOfDictionaryOfInteger)
#define Dico_Dictionary Dico_DictionaryOfInteger
#define Dico_Dictionary_hxx <Dico_DictionaryOfInteger.hxx>
#define Handle_Dico_Dictionary Handle(Dico_DictionaryOfInteger)
#include <Dico_Dictionary.gxx>

View File

@ -1,226 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Dico_DictionaryOfTransient_HeaderFile
#define _Dico_DictionaryOfTransient_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Character.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Size.hxx>
#include <Standard_Integer.hxx>
class Standard_Transient;
class Standard_NoSuchObject;
class Dico_IteratorOfDictionaryOfTransient;
class Dico_StackItemOfDictionaryOfTransient;
class TCollection_AsciiString;
class Dico_DictionaryOfTransient;
DEFINE_STANDARD_HANDLE(Dico_DictionaryOfTransient, MMgt_TShared)
class Dico_DictionaryOfTransient : public MMgt_TShared
{
public:
//! Creates a Dictionary cell.
//! A Dictionary is always created then handled by its first cell
//! After creating a Dictionary, user can call methods HasItem,
//! Item, SetItem ... (internal cells and entries are also
//! defined as objects from the same class)
//! Also iteration can be made, by an Iterator on this Dictionary
Standard_EXPORT Dico_DictionaryOfTransient();
//! Returns True if an Item is bound to a Name in the Dictionnary
//! <exact> : if True, commands exact matching
//! if False, accept completion, only if ONE AND ONLY ONE
//! Dictionnary Entry has <name> as beginning of its name
Standard_EXPORT Standard_Boolean HasItem (const Standard_CString name, const Standard_Boolean exact = Standard_False) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean HasItem (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Returns item bound to a name in the Dictionnary
//! <exact> : same as for HasItem
Standard_EXPORT const Handle(Standard_Transient)& Item (const Standard_CString name, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT const Handle(Standard_Transient)& Item (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Gathers HasItem and Item, in a less regular but faster way
//! If return is True, <anitem> is returned too, else it is not
//! <exact> : same as for HasItem
Standard_EXPORT Standard_Boolean GetItem (const Standard_CString name, Handle(Standard_Transient)& anitem, const Standard_Boolean exact = Standard_True) const;
//! Safe variant of GetItem() for arbitrary type of argument
template <class T>
Standard_Boolean GetItem (const Standard_CString theName, Handle(T)& theItem, const Standard_Boolean theExact = Standard_True) const
{
Handle(Standard_Transient) anItem = theItem;
return GetItem (theName, anItem, theExact) && ! (theItem = Handle(T)::DownCast(anItem)).IsNull();
}
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean GetItem (const TCollection_AsciiString& name, Handle(Standard_Transient)& anitem, const Standard_Boolean exact = Standard_True) const;
//! Safe variant of GetItem() for arbitrary type of argument
template <class T>
Standard_Boolean GetItem (const TCollection_AsciiString& theName, Handle(T)& theItem, const Standard_Boolean theExact = Standard_True) const
{
Handle(Standard_Transient) anItem = theItem;
return GetItem (theName, anItem, theExact) && ! (theItem = Handle(T)::DownCast(anItem)).IsNull();
}
//! Binds an item to a dictionnary entry
//! If <name> is already known in the dictionary, its value
//! is changed. Else, the dictionary entry is created.
//! If <exact> is given False, completion is tried, it is accepted
//! If it gives a UNIQUE entry : hence this one will be modified
//! Else, new entry is created with the exact name given
Standard_EXPORT void SetItem (const Standard_CString name, const Handle(Standard_Transient)& anitem, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT void SetItem (const TCollection_AsciiString& name, const Handle(Standard_Transient)& anitem, const Standard_Boolean exact = Standard_True);
//! Returns the Item AS AN ADDRESS which corresponds to a Name,
//! in order to be changed or set.
//! If this name is not yet recorded, the Dictionary creates it.
//! <isvalued> is returned True if the Item is recorded in the
//! Dictionary, False else, in that case the Item is reserved and
//! the name is noted as beeing valued now.
Standard_EXPORT Handle(Standard_Transient)& NewItem (const Standard_CString name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Handle(Standard_Transient)& NewItem (const TCollection_AsciiString& name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Removes a dictionary entry given by its name then Returns True
//! If the entry does not exists, Does nothing then Returns False
//! <exact> : as for HasItem, if completion works, the found entry
//! is removed (else returned value is False)
//! <cln> commands cleaning dictionary (to recover memory space)
//! For an isolated call, it is recommanded to give it at True
//! For a sequence of calls, rather give False, then call Clean
Standard_EXPORT Standard_Boolean RemoveItem (const Standard_CString name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean RemoveItem (const TCollection_AsciiString& name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Deletes physically in one step the entries which were removed
//! (can be used for a more efficient Memory Management : first
//! Remove several Items (<cln> = False), then Clean the Memory)
Standard_EXPORT void Clean();
//! Returns True if no Item is recorded
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Clears all the Dictionary : all recorded Items are removed
Standard_EXPORT void Clear();
//! Copies the Dictionary as a Tree, without Copying the Items
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Copy() const;
//! Internal routine used for completion (returns True if success)
Standard_EXPORT Standard_Boolean Complete (Handle(Dico_DictionaryOfTransient)& acell) const;
friend class Dico_IteratorOfDictionaryOfTransient;
DEFINE_STANDARD_RTTI_INLINE(Dico_DictionaryOfTransient,MMgt_TShared)
protected:
private:
//! Defines cell's character (internal use, to build dict. tree)
Standard_EXPORT void SetChar (const Standard_Character car);
//! Returns True if this cell has a subcell
Standard_EXPORT Standard_Boolean HasSub() const;
//! Returns subcell
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Sub() const;
//! Returns True if this cell has a next cell
Standard_EXPORT Standard_Boolean HasNext() const;
//! Returns next cell
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Next() const;
//! Defines subcell
Standard_EXPORT void SetSub (const Handle(Dico_DictionaryOfTransient)& acell);
//! Defines next cell
Standard_EXPORT void SetNext (const Handle(Dico_DictionaryOfTransient)& acell);
//! Internal method used to get an entry from a given name
Standard_EXPORT void SearchCell (const Standard_CString name, const Standard_Size lmax, const Standard_Character car, const Standard_Size level, Handle(Dico_DictionaryOfTransient)& acell, Standard_Size& reslev, Standard_Integer& stat) const;
//! Internal method used to create a new entry for a name
Standard_EXPORT void NewCell (const Standard_CString name, const Standard_Size namlen, Handle(Dico_DictionaryOfTransient)& acell, const Standard_Size reslev, const Standard_Integer stat);
//! Returns True if a cell has an associated item value
Standard_EXPORT Standard_Boolean HasIt() const;
//! Returns item value associated to a cell
Standard_EXPORT const Handle(Standard_Transient)& It() const;
//! Returns item address associated to a cell
Standard_EXPORT Handle(Standard_Transient)& ItAdr();
//! Binds an item value to a cell
Standard_EXPORT void SetIt (const Handle(Standard_Transient)& anitem);
//! Declares a cell as Valued : used by NewItem (when an Item
//! is created if it did not exist and is returned)
Standard_EXPORT void DeclIt();
//! Removes item bound to a cell (cancels effect of DeclIt)
Standard_EXPORT void RemoveIt();
//! Returns cell's character as a node feature
Standard_EXPORT Standard_Character CellChar() const;
//! Performs Copy from an original <fromcell> to <me>
//! Called by Copy
Standard_EXPORT void GetCopied (const Handle(Dico_DictionaryOfTransient)& fromcell);
Standard_Character thecars[4];
Handle(Dico_DictionaryOfTransient) thesub;
Handle(Dico_DictionaryOfTransient) thenext;
Handle(Standard_Transient) theitem;
};
#endif // _Dico_DictionaryOfTransient_HeaderFile

View File

@ -1,48 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Standard_Type.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Standard_Transient.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Dico_StackItemOfDictionaryOfTransient.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Handle(Standard_Transient)
#define TheItem_hxx <Standard_Transient.hxx>
#define Dico_Iterator Dico_IteratorOfDictionaryOfTransient
#define Dico_Iterator_hxx <Dico_IteratorOfDictionaryOfTransient.hxx>
#define Dico_StackItem Dico_StackItemOfDictionaryOfTransient
#define Dico_StackItem_hxx <Dico_StackItemOfDictionaryOfTransient.hxx>
#define Handle_Dico_StackItem Handle(Dico_StackItemOfDictionaryOfTransient)
#define Dico_Dictionary Dico_DictionaryOfTransient
#define Dico_Dictionary_hxx <Dico_DictionaryOfTransient.hxx>
#define Handle_Dico_Dictionary Handle(Dico_DictionaryOfTransient)
#include <Dico_Dictionary.gxx>

View File

@ -1,150 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//#include <Dico_Iterator.ixx>
#include <Standard_NoSuchObject.hxx>
Dico_Iterator::Dico_Iterator (const Handle(Dico_Dictionary)& acell)
{
thenb = 0; // Clear initial
thebase = acell; thename.Clear();
Start();
}
Dico_Iterator::Dico_Iterator
(const Handle(Dico_Dictionary)& acell,
const TCollection_AsciiString& basename)
{
thenb = 0; // Clear initial
if (basename.Length() == 0) {
thename.Clear();
thebase = acell;
} else {
thename = basename;
Standard_Integer stat;
Standard_Size reslev;
acell->SearchCell(basename.ToCString(),basename.Length(),basename.Value(1),
1, thebase,reslev,stat);
if (stat != 0 || reslev != 0) thebase.Nullify(); // loupe
}
Start();
}
// Idem, mais avec une CString
Dico_Iterator::Dico_Iterator
(const Handle(Dico_Dictionary)& acell,
const Standard_CString basename)
{
thenb = 0; // Clear initial
if (basename[0] == '\0') {
thename.Clear();
thebase = acell;
} else {
thename.AssignCat(basename);
Standard_Integer stat;
Standard_Size reslev;
acell->SearchCell (basename,thename.Length(),basename[0],1,
thebase,reslev,stat);
if (stat != 0 || reslev != 0) thebase.Nullify(); // loupe
}
Start();
}
void Dico_Iterator::Start ()
{
thenb = 0; thelast.Nullify(); // Clear apres coup
themore = thenext = Standard_False; theinit = Standard_True;
if (thebase.IsNull()) return;
if (thebase->CellChar() == '\0') thebase = thebase->Next(); // 1re fois
if (!thebase.IsNull()) AppendStack(thebase);
}
Standard_Boolean Dico_Iterator::More ()
{
themore = Standard_True;
if (thenb == 0) return Standard_False; // fini
Handle(Dico_Dictionary) acell = thelast->Value();
if (theinit) {
theinit = Standard_False;
if (acell->HasIt()) return Standard_True; // c est bon
}
if (!thenext && acell->HasSub()) {
thenext = Standard_False; theinit = Standard_True;
AppendStack(acell->Sub());
}
else if (acell->HasNext()) { // fin de liste : remonter ...
thenext = Standard_False; theinit = Standard_True;
thelast->SetValue(acell->Next());
} else {
thenext = Standard_True; theinit = Standard_False;
thelast = thelast->Previous(); // Null si pas de Previous ... sinon boum
thenb --;
}
if (thenb == 1 && thename.Length() != 0) { thenb = 0; thelast.Nullify(); }
// ceci pour une sous-racine : ne pas regarder ses suivantes !
return More(); // reevaluation sur cette nouvelle tete de liste
}
void Dico_Iterator::Next ()
{
if (!themore)
More();
themore = Standard_False;
}
const TheItem& Dico_Iterator::Value () const
{
if (thenb == 0) Standard_NoSuchObject::Raise ("DicIter : no current value");
return thelast->Value()->It();
}
TCollection_AsciiString Dico_Iterator::Name () const
{
Standard_Integer nlen = thename.Length();
// On calcule le nom donne par la pile en cours
// if (thenb == 0) return TCollection_AsciiString(); // String vide
TCollection_AsciiString name(thenb,' ');
if (thenb > 0) {
Standard_Integer i = thenb;
Handle(Dico_StackItem) anitem = thelast;
while (!anitem.IsNull()) {
name.SetValue (i,anitem->Value()->CellChar()); // i-1 TString
i --;
anitem = anitem->Previous();
}
}
if (nlen < 2) return name;
TCollection_AsciiString basename(thename);
basename.Remove(nlen);
return basename.Cat(name);
}
// Appele deux fois, mis en commun
void Dico_Iterator::AppendStack (const Handle(Dico_Dictionary)& val)
{
Handle(Dico_StackItem) newlast;
if (thelast.IsNull()) newlast = new Dico_StackItem;
else newlast = new Dico_StackItem(thelast);
thelast = newlast;
thelast->SetValue(val);
thenb ++;
}

View File

@ -1,103 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Dico_IteratorOfDictionaryOfInteger_HeaderFile
#define _Dico_IteratorOfDictionaryOfInteger_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
class Dico_DictionaryOfInteger;
class Dico_StackItemOfDictionaryOfInteger;
class Standard_NoSuchObject;
class TCollection_AsciiString;
class Dico_IteratorOfDictionaryOfInteger
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an iterator which will work on all the dictionary
Standard_EXPORT Dico_IteratorOfDictionaryOfInteger(const Handle(Dico_DictionaryOfInteger)& acell);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
Standard_EXPORT Dico_IteratorOfDictionaryOfInteger(const Handle(Dico_DictionaryOfInteger)& acell, const Standard_CString basename);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
//! Same as above, but basename is String instead of CString
Standard_EXPORT Dico_IteratorOfDictionaryOfInteger(const Handle(Dico_DictionaryOfInteger)& acell, const TCollection_AsciiString& basename);
//! Allows to Start a new Iteration from beginning
Standard_EXPORT void Start();
//! Returns True if there are more entries to return
Standard_EXPORT Standard_Boolean More();
//! Go to the next entry
//! (if there is not, Value will raise an exception)
Standard_EXPORT void Next();
//! Returns item value of current entry
Standard_EXPORT const Standard_Integer& Value() const;
//! Returns name of current entry
Standard_EXPORT TCollection_AsciiString Name() const;
protected:
private:
//! Appends a new value to the Iteration Stack
Standard_EXPORT void AppendStack (const Handle(Dico_DictionaryOfInteger)& val);
Handle(Dico_DictionaryOfInteger) thebase;
TCollection_AsciiString thename;
Handle(Dico_StackItemOfDictionaryOfInteger) thelast;
Standard_Integer thenb;
Standard_Boolean themore;
Standard_Boolean theinit;
Standard_Boolean thenext;
};
#endif // _Dico_IteratorOfDictionaryOfInteger_HeaderFile

View File

@ -1,36 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_StackItemOfDictionaryOfInteger.hxx>
#include <Standard_NoSuchObject.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Standard_Integer
#define TheItem_hxx <Standard_Integer.hxx>
#define Dico_Iterator Dico_IteratorOfDictionaryOfInteger
#define Dico_Iterator_hxx <Dico_IteratorOfDictionaryOfInteger.hxx>
#define Dico_StackItem Dico_StackItemOfDictionaryOfInteger
#define Dico_StackItem_hxx <Dico_StackItemOfDictionaryOfInteger.hxx>
#define Handle_Dico_StackItem Handle(Dico_StackItemOfDictionaryOfInteger)
#define Dico_Dictionary Dico_DictionaryOfInteger
#define Dico_Dictionary_hxx <Dico_DictionaryOfInteger.hxx>
#define Handle_Dico_Dictionary Handle(Dico_DictionaryOfInteger)
#include <Dico_Iterator.gxx>

View File

@ -1,104 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Dico_IteratorOfDictionaryOfTransient_HeaderFile
#define _Dico_IteratorOfDictionaryOfTransient_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
class Dico_DictionaryOfTransient;
class Dico_StackItemOfDictionaryOfTransient;
class Standard_NoSuchObject;
class Standard_Transient;
class TCollection_AsciiString;
class Dico_IteratorOfDictionaryOfTransient
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an iterator which will work on all the dictionary
Standard_EXPORT Dico_IteratorOfDictionaryOfTransient(const Handle(Dico_DictionaryOfTransient)& acell);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
Standard_EXPORT Dico_IteratorOfDictionaryOfTransient(const Handle(Dico_DictionaryOfTransient)& acell, const Standard_CString basename);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
//! Same as above, but basename is String instead of CString
Standard_EXPORT Dico_IteratorOfDictionaryOfTransient(const Handle(Dico_DictionaryOfTransient)& acell, const TCollection_AsciiString& basename);
//! Allows to Start a new Iteration from beginning
Standard_EXPORT void Start();
//! Returns True if there are more entries to return
Standard_EXPORT Standard_Boolean More();
//! Go to the next entry
//! (if there is not, Value will raise an exception)
Standard_EXPORT void Next();
//! Returns item value of current entry
Standard_EXPORT const Handle(Standard_Transient)& Value() const;
//! Returns name of current entry
Standard_EXPORT TCollection_AsciiString Name() const;
protected:
private:
//! Appends a new value to the Iteration Stack
Standard_EXPORT void AppendStack (const Handle(Dico_DictionaryOfTransient)& val);
Handle(Dico_DictionaryOfTransient) thebase;
TCollection_AsciiString thename;
Handle(Dico_StackItemOfDictionaryOfTransient) thelast;
Standard_Integer thenb;
Standard_Boolean themore;
Standard_Boolean theinit;
Standard_Boolean thenext;
};
#endif // _Dico_IteratorOfDictionaryOfTransient_HeaderFile

View File

@ -1,37 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_StackItemOfDictionaryOfTransient.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Handle(Standard_Transient)
#define TheItem_hxx <Standard_Transient.hxx>
#define Dico_Iterator Dico_IteratorOfDictionaryOfTransient
#define Dico_Iterator_hxx <Dico_IteratorOfDictionaryOfTransient.hxx>
#define Dico_StackItem Dico_StackItemOfDictionaryOfTransient
#define Dico_StackItem_hxx <Dico_StackItemOfDictionaryOfTransient.hxx>
#define Handle_Dico_StackItem Handle(Dico_StackItemOfDictionaryOfTransient)
#define Dico_Dictionary Dico_DictionaryOfTransient
#define Dico_Dictionary_hxx <Dico_DictionaryOfTransient.hxx>
#define Handle_Dico_Dictionary Handle(Dico_DictionaryOfTransient)
#include <Dico_Iterator.gxx>

View File

@ -1,31 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//#include <Dico_StackItem.ixx>
Dico_StackItem::Dico_StackItem ()
{ theprev.Nullify(); }
Dico_StackItem::Dico_StackItem (const Handle(Dico_StackItem)& previous)
{ theprev = previous; }
Handle(Dico_StackItem) Dico_StackItem::Previous () const
{ return theprev; }
Handle(Dico_Dictionary) Dico_StackItem::Value () const
{ return thevalue; }
void Dico_StackItem::SetValue (const Handle(Dico_Dictionary)& val)
{ thevalue = val; }

View File

@ -1,79 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Dico_StackItemOfDictionaryOfInteger_HeaderFile
#define _Dico_StackItemOfDictionaryOfInteger_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Integer.hxx>
class Dico_DictionaryOfInteger;
class Dico_IteratorOfDictionaryOfInteger;
class Dico_StackItemOfDictionaryOfInteger;
DEFINE_STANDARD_HANDLE(Dico_StackItemOfDictionaryOfInteger, MMgt_TShared)
class Dico_StackItemOfDictionaryOfInteger : public MMgt_TShared
{
public:
//! Creates a StackItem with no Previous one
Standard_EXPORT Dico_StackItemOfDictionaryOfInteger();
//! Creates a StackItem with a Previous one
Standard_EXPORT Dico_StackItemOfDictionaryOfInteger(const Handle(Dico_StackItemOfDictionaryOfInteger)& previous);
//! Returns the Previous Item (is Null if no Previous defined)
Standard_EXPORT Handle(Dico_StackItemOfDictionaryOfInteger) Previous() const;
//! Returns the Dictionary Cell corresponding to an Item
Standard_EXPORT Handle(Dico_DictionaryOfInteger) Value() const;
//! Sets a new Dictionary Cell as Value of an Item
Standard_EXPORT void SetValue (const Handle(Dico_DictionaryOfInteger)& cval);
DEFINE_STANDARD_RTTI_INLINE(Dico_StackItemOfDictionaryOfInteger,MMgt_TShared)
protected:
private:
Handle(Dico_DictionaryOfInteger) thevalue;
Handle(Dico_StackItemOfDictionaryOfInteger) theprev;
};
#endif // _Dico_StackItemOfDictionaryOfInteger_HeaderFile

View File

@ -1,45 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Dico_StackItemOfDictionaryOfInteger.hxx>
#include <Standard_Type.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_StackItemOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#define TheItem Standard_Integer
#define TheItem_hxx <Standard_Integer.hxx>
#define Dico_Iterator Dico_IteratorOfDictionaryOfInteger
#define Dico_Iterator_hxx <Dico_IteratorOfDictionaryOfInteger.hxx>
#define Dico_StackItem Dico_StackItemOfDictionaryOfInteger
#define Dico_StackItem_hxx <Dico_StackItemOfDictionaryOfInteger.hxx>
#define Handle_Dico_StackItem Handle(Dico_StackItemOfDictionaryOfInteger)
#define Dico_Dictionary Dico_DictionaryOfInteger
#define Dico_Dictionary_hxx <Dico_DictionaryOfInteger.hxx>
#define Handle_Dico_Dictionary Handle(Dico_DictionaryOfInteger)
#include <Dico_StackItem.gxx>

View File

@ -1,79 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Dico_StackItemOfDictionaryOfTransient_HeaderFile
#define _Dico_StackItemOfDictionaryOfTransient_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MMgt_TShared.hxx>
class Dico_DictionaryOfTransient;
class Standard_Transient;
class Dico_IteratorOfDictionaryOfTransient;
class Dico_StackItemOfDictionaryOfTransient;
DEFINE_STANDARD_HANDLE(Dico_StackItemOfDictionaryOfTransient, MMgt_TShared)
class Dico_StackItemOfDictionaryOfTransient : public MMgt_TShared
{
public:
//! Creates a StackItem with no Previous one
Standard_EXPORT Dico_StackItemOfDictionaryOfTransient();
//! Creates a StackItem with a Previous one
Standard_EXPORT Dico_StackItemOfDictionaryOfTransient(const Handle(Dico_StackItemOfDictionaryOfTransient)& previous);
//! Returns the Previous Item (is Null if no Previous defined)
Standard_EXPORT Handle(Dico_StackItemOfDictionaryOfTransient) Previous() const;
//! Returns the Dictionary Cell corresponding to an Item
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Value() const;
//! Sets a new Dictionary Cell as Value of an Item
Standard_EXPORT void SetValue (const Handle(Dico_DictionaryOfTransient)& cval);
DEFINE_STANDARD_RTTI_INLINE(Dico_StackItemOfDictionaryOfTransient,MMgt_TShared)
protected:
private:
Handle(Dico_DictionaryOfTransient) thevalue;
Handle(Dico_StackItemOfDictionaryOfTransient) theprev;
};
#endif // _Dico_StackItemOfDictionaryOfTransient_HeaderFile

View File

@ -1,46 +0,0 @@
// Created on: 1992-07-28
// Created by: Christian CAILLET
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Dico_StackItemOfDictionaryOfTransient.hxx>
#include <Standard_Type.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_StackItemOfDictionaryOfTransient.hxx>
#include <Standard_Transient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#define TheItem Handle(Standard_Transient)
#define TheItem_hxx <Standard_Transient.hxx>
#define Dico_Iterator Dico_IteratorOfDictionaryOfTransient
#define Dico_Iterator_hxx <Dico_IteratorOfDictionaryOfTransient.hxx>
#define Dico_StackItem Dico_StackItemOfDictionaryOfTransient
#define Dico_StackItem_hxx <Dico_StackItemOfDictionaryOfTransient.hxx>
#define Handle_Dico_StackItem Handle(Dico_StackItemOfDictionaryOfTransient)
#define Dico_Dictionary Dico_DictionaryOfTransient
#define Dico_Dictionary_hxx <Dico_DictionaryOfTransient.hxx>
#define Handle_Dico_Dictionary Handle(Dico_DictionaryOfTransient)
#include <Dico_StackItem.gxx>

View File

@ -1,15 +0,0 @@
Dico_Dictionary.gxx
Dico_DictionaryOfInteger.hxx
Dico_DictionaryOfInteger_0.cxx
Dico_DictionaryOfTransient.hxx
Dico_DictionaryOfTransient_0.cxx
Dico_Iterator.gxx
Dico_IteratorOfDictionaryOfInteger.hxx
Dico_IteratorOfDictionaryOfInteger_0.cxx
Dico_IteratorOfDictionaryOfTransient.hxx
Dico_IteratorOfDictionaryOfTransient_0.cxx
Dico_StackItem.gxx
Dico_StackItemOfDictionaryOfInteger.hxx
Dico_StackItemOfDictionaryOfInteger_0.cxx
Dico_StackItemOfDictionaryOfTransient.hxx
Dico_StackItemOfDictionaryOfTransient_0.cxx

View File

@ -12,8 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <IFSelect_Activator.hxx> #include <IFSelect_Activator.hxx>
#include <IFSelect_SessionPilot.hxx> #include <IFSelect_SessionPilot.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
@ -22,10 +20,11 @@
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
#include <TColStd_SequenceOfInteger.hxx> #include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_SequenceOfTransient.hxx> #include <TColStd_SequenceOfTransient.hxx>
#include <NCollection_DataMap.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Activator,MMgt_TShared) IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Activator,MMgt_TShared)
static Handle(Dico_DictionaryOfInteger) thedico; // = new Dico_DictionaryOfInteger; static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thedico;
static TColStd_SequenceOfInteger thenums, themodes; static TColStd_SequenceOfInteger thenums, themodes;
static TColStd_SequenceOfTransient theacts; static TColStd_SequenceOfTransient theacts;
@ -36,16 +35,15 @@ static TColStd_SequenceOfTransient theacts;
const Standard_CString command, const Standard_CString command,
const Standard_Integer mode) const Standard_Integer mode)
{ {
Standard_Boolean deja;
if (thedico.IsNull()) thedico = new Dico_DictionaryOfInteger;
Standard_Integer& num = thedico->NewItem(command,deja,Standard_True);
if (deja) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout<<"**** XSTEP commands, name conflict on "<<command<<" first defined remains ****"<<endl; if (thedico.IsBound(command)) {
cout << "**** XSTEP commands, name conflict on " << command << " first defined remains ****" << endl;
// Standard_DomainError::Raise("IFSelect_Activator : Add"); // Standard_DomainError::Raise("IFSelect_Activator : Add");
#endif
} }
num = thenums.Length() + 1; #endif
thedico.Bind(command, thenums.Length() + 1);
thenums.Append(number); thenums.Append(number);
theacts.Append(actor); theacts.Append(actor);
themodes.Append(mode); themodes.Append(mode);
@ -60,14 +58,14 @@ static TColStd_SequenceOfTransient theacts;
{ Adding (this,number,command,1); } { Adding (this,number,command,1); }
void IFSelect_Activator::Remove (const Standard_CString command) void IFSelect_Activator::Remove (const Standard_CString command)
{ thedico->RemoveItem(command); } { thedico.UnBind(command); }
Standard_Boolean IFSelect_Activator::Select Standard_Boolean IFSelect_Activator::Select
(const Standard_CString command, Standard_Integer& number, (const Standard_CString command, Standard_Integer& number,
Handle(IFSelect_Activator)& actor) Handle(IFSelect_Activator)& actor)
{ {
Standard_Integer num; Standard_Integer num;
if (!thedico->GetItem(command,num,Standard_False)) return Standard_False; if (!thedico.Find(command, num)) return Standard_False;
number = thenums(num); number = thenums(num);
actor = Handle(IFSelect_Activator)::DownCast(theacts(num)); actor = Handle(IFSelect_Activator)::DownCast(theacts(num));
return Standard_True; return Standard_True;
@ -77,7 +75,7 @@ static TColStd_SequenceOfTransient theacts;
(const Standard_CString command) (const Standard_CString command)
{ {
Standard_Integer num; Standard_Integer num;
if (!thedico->GetItem(command,num,Standard_False)) return -1; if (!thedico.Find(command, num)) return -1;
return themodes(num); return themodes(num);
} }
@ -86,18 +84,20 @@ static TColStd_SequenceOfTransient theacts;
(const Standard_Integer mode, const Standard_CString command) (const Standard_Integer mode, const Standard_CString command)
{ {
Standard_Integer num; Standard_Integer num;
Dico_IteratorOfDictionaryOfInteger iter (thedico,command); NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedico);
Handle(TColStd_HSequenceOfAsciiString) list = Handle(TColStd_HSequenceOfAsciiString) list =
new TColStd_HSequenceOfAsciiString(); new TColStd_HSequenceOfAsciiString();
for (iter.Start(); iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
if (!iter.Key().StartsWith(command))
continue;
if (mode < 0) { if (mode < 0) {
DeclareAndCast(IFSelect_Activator,acti,theacts(iter.Value())); DeclareAndCast(IFSelect_Activator,acti,theacts(iter.Value()));
if (acti.IsNull()) continue; if (acti.IsNull()) continue;
if (command[0] == '\0' || !strcmp(command,acti->Group()) ) if (command[0] == '\0' || !strcmp(command,acti->Group()) )
list->Append(iter.Name()); list->Append(iter.Key());
} else { } else {
num = iter.Value(); num = iter.Value();
if (themodes(num) == mode) list->Append(iter.Name()); if (themodes(num) == mode) list->Append(iter.Key());
} }
} }
return list; return list;

View File

@ -12,7 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <IFSelect_EditForm.hxx> #include <IFSelect_EditForm.hxx>
#include <IFSelect_Editor.hxx> #include <IFSelect_Editor.hxx>
#include <IFSelect_ListEditor.hxx> #include <IFSelect_ListEditor.hxx>
@ -33,7 +32,7 @@ IFSelect_Editor::IFSelect_Editor (const Standard_Integer nbval)
: thenbval (nbval) , themaxsh (0) , themaxco (0) , themaxla (0) , : thenbval (nbval) , themaxsh (0) , themaxco (0) , themaxla (0) ,
thevalues (1,nbval) , theshorts (1,nbval) , themodes (1,nbval) , thevalues (1,nbval) , theshorts (1,nbval) , themodes (1,nbval) ,
thelists (1,nbval) thelists (1,nbval)
{ thenames = new Dico_DictionaryOfInteger; thelists.Init(-1); } { thelists.Init(-1); }
void IFSelect_Editor::SetNbValues (const Standard_Integer nbval) void IFSelect_Editor::SetNbValues (const Standard_Integer nbval)
{ {
@ -48,14 +47,14 @@ IFSelect_Editor::IFSelect_Editor (const Standard_Integer nbval)
if (num < 1 || num > thenbval) return; if (num < 1 || num > thenbval) return;
TCollection_AsciiString shn (shortname); TCollection_AsciiString shn (shortname);
Standard_Integer lng = shn.Length(); Standard_Integer lng = shn.Length();
if (lng > 0) thenames->SetItem (shortname,num); if (lng > 0) thenames.Bind (shortname,num);
if (lng > themaxsh) themaxsh = lng; if (lng > themaxsh) themaxsh = lng;
lng = (Standard_Integer) strlen (typval->Name()); lng = (Standard_Integer) strlen (typval->Name());
if (lng > themaxco) themaxco = lng; if (lng > themaxco) themaxco = lng;
lng = (Standard_Integer) strlen (typval->Label()); lng = (Standard_Integer) strlen (typval->Label());
if (lng > themaxla) themaxla = lng; if (lng > themaxla) themaxla = lng;
thenames->SetItem (typval->Name(),num); thenames.Bind (typval->Name(),num);
Standard_Integer edm = (Standard_Integer) editmode; Standard_Integer edm = (Standard_Integer) editmode;
thevalues.SetValue (num,typval); thevalues.SetValue (num,typval);
theshorts.SetValue (num,shn); theshorts.SetValue (num,shn);
@ -187,7 +186,8 @@ Standard_Integer IFSelect_Editor::MaxList (const Standard_Integer num) const
(const Standard_CString name) const (const Standard_CString name) const
{ {
Standard_Integer res; Standard_Integer res;
if (thenames->GetItem(name,res,Standard_False)) return res; if (thenames.Find(name,res))
return res;
res = atoi (name); // si c est un entier, on tente le coup res = atoi (name); // si c est un entier, on tente le coup
if (res < 1 || res > NbValues()) res = 0; if (res < 1 || res > NbValues()) res = 0;
return res; return res;

View File

@ -29,11 +29,11 @@
#include <IFSelect_EditValue.hxx> #include <IFSelect_EditValue.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx> #include <TColStd_HSequenceOfHAsciiString.hxx>
class Dico_DictionaryOfInteger; #include <TCollection_AsciiString.hxx>
#include <NCollection_DataMap.hxx>
class Standard_OutOfRange; class Standard_OutOfRange;
class Interface_TypedValue; class Interface_TypedValue;
class Message_Messenger; class Message_Messenger;
class TCollection_AsciiString;
class IFSelect_EditForm; class IFSelect_EditForm;
class TCollection_HAsciiString; class TCollection_HAsciiString;
class IFSelect_ListEditor; class IFSelect_ListEditor;
@ -182,7 +182,7 @@ private:
Standard_Integer themaxsh; Standard_Integer themaxsh;
Standard_Integer themaxco; Standard_Integer themaxco;
Standard_Integer themaxla; Standard_Integer themaxla;
Handle(Dico_DictionaryOfInteger) thenames; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thenames;
TColStd_Array1OfTransient thevalues; TColStd_Array1OfTransient thevalues;
TColStd_Array1OfAsciiString theshorts; TColStd_Array1OfAsciiString theshorts;
TColStd_Array1OfInteger themodes; TColStd_Array1OfInteger themodes;

View File

@ -12,7 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <IFSelect_BasicDumper.hxx> #include <IFSelect_BasicDumper.hxx>
#include <IFSelect_Dispatch.hxx> #include <IFSelect_Dispatch.hxx>
#include <IFSelect_GeneralModifier.hxx> #include <IFSelect_GeneralModifier.hxx>
@ -183,7 +182,7 @@ static int deja = 0;
char laligne[200]; char laligne[200];
thedone = Standard_True; thedone = Standard_True;
// ... Preparation Specifique // ... Preparation Specifique
thenames.Nullify(); thenames.Clear();
Standard_Integer nbidents = thesess->MaxIdent(); Standard_Integer nbidents = thesess->MaxIdent();
thenums = new TColStd_HArray1OfInteger (0,nbidents); thenums->Init(0); thenums = new TColStd_HArray1OfInteger (0,nbidents); thenums->Init(0);
Standard_Integer i; // svv Jan11 2000 : porting on DEC Standard_Integer i; // svv Jan11 2000 : porting on DEC
@ -423,7 +422,7 @@ static int deja = 0;
thedone = Standard_True; thedone = Standard_True;
// ... Preparation Specifique // ... Preparation Specifique
thenums.Nullify(); thenums.Nullify();
thenames = new Dico_DictionaryOfInteger; thenames.Clear();
// .. Donnees generales, controle // .. Donnees generales, controle
if (!ReadLine()) return 1; if (!ReadLine()) return 1;
if (theline.Length() != 4) { sout<<"File Form Incorrect"<<endl; return 1; } if (theline.Length() != 4) { sout<<"File Form Incorrect"<<endl; return 1; }
@ -751,7 +750,7 @@ static int deja = 0;
} }
else sout<<"Lineno."<<thenl<<" -- Name : "<<name else sout<<"Lineno."<<thenl<<" -- Name : "<<name
<<" : Item could not be defined" << endl; <<" : Item could not be defined" << endl;
thenames->SetItem(name.ToCString(),id); thenames.Bind(name,id);
} }
Standard_Boolean IFSelect_SessionFile::IsDone () const Standard_Boolean IFSelect_SessionFile::IsDone () const
@ -875,7 +874,7 @@ static int deja = 0;
TCollection_AsciiString name = theline.Value(nm); TCollection_AsciiString name = theline.Value(nm);
if (name.Value(1) == ':') name.Remove(1); if (name.Value(1) == ':') name.Remove(1);
if (name.IsEqual("$")) return res; // item non-defini justement if (name.IsEqual("$")) return res; // item non-defini justement
if (!thenames->GetItem(name.ToCString(),id)) { if (!thenames.Find(name, id)) {
sout << " -- Item Unknown in File : " << name sout << " -- Item Unknown in File : " << name
<< " lineno " << thenl << " param." << nm << endl; << " lineno " << thenl << " param." << nm << endl;
id = 0; id = 0;

View File

@ -17,6 +17,7 @@
#ifndef _IFSelect_SessionFile_HeaderFile #ifndef _IFSelect_SessionFile_HeaderFile
#define _IFSelect_SessionFile_HeaderFile #define _IFSelect_SessionFile_HeaderFile
#include <NCollection_DataMap.hxx>
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
@ -28,8 +29,8 @@
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Standard_Character.hxx> #include <Standard_Character.hxx>
class IFSelect_WorkSession; class IFSelect_WorkSession;
class Dico_DictionaryOfInteger;
class TCollection_AsciiString; class TCollection_AsciiString;
class Standard_Transient; class Standard_Transient;
@ -279,7 +280,7 @@ protected:
Handle(IFSelect_WorkSession) thesess; Handle(IFSelect_WorkSession) thesess;
Handle(TColStd_HArray1OfInteger) thenums; Handle(TColStd_HArray1OfInteger) thenums;
Handle(Dico_DictionaryOfInteger) thenames; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thenames;
Standard_Integer thenl; Standard_Integer thenl;
TColStd_SequenceOfAsciiString theline; TColStd_SequenceOfAsciiString theline;

View File

@ -12,10 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <IFSelect_SignatureList.hxx> #include <IFSelect_SignatureList.hxx>
#include <Interface_InterfaceModel.hxx> #include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
@ -35,8 +31,6 @@ IFSelect_SignatureList::IFSelect_SignatureList
thesignonly = Standard_False; thesignonly = Standard_False;
thelistat = withlist; thelistat = withlist;
thenbnuls = 0; thenbnuls = 0;
thedicount = new Dico_DictionaryOfInteger;
thediclist = new Dico_DictionaryOfTransient;
SetName("..."); SetName("...");
} }
@ -51,8 +45,8 @@ IFSelect_SignatureList::IFSelect_SignatureList
{ {
thelastval.Clear(); thelastval.Clear();
thenbnuls = 0; thenbnuls = 0;
thedicount = new Dico_DictionaryOfInteger; thedicount.Clear();
thediclist = new Dico_DictionaryOfTransient; thediclist.Clear();
} }
void IFSelect_SignatureList::Add void IFSelect_SignatureList::Add
@ -66,15 +60,19 @@ IFSelect_SignatureList::IFSelect_SignatureList
if (sign[0] == '\0') { thenbnuls ++; return; } if (sign[0] == '\0') { thenbnuls ++; return; }
Standard_Boolean deja; if (thedicount.Contains(sign))
Standard_Integer& nb = thedicount->NewItem(sign,deja); thedicount.ChangeFromKey(sign)++;
if (!deja) nb = 0; else
nb ++; thedicount.Add(sign, 1);
if (thelistat) { if (thelistat) {
Handle(Standard_Transient)& anitem = thediclist->NewItem(sign,deja); Handle(TColStd_HSequenceOfTransient) alist;
DeclareAndCast(TColStd_HSequenceOfTransient,alist,anitem); if (thediclist.Contains(sign))
if (!deja) { alist = new TColStd_HSequenceOfTransient(); anitem = alist; } alist = Handle(TColStd_HSequenceOfTransient)::DownCast(thediclist.FindFromKey(sign));
else {
alist = new TColStd_HSequenceOfTransient();
thediclist.Add(sign, alist);
}
alist->Append(ent); alist->Append(ent);
} }
} }
@ -84,8 +82,8 @@ IFSelect_SignatureList::IFSelect_SignatureList
void IFSelect_SignatureList::Init void IFSelect_SignatureList::Init
(const Standard_CString name, (const Standard_CString name,
const Handle(Dico_DictionaryOfInteger)& theCount, const NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>& theCount,
const Handle(Dico_DictionaryOfTransient)& list, const NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list,
const Standard_Integer nbnuls) const Standard_Integer nbnuls)
{ {
thelastval.Clear(); thelastval.Clear();
@ -93,7 +91,7 @@ IFSelect_SignatureList::IFSelect_SignatureList
thedicount = theCount; thedicount = theCount;
thediclist = list; thediclist = list;
thenbnuls = nbnuls; thenbnuls = nbnuls;
if (thediclist.IsNull()) thelistat = Standard_False; if (thediclist.IsEmpty()) thelistat = Standard_False;
} }
@ -102,10 +100,12 @@ IFSelect_SignatureList::IFSelect_SignatureList
{ {
Handle(TColStd_HSequenceOfHAsciiString) list = Handle(TColStd_HSequenceOfHAsciiString) list =
new TColStd_HSequenceOfHAsciiString(); new TColStd_HSequenceOfHAsciiString();
Dico_IteratorOfDictionaryOfInteger iter(thedicount,root); NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedicount);
for (; iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
if (!iter.Key().StartsWith(root)) continue;
Handle(TCollection_HAsciiString) sign = Handle(TCollection_HAsciiString) sign =
new TCollection_HAsciiString (iter.Name()); new TCollection_HAsciiString (iter.Key());
list->Append(sign); list->Append(sign);
} }
return list; return list;
@ -121,18 +121,21 @@ IFSelect_SignatureList::IFSelect_SignatureList
Standard_Integer IFSelect_SignatureList::NbTimes Standard_Integer IFSelect_SignatureList::NbTimes
(const Standard_CString sign) const (const Standard_CString sign) const
{ {
Standard_Integer nb; Standard_Integer nb = 0;
if (thedicount->GetItem(sign,nb)) return nb; thedicount.FindFromKey(sign, nb);
else return 0; return nb;
} }
Handle(TColStd_HSequenceOfTransient) IFSelect_SignatureList::Entities Handle(TColStd_HSequenceOfTransient) IFSelect_SignatureList::Entities
(const Standard_CString sign) const (const Standard_CString sign) const
{ {
Handle(TColStd_HSequenceOfTransient) list; Handle(TColStd_HSequenceOfTransient) list;
Handle(Standard_Transient) aTList;
if (!thelistat) return list; if (!thelistat) return list;
if (thediclist->GetItem(sign,list)) return list; if (thediclist.FindFromKey(sign, aTList))
list = new TColStd_HSequenceOfTransient(); list = Handle(TColStd_HSequenceOfTransient)::DownCast(aTList);
else
list = new TColStd_HSequenceOfTransient();
return list; return list;
} }
@ -147,11 +150,11 @@ IFSelect_SignatureList::IFSelect_SignatureList
void IFSelect_SignatureList::PrintCount (const Handle(Message_Messenger)& S) const void IFSelect_SignatureList::PrintCount (const Handle(Message_Messenger)& S) const
{ {
Standard_Integer nbtot = 0, nbsign = 0; Standard_Integer nbtot = 0, nbsign = 0;
Dico_IteratorOfDictionaryOfInteger iter(thedicount,""); NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedicount);
S << " Count "<<thename->ToCString()<<"\n ----- -----------"<<endl; S << " Count "<<thename->ToCString()<<"\n ----- -----------"<<endl;
for (; iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
Standard_Integer val = iter.Value(); Standard_Integer val = iter.Value();
S << Interface_MSG::Blanks(val,6) << val <<" "<<iter.Name()<<endl; S << Interface_MSG::Blanks(val,6) << val <<" "<<iter.Key()<<endl;
nbtot += val; nbtot += val;
nbsign ++; nbsign ++;
} }
@ -172,10 +175,10 @@ IFSelect_SignatureList::IFSelect_SignatureList
return; return;
} }
Standard_Integer nbtot = 0, nbsign = 0; Standard_Integer nbtot = 0, nbsign = 0;
Dico_IteratorOfDictionaryOfTransient iter(thediclist,""); NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(thediclist);
for (; iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
DeclareAndCast(TColStd_HSequenceOfTransient,list,iter.Value()); DeclareAndCast(TColStd_HSequenceOfTransient,list,iter.Value());
S<<Name()<<" : "<<iter.Name()<<endl; S<<Name()<<" : "<<iter.Key()<<endl;
if (list.IsNull()) { S<<" - (empty list)"<<endl; continue; } if (list.IsNull()) { S<<" - (empty list)"<<endl; continue; }
Standard_Integer nb = list->Length(); Standard_Integer nb = list->Length();
S<<" - Nb: "<<nb<<" : "; S<<" - Nb: "<<nb<<" : ";
@ -202,7 +205,7 @@ IFSelect_SignatureList::IFSelect_SignatureList
void IFSelect_SignatureList::PrintSum (const Handle(Message_Messenger)& S) const void IFSelect_SignatureList::PrintSum (const Handle(Message_Messenger)& S) const
{ {
Dico_IteratorOfDictionaryOfInteger iter(thedicount,""); NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedicount);
S << " Summary "<<thename->ToCString()<<"\n ----- -----------"<<endl; S << " Summary "<<thename->ToCString()<<"\n ----- -----------"<<endl;
Standard_Integer nbtot = 0, nbsign = 0, maxent = 0, nbval = 0, nbve = 0, minval = 0, maxval = 0, totval = 0; Standard_Integer nbtot = 0, nbsign = 0, maxent = 0, nbval = 0, nbve = 0, minval = 0, maxval = 0, totval = 0;
for (; iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
@ -210,7 +213,7 @@ IFSelect_SignatureList::IFSelect_SignatureList
nbtot += nbent; nbtot += nbent;
nbsign ++; nbsign ++;
if (nbent > maxent) maxent = nbent; if (nbent > maxent) maxent = nbent;
TCollection_AsciiString name = iter.Name(); TCollection_AsciiString name = iter.Key();
// if (!name.IsIntegerValue()) continue; pas bien fiable // if (!name.IsIntegerValue()) continue; pas bien fiable
Standard_Integer ic, nc = name.Length(); Standard_Integer ic, nc = name.Length();
Standard_Boolean iaint = Standard_True; Standard_Boolean iaint = Standard_True;

View File

@ -28,10 +28,9 @@
#include <TColStd_HSequenceOfHAsciiString.hxx> #include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx> #include <TColStd_HSequenceOfTransient.hxx>
#include <IFSelect_PrintCount.hxx> #include <IFSelect_PrintCount.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_IndexedDataMap.hxx>
class TCollection_HAsciiString; class TCollection_HAsciiString;
class Dico_DictionaryOfInteger;
class Dico_DictionaryOfTransient;
class Standard_Transient;
class Message_Messenger; class Message_Messenger;
class Interface_InterfaceModel; class Interface_InterfaceModel;
@ -85,7 +84,7 @@ public:
Standard_EXPORT Standard_CString LastValue() const; Standard_EXPORT Standard_CString LastValue() const;
//! Aknowledges the list in once. Name identifies the Signature //! Aknowledges the list in once. Name identifies the Signature
Standard_EXPORT void Init (const Standard_CString name, const Handle(Dico_DictionaryOfInteger)& count, const Handle(Dico_DictionaryOfTransient)& list, const Standard_Integer nbnuls); Standard_EXPORT void Init (const Standard_CString name, const NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>& count, const NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list, const Standard_Integer nbnuls);
//! Returns the list of signatures, as a sequence of strings //! Returns the list of signatures, as a sequence of strings
//! (but without their respective counts). It is ordered. //! (but without their respective counts). It is ordered.
@ -156,8 +155,8 @@ private:
Standard_Integer thenbnuls; Standard_Integer thenbnuls;
Handle(TCollection_HAsciiString) thename; Handle(TCollection_HAsciiString) thename;
TCollection_AsciiString thelastval; TCollection_AsciiString thelastval;
Handle(Dico_DictionaryOfInteger) thedicount; NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer> thedicount;
Handle(Dico_DictionaryOfTransient) thediclist; NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)> thediclist;
}; };

View File

@ -14,9 +14,6 @@
//#1 svv 10.01.00 : porting on DEC //#1 svv 10.01.00 : porting on DEC
//smh#14 17.03.2000 : FRA62479 Clearing of gtool //smh#14 17.03.2000 : FRA62479 Clearing of gtool
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <IFGraph_SubPartsIterator.hxx> #include <IFGraph_SubPartsIterator.hxx>
#include <IFSelect_CheckCounter.hxx> #include <IFSelect_CheckCounter.hxx>
#include <IFSelect_Dispatch.hxx> #include <IFSelect_Dispatch.hxx>
@ -109,7 +106,6 @@ IFSelect_WorkSession::IFSelect_WorkSession ()
{ {
theshareout = new IFSelect_ShareOut; theshareout = new IFSelect_ShareOut;
theerrhand = errhand = Standard_True; theerrhand = errhand = Standard_True;
thenames = new Dico_DictionaryOfTransient;
thecopier = new IFSelect_ModelCopier; thecopier = new IFSelect_ModelCopier;
thecopier->SetShareOut (theshareout); thecopier->SetShareOut (theshareout);
thecheckdone = Standard_False; thecheckdone = Standard_False;
@ -150,8 +146,8 @@ void IFSelect_WorkSession::SetProtocol
void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype) void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype)
{ {
thegtool->SetSignType (signtype); thegtool->SetSignType (signtype);
if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type"); if (signtype.IsNull()) thenames.UnBind("xst-sign-type");
else thenames->SetItem ("xst-sign-type",signtype); else thenames.Bind("xst-sign-type",signtype);
} }
@ -678,7 +674,8 @@ Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
Standard_Integer id = atoi( &name[1] ); Standard_Integer id = atoi( &name[1] );
return Item(id); return Item(id);
} }
if (!thenames->GetItem(name,res)) res.Nullify(); if (!thenames.Find(name,res))
res.Nullify();
return res; return res;
} }
@ -711,7 +708,8 @@ Standard_Integer IFSelect_WorkSession::NameIdent
Standard_Integer id = atoi( &name[1] ); Standard_Integer id = atoi( &name[1] );
return id; return id;
} }
if (!thenames->GetItem(name,res)) return 0; if (!thenames.Find(name,res))
return 0;
return ItemIdent(res); return ItemIdent(res);
} }
@ -786,12 +784,9 @@ Standard_Integer IFSelect_WorkSession::AddNamedItem
if (name[0] == '#' || name[0] == '!') return 0; if (name[0] == '#' || name[0] == '!') return 0;
// #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom) // #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom)
// nom deja pris : on ecrase l ancienne valeur // nom deja pris : on ecrase l ancienne valeur
if (name[0] != '\0') { if (name[0] != '\0')
Standard_Boolean deja; thenames.Bind(name, item);
Handle(Standard_Transient)& newitem = thenames->NewItem(name,deja);
// if (deja & item != newitem) return 0;
newitem = item;
}
Standard_Integer id = theitems.FindIndex(item); Standard_Integer id = theitems.FindIndex(item);
if (id > 0) { if (id > 0) {
Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id); Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
@ -865,7 +860,7 @@ Standard_Boolean IFSelect_WorkSession::RemoveName
Handle(Standard_Transient) item = NamedItem(name); Handle(Standard_Transient) item = NamedItem(name);
if (item.IsNull()) return Standard_False; if (item.IsNull()) return Standard_False;
theitems.Add(item,item); // reste mais sans nom theitems.Add(item,item); // reste mais sans nom
return thenames->RemoveItem(name); return thenames.UnBind(name);
} }
@ -888,7 +883,7 @@ Standard_Boolean IFSelect_WorkSession::RemoveItem
// Marquer "Removed" dans la Map (on ne peut pas la vider) // Marquer "Removed" dans la Map (on ne peut pas la vider)
if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) { if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) {
if (!thenames->RemoveItem if (!thenames.UnBind
(GetCasted(TCollection_HAsciiString,att)->ToCString())) (GetCasted(TCollection_HAsciiString,att)->ToCString()))
return Standard_False; return Standard_False;
} }
@ -905,7 +900,7 @@ Standard_Boolean IFSelect_WorkSession::RemoveItem
void IFSelect_WorkSession::ClearItems () void IFSelect_WorkSession::ClearItems ()
{ {
thenames->Clear(); thenames.Clear();
theitems.Clear(); theitems.Clear();
theshareout->Clear(Standard_False); theshareout->Clear(Standard_False);
} }
@ -1018,9 +1013,10 @@ Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNames
{ {
Handle(TColStd_HSequenceOfHAsciiString) list = Handle(TColStd_HSequenceOfHAsciiString) list =
new TColStd_HSequenceOfHAsciiString(); new TColStd_HSequenceOfHAsciiString();
for (Dico_IteratorOfDictionaryOfTransient IT(thenames); IT.More(); IT.Next()){ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator IT(thenames);
for (; IT.More(); IT.Next()){
if (IT.Value()->IsKind(type)) list->Append if (IT.Value()->IsKind(type)) list->Append
(new TCollection_HAsciiString(IT.Name().ToCString())); (new TCollection_HAsciiString(IT.Key()));
} }
return list; return list;
} }

View File

@ -26,33 +26,34 @@
#include <TColStd_IndexedDataMapOfTransientTransient.hxx> #include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <MMgt_TShared.hxx> #include <MMgt_TShared.hxx>
#include <NCollection_Vector.hxx> #include <NCollection_Vector.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <IFSelect_ReturnStatus.hxx> #include <IFSelect_ReturnStatus.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <TColStd_HSequenceOfTransient.hxx> #include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HSequenceOfInteger.hxx> #include <TColStd_HSequenceOfInteger.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx> #include <TColStd_HSequenceOfHAsciiString.hxx>
#include <IFSelect_RemainMode.hxx> #include <IFSelect_RemainMode.hxx>
#include <TColStd_SequenceOfTransient.hxx> #include <TColStd_SequenceOfTransient.hxx>
#include <TColStd_SequenceOfInteger.hxx> #include <TColStd_SequenceOfInteger.hxx>
#include <IFSelect_PrintCount.hxx> #include <IFSelect_PrintCount.hxx>
#include <TCollection_AsciiString.hxx>
class IFSelect_ShareOut; class IFSelect_ShareOut;
class IFSelect_WorkLibrary; class IFSelect_WorkLibrary;
class Interface_Protocol; class Interface_Protocol;
class Interface_InterfaceModel; class Interface_InterfaceModel;
class Interface_HGraph; class Interface_HGraph;
class Interface_GTool; class Interface_GTool;
class Dico_DictionaryOfTransient;
class IFSelect_ModelCopier; class IFSelect_ModelCopier;
class Standard_DomainError; class Standard_DomainError;
class IFSelect_Signature; class IFSelect_Signature;
class Standard_Transient;
class TCollection_HAsciiString; class TCollection_HAsciiString;
class Interface_Graph; class Interface_Graph;
class Interface_CheckIterator; class Interface_CheckIterator;
class IFSelect_IntParam; class IFSelect_IntParam;
class TCollection_AsciiString;
class IFSelect_Selection; class IFSelect_Selection;
class Interface_EntityIterator; class Interface_EntityIterator;
class IFSelect_SelectionIterator; class IFSelect_SelectionIterator;
@ -1094,7 +1095,7 @@ public:
Handle(Interface_HGraph) thegraph; Handle(Interface_HGraph) thegraph;
Interface_CheckIterator thecheckrun; Interface_CheckIterator thecheckrun;
TColStd_IndexedDataMapOfTransientTransient theitems; TColStd_IndexedDataMapOfTransientTransient theitems;
Handle(Dico_DictionaryOfTransient) thenames; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thenames;
private: private:

View File

@ -15,10 +15,6 @@
//abv 10.04.99 S4136: eliminate using BRepAPI::Precision() //abv 10.04.99 S4136: eliminate using BRepAPI::Precision()
#include <BRepLib.hxx> #include <BRepLib.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <IFSelect_CheckCounter.hxx> #include <IFSelect_CheckCounter.hxx>
#include <IFSelect_Functions.hxx> #include <IFSelect_Functions.hxx>
#include <IGESControl_Controller.hxx> #include <IGESControl_Controller.hxx>
@ -35,6 +31,7 @@
#include <Interface_Static.hxx> #include <Interface_Static.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>
#include <Message_Msg.hxx> #include <Message_Msg.hxx>
#include <NCollection_DataMap.hxx>
#include <OSD_Timer.hxx> #include <OSD_Timer.hxx>
#include <ShapeExtend_Explorer.hxx> #include <ShapeExtend_Explorer.hxx>
#include <ShapeFix_ShapeTolerance.hxx> #include <ShapeFix_ShapeTolerance.hxx>
@ -151,39 +148,39 @@ void IGESControl_Reader::PrintTransferInfo
nbRoots = TP->NbRoots(); nbRoots = TP->NbRoots();
//nbResults = TP->NbMapped(); //nbResults = TP->NbMapped();
Transfer_IteratorOfProcessForTransient iterTrans = TP->RootResult(Standard_True); Transfer_IteratorOfProcessForTransient iterTrans = TP->RootResult(Standard_True);
Handle(Dico_DictionaryOfInteger) dicoCountResult = new Dico_DictionaryOfInteger; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> aMapCountResult;
Handle(Dico_DictionaryOfInteger) dicoCountMapping = new Dico_DictionaryOfInteger; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> aMapCountMapping;
for (iterTrans.Start(); iterTrans.More() ; iterTrans.Next() ) { for (iterTrans.Start(); iterTrans.More() ; iterTrans.Next() ) {
nbResults++; nbResults++;
// Init for dicoCountResult for IFSelect_ResultCount // Init for dicoCountResult for IFSelect_ResultCount
if ( mode == IFSelect_ResultCount ) { if ( mode == IFSelect_ResultCount ) {
char mess[300]; char mess[300];
const Handle(Transfer_Binder) aBinder = iterTrans.Value(); const Handle(Transfer_Binder) aBinder = iterTrans.Value();
sprintf(mess,"\t%s",aBinder->ResultTypeName()); sprintf(mess,"\t%s",aBinder->ResultTypeName());
Standard_Boolean deja; if (aMapCountResult.IsBound(mess))
Standard_Integer& nb = dicoCountResult->NewItem(mess,deja); aMapCountResult.ChangeFind(mess)++;
if (!deja) nb = 0; else
nb ++; aMapCountResult.Bind(mess,1);
} }
// Init for dicoCountMapping for IFSelect_Mapping // Init for dicoCountMapping for IFSelect_Mapping
else if ( mode == IFSelect_Mapping ) { else if ( mode == IFSelect_Mapping ) {
char mess[300]; char mess[300];
const Handle(Transfer_Binder) aBinder = iterTrans.Value(); const Handle(Transfer_Binder) aBinder = iterTrans.Value();
DeclareAndCast(IGESData_IGESEntity,igesEnt,iterTrans.Starting()); DeclareAndCast(IGESData_IGESEntity,igesEnt,iterTrans.Starting());
sprintf(mess,"%d\t%d\t%s\t%s", igesEnt->TypeNumber(), igesEnt->FormNumber(), sprintf(mess,"%d\t%d\t%s\t%s", igesEnt->TypeNumber(), igesEnt->FormNumber(),
"%d", aBinder->ResultTypeName()); "%d", aBinder->ResultTypeName());
//cout << mess << endl; //cout << mess << endl;
Standard_Boolean deja; if (aMapCountMapping.IsBound(mess))
Standard_Integer& nb = dicoCountMapping->NewItem(mess,deja); aMapCountMapping.ChangeFind(mess)++;
if (!deja) nb = 0; else
nb ++; aMapCountMapping.Bind(mess, 1);
} }
} }
Interface_CheckIterator checkIterator = TP->CheckList(Standard_False); Interface_CheckIterator checkIterator = TP->CheckList(Standard_False);
Handle(Dico_DictionaryOfInteger) dicoCount = new Dico_DictionaryOfInteger; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> aMapCount;
Handle(Dico_DictionaryOfTransient) dicoList = new Dico_DictionaryOfTransient; NCollection_DataMap<TCollection_AsciiString, Handle(TColStd_HSequenceOfInteger)> aMapList;
// Init the dicoCount dicoList and nbWarn ,nb Fail. // Init the dicoCount dicoList and nbWarn ,nb Fail.
for(checkIterator.Start(); checkIterator.More(); checkIterator.Next() ) { for(checkIterator.Start(); checkIterator.More(); checkIterator.Next() ) {
char mess[300]; char mess[300];
@ -193,27 +190,36 @@ void IGESControl_Reader::PrintTransferInfo
Standard_Integer type = igesEnt->TypeNumber(), form = igesEnt->FormNumber(); Standard_Integer type = igesEnt->TypeNumber(), form = igesEnt->FormNumber();
Standard_Integer nw = aCheck->NbWarnings(), nf = aCheck->NbFails(), i; Standard_Integer nw = aCheck->NbWarnings(), nf = aCheck->NbFails(), i;
for(i = 1; (failsonly==IFSelect_FailAndWarn) && (i<= nw); i++) { for(i = 1; (failsonly==IFSelect_FailAndWarn) && (i<= nw); i++) {
sprintf(mess,"\t W\t%d\t%d\t%s",type,form,aCheck->CWarning(i)); sprintf(mess,"\t W\t%d\t%d\t%s",type,form,aCheck->CWarning(i));
Standard_Boolean deja; if (aMapCount.IsBound(mess))
Standard_Integer& nb = dicoCount->NewItem(mess,deja); aMapCount.ChangeFind(mess)++;
if (!deja) nb = 0; else
nb ++; aMapCount.Bind(mess, 1);
Handle(Standard_Transient)& anitem = dicoList->NewItem(mess,deja);
DeclareAndCast(TColStd_HSequenceOfInteger,alist,anitem); Handle(TColStd_HSequenceOfInteger) alist;
if (!deja) { alist = new TColStd_HSequenceOfInteger(); anitem = alist; } if (aMapList.IsBound(mess))
alist->Append(model->Number(igesEnt)*2-1); alist = aMapList.ChangeFind(mess);
else {
alist = new TColStd_HSequenceOfInteger();
aMapList.Bind(mess, alist);
}
alist->Append(model->Number(igesEnt)*2-1);
} }
for(i = 1; i<= nf; i++) { for(i = 1; i<= nf; i++) {
sprintf(mess,"\t F\t%d\t%d\t%s",type,form,aCheck->CFail(i)); sprintf(mess,"\t F\t%d\t%d\t%s",type,form,aCheck->CFail(i));
// TF << mess << endl; // TF << mess << endl;
Standard_Boolean deja; if (aMapCount.IsBound(mess))
Standard_Integer& nb = dicoCount->NewItem(mess,deja); aMapCount.ChangeFind(mess)++;
if (!deja) nb = 0; else
nb ++; aMapCount.Bind(mess, 1);
Handle(Standard_Transient)& anitem = dicoList->NewItem(mess,deja); Handle(TColStd_HSequenceOfInteger) alist;
DeclareAndCast(TColStd_HSequenceOfInteger,alist,anitem); if (aMapList.IsBound(mess))
if (!deja) { alist = new TColStd_HSequenceOfInteger(); anitem = alist; } alist = aMapList.ChangeFind(mess);
alist->Append(model->Number(igesEnt)*2-1); else {
alist = new TColStd_HSequenceOfInteger();
aMapList.Bind(mess, alist);
}
alist->Append(model->Number(igesEnt)*2-1);
} }
nbWarn += nw; nbWarn += nw;
nbFail += nf; nbFail += nf;
@ -235,33 +241,32 @@ void IGESControl_Reader::PrintTransferInfo
case IFSelect_ListByItem : { case IFSelect_ListByItem : {
Message_Msg msg3030("IGES_3030"); Message_Msg msg3030("IGES_3030");
TF->Send(msg3030, Message_Info); TF->Send(msg3030, Message_Info);
Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCount); NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator aMapCountIter(aMapCount);
Dico_IteratorOfDictionaryOfTransient dicoListIter(dicoList); NCollection_DataMap<TCollection_AsciiString, Handle(TColStd_HSequenceOfInteger)>::Iterator aMapListIter(aMapList);
for(dicoCountIter.Start(),dicoListIter.Start(); for(; aMapCountIter.More() && aMapListIter.More();
dicoCountIter.More() && dicoListIter.More(); aMapCountIter.Next(), aMapListIter.Next()) {
dicoCountIter.Next(),dicoListIter.Next()) { TF << aMapCountIter.Value() << aMapCountIter.Key() << endl;
TF << dicoCountIter.Value() << dicoCountIter.Name() << endl; if (mode == IFSelect_ListByItem) {
if (mode == IFSelect_ListByItem) { Handle(TColStd_HSequenceOfInteger) entityList = aMapListIter.Value();
DeclareAndCast(TColStd_HSequenceOfInteger, entityList, dicoListIter.Value()); Standard_Integer length = entityList->Length();
Standard_Integer length = entityList->Length(); Message_Msg msg3035("IGES_3035");
Message_Msg msg3035("IGES_3035"); TF->Send(msg3035, Message_Info);
TF->Send(msg3035, Message_Info); char line[80];
char line[80]; sprintf(line, "\t\t\t");
sprintf(line,"\t\t\t"); TF << line;
TF << line ; Standard_Integer nbInLine = 0;
Standard_Integer nbInLine =0; for (Standard_Integer i = 1; i <= length; i++) {
for(Standard_Integer i = 1; i <= length ; i++ ) { // IDT_Out << (entityList->Value(i)) << " ";
// IDT_Out << (entityList->Value(i)) << " "; sprintf(line, "\t %d", entityList->Value(i));
sprintf(line,"\t %d", entityList->Value(i)); TF << line;
TF << line ; if (++nbInLine == 6) {
if (++nbInLine == 6) { nbInLine = 0;
nbInLine = 0; sprintf(line, "\n\t\t\t");
sprintf(line,"\n\t\t\t"); TF << line;
TF << line ; }
} }
} TF << endl;
TF << endl ; }
}
} }
break; break;
} }
@ -270,9 +275,11 @@ void IGESControl_Reader::PrintTransferInfo
Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info); Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info); Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
Message_Msg msg3045("IGES_3045");TF->Send(msg3045, Message_Info); Message_Msg msg3045("IGES_3045");TF->Send(msg3045, Message_Info);
Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCountResult);
for(dicoCountIter.Start(); dicoCountIter.More(); dicoCountIter.Next()) { NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator aMapIter(aMapCountResult);
TF << dicoCountIter.Value() << dicoCountIter.Name() << endl; for (; aMapIter.More(); aMapIter.Next())
{
TF << aMapIter.Key() << aMapIter.Value() << endl;
} }
break; break;
} }
@ -283,26 +290,26 @@ void IGESControl_Reader::PrintTransferInfo
Message_Msg msg3045("IGES_3055");TF->Send(msg3045, Message_Info); Message_Msg msg3045("IGES_3055");TF->Send(msg3045, Message_Info);
// Add failed entities in dicoCountMapping // Add failed entities in dicoCountMapping
if (nbRoots!=nbResults) { if (nbRoots!=nbResults) {
for( Standard_Integer i = 1; i <= nbRoots ; i++) { for (Standard_Integer i = 1; i <= nbRoots; i++) {
DeclareAndCast(IGESData_IGESEntity, root, TP->Root(i)); DeclareAndCast(IGESData_IGESEntity, root, TP->Root(i));
if (!TP->IsBound(root)) { if (!TP->IsBound(root)) {
char mess[300]; char mess[300];
sprintf(mess,"%d\t%d \t%s\t%s", root->TypeNumber(), root->FormNumber(), sprintf(mess, "%d\t%d \t%s\t%s", root->TypeNumber(), root->FormNumber(),
"%d", "Failed"); "%d", "Failed");
//cout << mess << endl; //cout << mess << endl;
Standard_Boolean deja; if (aMapCountMapping.IsBound(mess))
Standard_Integer& nb = dicoCountMapping->NewItem(mess,deja); aMapCountMapping.ChangeFind(mess)++;
if (!deja) nb = 0; else
nb ++; aMapCountMapping.Bind(mess, 1);
} }
} }
} }
Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCountMapping); NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator aMapCountIter(aMapCountMapping);
for(dicoCountIter.Start(); dicoCountIter.More(); dicoCountIter.Next()) { for(; aMapCountIter.More(); aMapCountIter.Next()) {
char mess[80]; char mess[80];
sprintf(mess, dicoCountIter.Name().ToCString() , dicoCountIter.Value()); sprintf(mess, aMapCountIter.Key().ToCString(), aMapCountIter.Value());
TF << mess << endl; //dicoCountIter.Value() << dicoCountIter.Name() << endl; TF << mess << endl; //dicoCountIter.Value() << dicoCountIter.Name() << endl;
} }
break; break;
} }

View File

@ -12,7 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <IGESData_IGESEntity.hxx> #include <IGESData_IGESEntity.hxx>
#include <IGESGraph_DefinitionLevel.hxx> #include <IGESGraph_DefinitionLevel.hxx>
#include <IGESSelect_CounterOfLevelNumber.hxx> #include <IGESSelect_CounterOfLevelNumber.hxx>

View File

@ -16,8 +16,6 @@
//svv#2 21.02.00 : porting on SIL //svv#2 21.02.00 : porting on SIL
//smh#14 17.03.2000 : FRA62479 Clearing of gtool. //smh#14 17.03.2000 : FRA62479 Clearing of gtool.
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Interface_Check.hxx> #include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx> #include <Interface_CheckIterator.hxx>
#include <Interface_EntityIterator.hxx> #include <Interface_EntityIterator.hxx>
@ -39,7 +37,7 @@
#include <TColStd_Array1OfTransient.hxx> #include <TColStd_Array1OfTransient.hxx>
#include <TColStd_DataMapIteratorOfDataMapOfIntegerTransient.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 // 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 // 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 // performantes, de fournir un identifieur numerique
// Il est a meme d`etre utilise dans des traitements de Graphe // Il est a meme d`etre utilise dans des traitements de Graphe
// STATICS : les TEMPLATES // STATICS : les TEMPLATES
static const Handle(Dico_DictionaryOfTransient)& templates() static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> atemp;
{
static Handle(Dico_DictionaryOfTransient) atemp;
if (atemp.IsNull()) atemp = new Dico_DictionaryOfTransient;
return atemp;
}
static const Handle(Standard_Type)& typerep() static const Handle(Standard_Type)& typerep()
{ {
@ -1004,7 +996,7 @@ Standard_Integer Interface_InterfaceModel::NextNumberForLabel
Standard_Boolean Interface_InterfaceModel::HasTemplate Standard_Boolean Interface_InterfaceModel::HasTemplate
(const Standard_CString name) (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; Handle(Interface_InterfaceModel) model,newmod;
if (!HasTemplate(name)) return model; 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 = model->NewEmptyModel();
newmod->GetFromAnother (model); newmod->GetFromAnother (model);
return newmod; return newmod;
@ -1033,10 +1025,7 @@ Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
Standard_Boolean Interface_InterfaceModel::SetTemplate Standard_Boolean Interface_InterfaceModel::SetTemplate
(const Standard_CString name, const Handle(Interface_InterfaceModel)& model) (const Standard_CString name, const Handle(Interface_InterfaceModel)& model)
{ {
Standard_Boolean deja; return atemp.Bind(name, model);
Handle(Standard_Transient)& newmod = templates()->NewItem(name,deja);
newmod = model;
return deja;
} }
@ -1049,10 +1038,10 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates
{ {
Handle(TColStd_HSequenceOfHAsciiString) list = new Handle(TColStd_HSequenceOfHAsciiString) list = new
TColStd_HSequenceOfHAsciiString(); TColStd_HSequenceOfHAsciiString();
if (templates().IsNull()) return list; if (atemp.IsEmpty()) return list;
for (Dico_IteratorOfDictionaryOfTransient iter(templates()); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(atemp);
iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
list->Append (new TCollection_HAsciiString (iter.Name()) ); list->Append (new TCollection_HAsciiString (iter.Key()) );
} }
return list; return list;
} }

View File

@ -12,11 +12,8 @@
// commercial license or contractual agreement. // 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 <Interface_MSG.hxx>
#include <NCollection_DataMap.hxx>
#include <OSD_Process.hxx> #include <OSD_Process.hxx>
#include <Quantity_Date.hxx> #include <Quantity_Date.hxx>
#include <Standard_DomainError.hxx> #include <Standard_DomainError.hxx>
@ -25,8 +22,8 @@
#include <TColStd_HSequenceOfHAsciiString.hxx> #include <TColStd_HSequenceOfHAsciiString.hxx>
#include <stdio.h> #include <stdio.h>
static Handle(Dico_DictionaryOfTransient) thedic; static NCollection_DataMap<TCollection_AsciiString, Handle(TCollection_HAsciiString)> thedic;
static Handle(Dico_DictionaryOfInteger) thelist; static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thelist;
static Handle(TColStd_HSequenceOfHAsciiString) thedup; static Handle(TColStd_HSequenceOfHAsciiString) thedup;
static Standard_Boolean theprint = Standard_True; static Standard_Boolean theprint = Standard_True;
static Standard_Boolean therec = Standard_False; 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_OStream& S, const Standard_CString rootkey)
{ {
Standard_Integer nb = 0; Standard_Integer nb = 0;
if (thedic.IsNull()) return nb; if (thedic.IsEmpty()) return nb;
if (rootkey[0] != '\0') S<<"@@ ROOT:"<<rootkey<<endl; if (rootkey[0] != '\0') S<<"@@ ROOT:"<<rootkey<<endl;
Dico_IteratorOfDictionaryOfTransient iter (thedic,rootkey); NCollection_DataMap<TCollection_AsciiString, Handle(TCollection_HAsciiString)>::Iterator iter(thedic);
for (iter.Start(); iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
S<<"@"<<iter.Name()<<"\n"; if (!iter.Key().StartsWith(rootkey)) continue;
Handle(TCollection_HAsciiString) str = S<<"@"<<iter.Key()<<"\n";
Handle(TCollection_HAsciiString)::DownCast(iter.Value()); const Handle(TCollection_HAsciiString) str = iter.Value();
if (str.IsNull()) continue; if (str.IsNull()) continue;
nb ++; nb ++;
S<<str->ToCString()<<"\n"; 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) Standard_CString Interface_MSG::Translated (const Standard_CString key)
{ {
if (!therun) return key; if (!therun) return key;
if (!thedic.IsNull()) { if (!thedic.IsEmpty()) {
Handle(TCollection_HAsciiString) str; 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 (theprint) cout<<" ** Interface_MSG:Translate ?? "<<key<<" **"<<endl;
if (therec) { if (therec) {
Standard_Boolean deja; if (thelist.IsBound(key)) {
if (thelist.IsNull()) thelist = new Dico_DictionaryOfInteger; thelist.ChangeFind(key)++;
Standard_Integer& nb = thelist->NewItem (key,deja); } else
if (!deja) nb = 0; nb ++; thelist.Bind(key, 1);
} }
if (theraise) Standard_DomainError::Raise ("Interface_MSG : Translate"); if (theraise) Standard_DomainError::Raise ("Interface_MSG : Translate");
return key; return key;
@ -200,15 +198,16 @@ Standard_CString Interface_MSG::Translated (const Standard_CString key)
void Interface_MSG::Record 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(TCollection_HAsciiString) dup;
Handle(Standard_Transient)& res = thedic->NewItem (key,deja); Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString(item);
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (item); if (thedic.IsBound(key)) {
res = str; thedic.ChangeFind(key) = str;
if (!deja) return; } else {
thedic.Bind(key,str);
return;
}
if (theprint) cout<<" ** Interface_MSG:Record ?? "<<key<<" ** "<<item<<" **"<<endl; if (theprint) cout<<" ** Interface_MSG:Record ?? "<<key<<" ** "<<item<<" **"<<endl;
if (therec) { if (therec) {
if (thedup.IsNull()) thedup = new TColStd_HSequenceOfHAsciiString(); if (thedup.IsNull()) thedup = new TColStd_HSequenceOfHAsciiString();
@ -248,10 +247,10 @@ void Interface_MSG::PrintTrace (Standard_OStream& S)
S<<" ** "<<dup->ToCString()<<endl; S<<" ** "<<dup->ToCString()<<endl;
} }
if (thelist.IsNull()) return; if (thelist.IsEmpty()) return;
Dico_IteratorOfDictionaryOfInteger iter (thelist); NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thelist);
for (iter.Start(); iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
S<<"** MSG(NB="<<iter.Value()<<"): "<<iter.Name()<<endl; S<<"** MSG(NB="<<iter.Value()<<"): "<<iter.Key()<<endl;
} }
} }

View File

@ -12,10 +12,6 @@
// commercial license or contractual agreement. // 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_InterfaceError.hxx>
#include <Interface_Static.hxx> #include <Interface_Static.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>
@ -144,7 +140,7 @@ Standard_Boolean Interface_Static::Init
{ {
if (name[0] == '\0') return Standard_False; 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; Handle(Interface_Static) item;
if (type == Interface_ParamMisc) { if (type == Interface_ParamMisc) {
Handle(Interface_Static) other = Interface_Static::Static(init); 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); else item = new Interface_Static (family,name,type,init);
MoniTool_TypedValue::Stats()->SetItem (name,item); MoniTool_TypedValue::Stats().Bind (name,item);
return Standard_True; return Standard_True;
} }
@ -213,15 +209,15 @@ Standard_Boolean Interface_Static::Init
Handle(Interface_Static) Interface_Static::Static Handle(Interface_Static) Interface_Static::Static
(const Standard_CString name) (const Standard_CString name)
{ {
Handle(Interface_Static) result; Handle(Standard_Transient) result;
MoniTool_TypedValue::Stats()->GetItem (name,result); MoniTool_TypedValue::Stats().Find(name, result);
return result; return Handle(Interface_Static)::DownCast(result);
} }
Standard_Boolean Interface_Static::IsPresent (const Standard_CString name) 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 Standard_Integer modup = (mode / 100); // 0 any, 1 non-update, 2 update
Handle(TColStd_HSequenceOfHAsciiString) list = Handle(TColStd_HSequenceOfHAsciiString) list =
new TColStd_HSequenceOfHAsciiString(); new TColStd_HSequenceOfHAsciiString();
Dico_IteratorOfDictionaryOfTransient iter(MoniTool_TypedValue::Stats()); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(MoniTool_TypedValue::Stats());
for (iter.Start(); iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
Handle(Interface_Static) item = Handle(Interface_Static) item =
Handle(Interface_Static)::DownCast(iter.Value()); Handle(Interface_Static)::DownCast(iter.Value());
if (item.IsNull()) continue; if (item.IsNull()) continue;
@ -409,7 +405,7 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_Static::Items
if (ok && (modup == 1)) ok = !item->UpdatedStatus(); if (ok && (modup == 1)) ok = !item->UpdatedStatus();
if (ok && (modup == 2)) 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; return list;
} }

View File

@ -32,7 +32,6 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Standard_Character.hxx> #include <Standard_Character.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx> #include <TColStd_HSequenceOfHAsciiString.hxx>
class Dico_DictionaryOfInteger;
class TCollection_HAsciiString; class TCollection_HAsciiString;
class Standard_Transient; class Standard_Transient;
class Interface_InterfaceError; class Interface_InterfaceError;
@ -284,7 +283,7 @@ private:
Standard_Real therealup; Standard_Real therealup;
TCollection_AsciiString theunidef; TCollection_AsciiString theunidef;
Handle(TColStd_HArray1OfAsciiString) theenums; Handle(TColStd_HArray1OfAsciiString) theenums;
Handle(Dico_DictionaryOfInteger) theeadds; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theeadds;
Interface_StaticSatisfies thesatisf; Interface_StaticSatisfies thesatisf;
TCollection_AsciiString thesatisn; TCollection_AsciiString thesatisn;
Standard_Boolean theupdate; Standard_Boolean theupdate;

View File

@ -12,8 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Interface_InterfaceError.hxx> #include <Interface_InterfaceError.hxx>
#include <Interface_TypedValue.hxx> #include <Interface_TypedValue.hxx>
#include <OSD_Path.hxx> #include <OSD_Path.hxx>

View File

@ -27,7 +27,6 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Interface_ParamType.hxx> #include <Interface_ParamType.hxx>
#include <MoniTool_ValueType.hxx> #include <MoniTool_ValueType.hxx>
class Dico_DictionaryOfInteger;
class TCollection_HAsciiString; class TCollection_HAsciiString;
class Standard_Transient; class Standard_Transient;
class Interface_InterfaceError; class Interface_InterfaceError;
@ -101,7 +100,7 @@ private:
Handle(Standard_Type) theotyp; Handle(Standard_Type) theotyp;
TCollection_AsciiString theunidef; TCollection_AsciiString theunidef;
Handle(TColStd_HArray1OfAsciiString) theenums; Handle(TColStd_HArray1OfAsciiString) theenums;
Handle(Dico_DictionaryOfInteger) theeadds; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theeadds;
TCollection_AsciiString thesatisn; TCollection_AsciiString thesatisn;
Handle(TCollection_HAsciiString) thehval; Handle(TCollection_HAsciiString) thehval;
Handle(Standard_Transient) theoval; Handle(Standard_Transient) theoval;

View File

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

View File

@ -27,9 +27,9 @@
#include <MoniTool_ValueType.hxx> #include <MoniTool_ValueType.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
class Dico_DictionaryOfTransient; #include <NCollection_DataMap.hxx>
class Standard_Transient; #include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
//! a AttrList allows to record a list of attributes as Transients //! a AttrList allows to record a list of attributes as Transients
//! which can be edited, changed ... //! which can be edited, changed ...
@ -111,7 +111,7 @@ public:
Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const; Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const;
//! Returns the exhaustive list of attributes //! Returns the exhaustive list of attributes
Standard_EXPORT Handle(Dico_DictionaryOfTransient) AttrList() const; Standard_EXPORT const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& AttrList() const;
//! Gets the list of attributes from <other>, as such, i.e. //! Gets the list of attributes from <other>, as such, i.e.
//! not copied : attributes are shared, any attribute edited, //! not copied : attributes are shared, any attribute edited,
@ -145,7 +145,7 @@ private:
Handle(Dico_DictionaryOfTransient) theattrib; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> theattrib;
}; };

View File

@ -12,8 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Geom2d_CartesianPoint.hxx> #include <Geom2d_CartesianPoint.hxx>
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <Geom_CartesianPoint.hxx> #include <Geom_CartesianPoint.hxx>
@ -32,26 +30,12 @@
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TopoDS_HShape.hxx> #include <TopoDS_HShape.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <NCollection_DataMap.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MoniTool_CaseData,MMgt_TShared) IMPLEMENT_STANDARD_RTTIEXT(MoniTool_CaseData,MMgt_TShared)
//#include <GeomTools.hxx> static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> defch;
// definitions static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> defms;
static Handle(Dico_DictionaryOfInteger)& defchecks()
{
static Handle(Dico_DictionaryOfInteger) defch;
if (defch.IsNull()) defch = new Dico_DictionaryOfInteger();
return defch;
}
static Handle(Dico_DictionaryOfTransient)& defmess()
{
static Handle(Dico_DictionaryOfTransient) defms;
if (defms.IsNull()) defms = new Dico_DictionaryOfTransient();
return defms;
}
static Standard_Boolean stachr = Standard_False; static Standard_Boolean stachr = Standard_False;
//static OSD_Timer chrono; //static OSD_Timer chrono;
@ -411,15 +395,16 @@ Message_Msg MoniTool_CaseData::Msg () const
void MoniTool_CaseData::SetDefWarning (const Standard_CString acode) void MoniTool_CaseData::SetDefWarning (const Standard_CString acode)
{ defchecks()->SetItem (acode,1); } { defch.Bind(acode,1); }
void MoniTool_CaseData::SetDefFail (const Standard_CString acode) void MoniTool_CaseData::SetDefFail (const Standard_CString acode)
{ defchecks()->SetItem (acode,2); } { defch.Bind(acode,2); }
Standard_Integer MoniTool_CaseData::DefCheck (const Standard_CString acode) Standard_Integer MoniTool_CaseData::DefCheck (const Standard_CString acode)
{ {
Standard_Integer val; Standard_Integer val;
if (!defchecks()->GetItem (acode,val)) val = 0; if (!defch.Find(acode, val))
val = 0;
return val; return val;
} }
@ -428,14 +413,14 @@ Message_Msg MoniTool_CaseData::Msg () const
(const Standard_CString casecode, const Standard_CString mesdef) (const Standard_CString casecode, const Standard_CString mesdef)
{ {
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (mesdef); Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (mesdef);
defmess()->SetItem (casecode,str); defms.Bind(casecode,str);
} }
Standard_CString MoniTool_CaseData::DefMsg (const Standard_CString casecode) Standard_CString MoniTool_CaseData::DefMsg (const Standard_CString casecode)
{ {
//Standard_CString mesd; Handle(Standard_Transient) aTStr;
Handle(TCollection_HAsciiString) str; if (!defms.Find(casecode, aTStr)) return "";
if (!defmess()->GetItem (casecode,str)) return ""; Handle(TCollection_HAsciiString) str = Handle(TCollection_HAsciiString)::DownCast(aTStr);
if (str.IsNull()) return ""; if (str.IsNull()) return "";
return str->ToCString(); return str->ToCString();
} }

View File

@ -12,10 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>
#include <MoniTool_Element.hxx> #include <MoniTool_Element.hxx>
#include <MoniTool_TypedValue.hxx> #include <MoniTool_TypedValue.hxx>
@ -31,31 +27,32 @@ IMPLEMENT_STANDARD_RTTIEXT(MoniTool_TypedValue,MMgt_TShared)
// Not Used : // Not Used :
//static char defmess[30]; //static char defmess[30];
static Handle(Dico_DictionaryOfTransient) libtv() static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thelibtv;
static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> astats;
static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& libtv()
{ {
static Handle(Dico_DictionaryOfTransient) thelibtv; if (thelibtv.IsEmpty()) {
if (thelibtv.IsNull()) {
thelibtv = new Dico_DictionaryOfTransient;
Handle(MoniTool_TypedValue) tv; Handle(MoniTool_TypedValue) tv;
tv = new MoniTool_TypedValue("Integer",MoniTool_ValueInteger); tv = new MoniTool_TypedValue("Integer",MoniTool_ValueInteger);
thelibtv->SetItem ("Integer",tv); thelibtv.Bind ("Integer",tv);
tv = new MoniTool_TypedValue("Real",MoniTool_ValueReal); tv = new MoniTool_TypedValue("Real",MoniTool_ValueReal);
thelibtv->SetItem ("Real",tv); thelibtv.Bind ("Real",tv);
tv = new MoniTool_TypedValue("Text",MoniTool_ValueText); tv = new MoniTool_TypedValue("Text",MoniTool_ValueText);
thelibtv->SetItem ("Text",tv); thelibtv.Bind ("Text",tv);
tv = new MoniTool_TypedValue("Transient",MoniTool_ValueIdent); tv = new MoniTool_TypedValue("Transient",MoniTool_ValueIdent);
thelibtv->SetItem ("Transient",tv); thelibtv.Bind ("Transient",tv);
tv = new MoniTool_TypedValue("Boolean",MoniTool_ValueEnum); tv = new MoniTool_TypedValue("Boolean",MoniTool_ValueEnum);
tv->AddDef ("enum 0"); // = 0 False , > 0 True tv->AddDef ("enum 0"); // = 0 False , > 0 True
tv->AddDef ("eval False"); tv->AddDef ("eval False");
tv->AddDef ("eval True"); tv->AddDef ("eval True");
thelibtv->SetItem ("Boolean",tv); thelibtv.Bind ("Boolean",tv);
tv = new MoniTool_TypedValue("Logical",MoniTool_ValueEnum); tv = new MoniTool_TypedValue("Logical",MoniTool_ValueEnum);
tv->AddDef ("enum -1"); // < 0 False , = 0 Unk , > 0 True tv->AddDef ("enum -1"); // < 0 False , = 0 Unk , > 0 True
tv->AddDef ("eval False"); tv->AddDef ("eval False");
tv->AddDef ("eval Unknown"); tv->AddDef ("eval Unknown");
tv->AddDef ("eval True"); tv->AddDef ("eval True");
thelibtv->SetItem ("Logical",tv); thelibtv.Bind ("Logical",tv);
} }
return thelibtv; return thelibtv;
} }
@ -101,7 +98,7 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
theival (other->IntegerValue()) , thehval (other->HStringValue()) , theival (other->IntegerValue()) , thehval (other->HStringValue()) ,
theoval (other->ObjectValue()) theoval (other->ObjectValue())
{ {
Handle(Dico_DictionaryOfInteger) eadds; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> eadds;
Standard_CString satisname; Standard_CString satisname;
other->Internals (theinterp,thesatisf,satisname, eadds); other->Internals (theinterp,thesatisf,satisname, eadds);
thesatisn.AssignCat (satisname); thesatisn.AssignCat (satisname);
@ -121,10 +118,9 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
} }
} }
// dupliquer theeadds // dupliquer theeadds
if (!eadds.IsNull()) { if (!eadds.IsEmpty()) {
theeadds = new Dico_DictionaryOfInteger; NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator itad(eadds);
Dico_IteratorOfDictionaryOfInteger itad (eadds); for (; itad.More(); itad.Next()) theeadds.Bind (itad.Key(),itad.Value());
for (; itad.More(); itad.Next()) theeadds->SetItem (itad.Name(),itad.Value());
} }
// on duplique la string // on duplique la string
@ -135,7 +131,7 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
void MoniTool_TypedValue::Internals void MoniTool_TypedValue::Internals
(MoniTool_ValueInterpret& interp, MoniTool_ValueSatisfies& satisf, (MoniTool_ValueInterpret& interp, MoniTool_ValueSatisfies& satisf,
Standard_CString& satisname, Standard_CString& satisname,
Handle(Dico_DictionaryOfInteger)& enums) const NCollection_DataMap<TCollection_AsciiString, Standard_Integer>& enums) const
{ interp = theinterp; satisf = thesatisf; satisname = thesatisn.ToCString(); { interp = theinterp; satisf = thesatisf; satisname = thesatisn.ToCString();
enums = theeadds; } enums = theeadds; }
@ -192,17 +188,17 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
Sprintf(mess," %d:%s",i,enva); Sprintf(mess," %d:%s",i,enva);
def.AssignCat (mess); def.AssignCat (mess);
} }
if (!theeadds.IsNull()) { if (!theeadds.IsEmpty()) {
def.AssignCat(" , alpha: "); def.AssignCat(" , alpha: ");
Dico_IteratorOfDictionaryOfInteger listadd(theeadds); NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator listadd(theeadds);
for (listadd.Start(); listadd.More(); listadd.Next()) { for (; listadd.More(); listadd.Next()) {
TCollection_AsciiString aName = listadd.Name(); TCollection_AsciiString aName = listadd.Key();
Standard_CString enva = aName.ToCString(); Standard_CString enva = aName.ToCString();
if (enva[0] == '?') continue; if (enva[0] == '?') continue;
Sprintf(mess,":%d ",listadd.Value()); Sprintf(mess,":%d ",listadd.Value());
def.AssignCat (enva); def.AssignCat (enva);
def.AssignCat (mess); def.AssignCat (mess);
} }
} }
} }
break; break;
@ -392,46 +388,45 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
theenums = enums; theenums = enums;
} }
if (theeadds.IsNull()) theeadds = new Dico_DictionaryOfInteger;
if (v1[0] != '\0') { if (v1[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v1)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v1));
theeadds->SetItem (v1,theintup); theeadds.Bind (v1,theintup);
} }
if (v2[0] != '\0') { if (v2[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v2)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v2));
theeadds->SetItem (v2,theintup); theeadds.Bind (v2,theintup);
} }
if (v3[0] != '\0') { if (v3[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v3)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v3));
theeadds->SetItem (v3,theintup); theeadds.Bind (v3,theintup);
} }
if (v4[0] != '\0') { if (v4[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v4)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v4));
theeadds->SetItem (v4,theintup); theeadds.Bind (v4,theintup);
} }
if (v5[0] != '\0') { if (v5[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v5)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v5));
theeadds->SetItem (v5,theintup); theeadds.Bind (v5,theintup);
} }
if (v6[0] != '\0') { if (v6[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v6)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v6));
theeadds->SetItem (v6,theintup); theeadds.Bind (v6,theintup);
} }
if (v7[0] != '\0') { if (v7[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v7)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v7));
theeadds->SetItem (v7,theintup); theeadds.Bind (v7,theintup);
} }
if (v8[0] != '\0') { if (v8[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v8)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v8));
theeadds->SetItem (v8,theintup); theeadds.Bind (v8,theintup);
} }
if (v9[0] != '\0') { if (v9[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v9)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v9));
theeadds->SetItem (v9,theintup); theeadds.Bind (v9,theintup);
} }
if (v10[0] != '\0') { if (v10[0] != '\0') {
theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v10)); theintup ++; theenums->SetValue(theintup,TCollection_AsciiString(v10));
theeadds->SetItem (v10,theintup); theeadds.Bind (v10,theintup);
} }
} }
@ -458,8 +453,7 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
theenums->SetValue(num,TCollection_AsciiString(val)); theenums->SetValue(num,TCollection_AsciiString(val));
// On met AUSSI dans le dictionnaire // On met AUSSI dans le dictionnaire
// else { // else {
if (theeadds.IsNull()) theeadds = new Dico_DictionaryOfInteger; theeadds.Bind (val,num);
theeadds->SetItem (val,num);
// } // }
} }
@ -489,8 +483,8 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
for (i = theintlow; i <= theintup; i ++) for (i = theintlow; i <= theintup; i ++)
if (theenums->Value(i).IsEqual(val)) return i; if (theenums->Value(i).IsEqual(val)) return i;
// cas additionnel ? // cas additionnel ?
if (!theeadds.IsNull()) { if (!theeadds.IsEmpty()) {
if (theeadds->GetItem (val,i,Standard_False)) return i; if (theeadds.Find(val,i)) return i;
} }
// entier possible // entier possible
//gka S4054 //gka S4054
@ -735,7 +729,7 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
if (tv.IsNull()) return Standard_False; if (tv.IsNull()) return Standard_False;
if (defin[0] != '\0') tv->SetDefinition(defin); if (defin[0] != '\0') tv->SetDefinition(defin);
// else if (tv->Definition() == '\0') return Standard_False; // else if (tv->Definition() == '\0') return Standard_False;
libtv()->SetItem (tv->Name(),tv); libtv().Bind(tv->Name(),tv);
return Standard_True; return Standard_True;
} }
@ -743,7 +737,11 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
(const Standard_CString defin) (const Standard_CString defin)
{ {
Handle(MoniTool_TypedValue) val; Handle(MoniTool_TypedValue) val;
if (!libtv()->GetItem (defin,val,Standard_False)) val.Nullify(); Handle(Standard_Transient) aTVal;
if (libtv().Find(defin, aTVal))
val = Handle(MoniTool_TypedValue)::DownCast(aTVal);
else
val.Nullify();
return val; return val;
} }
@ -758,19 +756,16 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
Handle(TColStd_HSequenceOfAsciiString) MoniTool_TypedValue::LibList () Handle(TColStd_HSequenceOfAsciiString) MoniTool_TypedValue::LibList ()
{ {
Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString(); Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString();
if (libtv().IsNull()) return list; if (libtv().IsEmpty()) return list;
for (Dico_IteratorOfDictionaryOfTransient it(libtv()); it.More();it.Next()) { NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator it(libtv());
list->Append (it.Name()); for (; it.More();it.Next()) {
list->Append (it.Key());
} }
return list; return list;
} }
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& MoniTool_TypedValue::Stats ()
Handle(Dico_DictionaryOfTransient) MoniTool_TypedValue::Stats ()
{ {
static Handle(Dico_DictionaryOfTransient) astats;
if (astats.IsNull()) astats = new Dico_DictionaryOfTransient;
return astats; return astats;
} }
@ -778,6 +773,10 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
(const Standard_CString name) (const Standard_CString name)
{ {
Handle(MoniTool_TypedValue) result; Handle(MoniTool_TypedValue) result;
if (!Stats()->GetItem(name,result)) result.Nullify(); Handle(Standard_Transient) aTResult;
if (Stats().Find(name, aTResult))
result = Handle(MoniTool_TypedValue)::DownCast(aTResult);
else
result.Nullify();
return result; return result;
} }

View File

@ -22,6 +22,7 @@
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <MoniTool_ValueType.hxx> #include <MoniTool_ValueType.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
@ -32,13 +33,11 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx> #include <TColStd_HSequenceOfAsciiString.hxx>
class Dico_DictionaryOfInteger;
class TCollection_HAsciiString; class TCollection_HAsciiString;
class Standard_Transient; class Standard_Transient;
class Standard_ConstructionError; class Standard_ConstructionError;
class TCollection_AsciiString; class TCollection_AsciiString;
class Message_Messenger; class Message_Messenger;
class Dico_DictionaryOfTransient;
class MoniTool_TypedValue; class MoniTool_TypedValue;
@ -77,7 +76,7 @@ public:
Standard_EXPORT MoniTool_TypedValue(const Handle(MoniTool_TypedValue)& other); Standard_EXPORT MoniTool_TypedValue(const Handle(MoniTool_TypedValue)& other);
//! Access to internal data which have no other access //! Access to internal data which have no other access
Standard_EXPORT void Internals (MoniTool_ValueInterpret& interp, MoniTool_ValueSatisfies& satisf, Standard_CString& satisname, Handle(Dico_DictionaryOfInteger)& enums) const; Standard_EXPORT void Internals (MoniTool_ValueInterpret& interp, MoniTool_ValueSatisfies& satisf, Standard_CString& satisname, NCollection_DataMap<TCollection_AsciiString, Standard_Integer>& enums) const;
//! Returns the name //! Returns the name
Standard_EXPORT Standard_CString Name() const; Standard_EXPORT Standard_CString Name() const;
@ -326,7 +325,7 @@ protected:
//! Gives the internal library of static values //! Gives the internal library of static values
Standard_EXPORT static Handle(Dico_DictionaryOfTransient) Stats(); Standard_EXPORT static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Stats();
@ -346,7 +345,7 @@ private:
Standard_Real therealup; Standard_Real therealup;
TCollection_AsciiString theunidef; TCollection_AsciiString theunidef;
Handle(TColStd_HArray1OfAsciiString) theenums; Handle(TColStd_HArray1OfAsciiString) theenums;
Handle(Dico_DictionaryOfInteger) theeadds; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theeadds;
MoniTool_ValueInterpret theinterp; MoniTool_ValueInterpret theinterp;
MoniTool_ValueSatisfies thesatisf; MoniTool_ValueSatisfies thesatisf;
TCollection_AsciiString thesatisn; TCollection_AsciiString thesatisn;

View File

@ -252,24 +252,24 @@ class NCollection_DataMap : public NCollection_BaseMap
} }
//! IsBound //! IsBound
Standard_Boolean IsBound(const TheKeyType& K) const Standard_Boolean IsBound(const TheKeyType& theKey) const
{ {
DataMapNode* p; DataMapNode* p;
return lookup(K, p); return lookup(theKey, p);
} }
//! UnBind removes Item Key pair from map //! UnBind removes Item Key pair from map
Standard_Boolean UnBind(const TheKeyType& K) Standard_Boolean UnBind(const TheKeyType& theKey)
{ {
if (IsEmpty()) if (IsEmpty())
return Standard_False; return Standard_False;
DataMapNode** data = (DataMapNode**) myData1; DataMapNode** data = (DataMapNode**) myData1;
Standard_Integer k = Hasher::HashCode(K,NbBuckets()); Standard_Integer k = Hasher::HashCode(theKey,NbBuckets());
DataMapNode* p = data[k]; DataMapNode* p = data[k];
DataMapNode* q = NULL; DataMapNode* q = NULL;
while (p) while (p)
{ {
if (Hasher::IsEqual(p->Key(),K)) if (Hasher::IsEqual(p->Key(), theKey))
{ {
Decrement(); Decrement();
if (q) if (q)

View File

@ -1124,7 +1124,7 @@ static int TestCMD(Draw_Interpretor& di, Standard_Integer argc, const char ** ar
return 0; return 0;
} }
#include <Dico_DictionaryOfInteger.hxx> #include <NCollection_DataMap.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx> #include <TColStd_HSequenceOfAsciiString.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
@ -1140,10 +1140,10 @@ static Standard_Integer statface (Draw_Interpretor& di,Standard_Integer /*argc*/
di<<"Invalid input shape\n"; di<<"Invalid input shape\n";
return 1; return 1;
} }
Handle(Dico_DictionaryOfInteger) aDico = new Dico_DictionaryOfInteger(); NCollection_DataMap<TCollection_AsciiString, Standard_Integer> aMap;
Handle(TColStd_HSequenceOfAsciiString) aSequence = new TColStd_HSequenceOfAsciiString; Handle(TColStd_HSequenceOfAsciiString) aSequence = new TColStd_HSequenceOfAsciiString;
Standard_CString aString; Standard_CString aString;
Standard_Integer i=1,j=1,l=1,aa=1; Standard_Integer l=0;
TopExp_Explorer expl; TopExp_Explorer expl;
Standard_Real f3d,l3d; Standard_Real f3d,l3d;
for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next()) for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
@ -1153,15 +1153,11 @@ static Standard_Integer statface (Draw_Interpretor& di,Standard_Integer /*argc*/
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
aString = aSurface->DynamicType()->Name(); aString = aSurface->DynamicType()->Name();
if(aDico->GetItem(aString,aa) != 0) if (aMap.IsBound(aString))
{ aMap.ChangeFind(aString)++;
aDico->GetItem(aString,aa); else {
aDico->SetItem(aString,aa+1); aMap.Bind(aString, 1);
} else {
aDico->SetItem(aString,1);
aSequence->Append(aString); aSequence->Append(aString);
aa=1;
i++;
} }
} }
// PCURVES // PCURVES
@ -1173,51 +1169,42 @@ static Standard_Integer statface (Draw_Interpretor& di,Standard_Integer /*argc*/
TopoDS_Iterator it (aWire); TopoDS_Iterator it (aWire);
for (; it.More(); it.Next()) { for (; it.More(); it.Next()) {
TopoDS_Edge Edge = TopoDS::Edge (it.Value()); TopoDS_Edge Edge = TopoDS::Edge (it.Value());
Handle(Geom2d_Curve) aCurve2d = BRep_Tool::CurveOnSurface(Edge,aFace,f3d,l3d); Handle(Geom2d_Curve) aCurve2d = BRep_Tool::CurveOnSurface(Edge,aFace,f3d,l3d);
aString = aCurve2d->DynamicType()->Name(); aString = aCurve2d->DynamicType()->Name();
if(aDico->GetItem(aString,aa) != 0) if(aMap.IsBound(aString))
{ aMap.ChangeFind(aString)++;
aDico->GetItem(aString,aa); else {
aDico->SetItem(aString,aa+1); aMap.Bind(aString, 1);
} else { aSequence->Append(aString);
aDico->SetItem(aString,1); }
aSequence->Append(aString);
i++;
aa=1;
}
} }
} }
// 3d CURVES // 3d CURVES
TopExp_Explorer exp; TopExp_Explorer exp;
for (exp.Init(aShape,TopAbs_EDGE); exp.More(); exp.Next()) for (exp.Init(aShape,TopAbs_EDGE); exp.More(); exp.Next())
{ {
TopoDS_Edge Edge = TopoDS::Edge (exp.Current()); TopoDS_Edge Edge = TopoDS::Edge (exp.Current());
Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (Edge,f3d,l3d); Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (Edge,f3d,l3d);
if(aCurve3d.IsNull()) if(aCurve3d.IsNull())
{ {
l++; l++;
goto aLabel; } else {
}
aString = aCurve3d->DynamicType()->Name(); aString = aCurve3d->DynamicType()->Name();
if(aDico->GetItem(aString,aa) != 0) if (aMap.IsBound(aString))
{ {
aDico->GetItem(aString,aa); aMap.ChangeFind(aString)++;
aDico->SetItem(aString,aa+1); } else {
} else { aMap.Bind(aString, 1);
aDico->SetItem(aString,1); aSequence->Append(aString);
aSequence->Append(aString); }
i++;
aa=1;
}
aLabel:;
} }
}
// Output // Output
di<<"\n"; di<<"\n";
for(j=1;j<i;j++)
{ for (Standard_Integer i = 1; i <= aSequence->Length(); i++) {
aDico->GetItem(aSequence->Value(j),aa); di << aMap.Find(aSequence->Value(i)) << " -- " << aSequence->Value(i).ToCString() << "\n";
di<<aa<<" -- "<<aSequence->Value(j).ToCString()<<"\n"; }
}
di<<"\n"; di<<"\n";
di<<"Degenerated edges :\n"; di<<"Degenerated edges :\n";

File diff suppressed because it is too large Load Diff

View File

@ -14,17 +14,11 @@ STEPCAFControl_DataMapOfPDExternFile.hxx
STEPCAFControl_DataMapOfSDRExternFile.hxx STEPCAFControl_DataMapOfSDRExternFile.hxx
STEPCAFControl_DataMapOfShapePD.hxx STEPCAFControl_DataMapOfShapePD.hxx
STEPCAFControl_DataMapOfShapeSDR.hxx STEPCAFControl_DataMapOfShapeSDR.hxx
STEPCAFControl_DictionaryOfExternFile.hxx
STEPCAFControl_DictionaryOfExternFile_0.cxx
STEPCAFControl_ExternFile.cxx STEPCAFControl_ExternFile.cxx
STEPCAFControl_ExternFile.hxx STEPCAFControl_ExternFile.hxx
STEPCAFControl_ExternFile.lxx STEPCAFControl_ExternFile.lxx
STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx
STEPCAFControl_IteratorOfDictionaryOfExternFile_0.cxx
STEPCAFControl_Reader.cxx STEPCAFControl_Reader.cxx
STEPCAFControl_Reader.hxx STEPCAFControl_Reader.hxx
STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx
STEPCAFControl_StackItemOfDictionaryOfExternFile_0.cxx
STEPCAFControl_Writer.cxx STEPCAFControl_Writer.cxx
STEPCAFControl_Writer.hxx STEPCAFControl_Writer.hxx
STEPCAFControl_GDTProperty.hxx STEPCAFControl_GDTProperty.hxx

View File

@ -1,209 +0,0 @@
// Created on: 2000-04-09
// Created by: Sergey MOZOKHIN
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _STEPCAFControl_DictionaryOfExternFile_HeaderFile
#define _STEPCAFControl_DictionaryOfExternFile_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Character.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Size.hxx>
#include <Standard_Integer.hxx>
class STEPCAFControl_ExternFile;
class Standard_NoSuchObject;
class STEPCAFControl_IteratorOfDictionaryOfExternFile;
class STEPCAFControl_StackItemOfDictionaryOfExternFile;
class TCollection_AsciiString;
class STEPCAFControl_DictionaryOfExternFile;
DEFINE_STANDARD_HANDLE(STEPCAFControl_DictionaryOfExternFile, MMgt_TShared)
class STEPCAFControl_DictionaryOfExternFile : public MMgt_TShared
{
public:
//! Creates a Dictionary cell.
//! A Dictionary is always created then handled by its first cell
//! After creating a Dictionary, user can call methods HasItem,
//! Item, SetItem ... (internal cells and entries are also
//! defined as objects from the same class)
//! Also iteration can be made, by an Iterator on this Dictionary
Standard_EXPORT STEPCAFControl_DictionaryOfExternFile();
//! Returns True if an Item is bound to a Name in the Dictionnary
//! <exact> : if True, commands exact matching
//! if False, accept completion, only if ONE AND ONLY ONE
//! Dictionnary Entry has <name> as beginning of its name
Standard_EXPORT Standard_Boolean HasItem (const Standard_CString name, const Standard_Boolean exact = Standard_False) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean HasItem (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Returns item bound to a name in the Dictionnary
//! <exact> : same as for HasItem
Standard_EXPORT const Handle(STEPCAFControl_ExternFile)& Item (const Standard_CString name, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT const Handle(STEPCAFControl_ExternFile)& Item (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Gathers HasItem and Item, in a less regular but faster way
//! If return is True, <anitem> is returned too, else it is not
//! <exact> : same as for HasItem
Standard_EXPORT Standard_Boolean GetItem (const Standard_CString name, Handle(STEPCAFControl_ExternFile)& anitem, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean GetItem (const TCollection_AsciiString& name, Handle(STEPCAFControl_ExternFile)& anitem, const Standard_Boolean exact = Standard_True) const;
//! Binds an item to a dictionnary entry
//! If <name> is already known in the dictionary, its value
//! is changed. Else, the dictionary entry is created.
//! If <exact> is given False, completion is tried, it is accepted
//! If it gives a UNIQUE entry : hence this one will be modified
//! Else, new entry is created with the exact name given
Standard_EXPORT void SetItem (const Standard_CString name, const Handle(STEPCAFControl_ExternFile)& anitem, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT void SetItem (const TCollection_AsciiString& name, const Handle(STEPCAFControl_ExternFile)& anitem, const Standard_Boolean exact = Standard_True);
//! Returns the Item AS AN ADDRESS which corresponds to a Name,
//! in order to be changed or set.
//! If this name is not yet recorded, the Dictionary creates it.
//! <isvalued> is returned True if the Item is recorded in the
//! Dictionary, False else, in that case the Item is reserved and
//! the name is noted as beeing valued now.
Standard_EXPORT Handle(STEPCAFControl_ExternFile)& NewItem (const Standard_CString name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Handle(STEPCAFControl_ExternFile)& NewItem (const TCollection_AsciiString& name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Removes a dictionary entry given by its name then Returns True
//! If the entry does not exists, Does nothing then Returns False
//! <exact> : as for HasItem, if completion works, the found entry
//! is removed (else returned value is False)
//! <cln> commands cleaning dictionary (to recover memory space)
//! For an isolated call, it is recommanded to give it at True
//! For a sequence of calls, rather give False, then call Clean
Standard_EXPORT Standard_Boolean RemoveItem (const Standard_CString name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean RemoveItem (const TCollection_AsciiString& name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Deletes physically in one step the entries which were removed
//! (can be used for a more efficient Memory Management : first
//! Remove several Items (<cln> = False), then Clean the Memory)
Standard_EXPORT void Clean();
//! Returns True if no Item is recorded
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Clears all the Dictionary : all recorded Items are removed
Standard_EXPORT void Clear();
//! Copies the Dictionary as a Tree, without Copying the Items
Standard_EXPORT Handle(STEPCAFControl_DictionaryOfExternFile) Copy() const;
//! Internal routine used for completion (returns True if success)
Standard_EXPORT Standard_Boolean Complete (Handle(STEPCAFControl_DictionaryOfExternFile)& acell) const;
friend class STEPCAFControl_IteratorOfDictionaryOfExternFile;
DEFINE_STANDARD_RTTI_INLINE(STEPCAFControl_DictionaryOfExternFile,MMgt_TShared)
protected:
private:
//! Defines cell's character (internal use, to build dict. tree)
Standard_EXPORT void SetChar (const Standard_Character car);
//! Returns True if this cell has a subcell
Standard_EXPORT Standard_Boolean HasSub() const;
//! Returns subcell
Standard_EXPORT Handle(STEPCAFControl_DictionaryOfExternFile) Sub() const;
//! Returns True if this cell has a next cell
Standard_EXPORT Standard_Boolean HasNext() const;
//! Returns next cell
Standard_EXPORT Handle(STEPCAFControl_DictionaryOfExternFile) Next() const;
//! Defines subcell
Standard_EXPORT void SetSub (const Handle(STEPCAFControl_DictionaryOfExternFile)& acell);
//! Defines next cell
Standard_EXPORT void SetNext (const Handle(STEPCAFControl_DictionaryOfExternFile)& acell);
//! Internal method used to get an entry from a given name
Standard_EXPORT void SearchCell (const Standard_CString name, const Standard_Size lmax, const Standard_Character car, const Standard_Size level, Handle(STEPCAFControl_DictionaryOfExternFile)& acell, Standard_Size& reslev, Standard_Integer& stat) const;
//! Internal method used to create a new entry for a name
Standard_EXPORT void NewCell (const Standard_CString name, const Standard_Size namlen, Handle(STEPCAFControl_DictionaryOfExternFile)& acell, const Standard_Size reslev, const Standard_Integer stat);
//! Returns True if a cell has an associated item value
Standard_EXPORT Standard_Boolean HasIt() const;
//! Returns item value associated to a cell
Standard_EXPORT const Handle(STEPCAFControl_ExternFile)& It() const;
//! Returns item address associated to a cell
Standard_EXPORT Handle(STEPCAFControl_ExternFile)& ItAdr();
//! Binds an item value to a cell
Standard_EXPORT void SetIt (const Handle(STEPCAFControl_ExternFile)& anitem);
//! Declares a cell as Valued : used by NewItem (when an Item
//! is created if it did not exist and is returned)
Standard_EXPORT void DeclIt();
//! Removes item bound to a cell (cancels effect of DeclIt)
Standard_EXPORT void RemoveIt();
//! Returns cell's character as a node feature
Standard_EXPORT Standard_Character CellChar() const;
//! Performs Copy from an original <fromcell> to <me>
//! Called by Copy
Standard_EXPORT void GetCopied (const Handle(STEPCAFControl_DictionaryOfExternFile)& fromcell);
Standard_Character thecars[4];
Handle(STEPCAFControl_DictionaryOfExternFile) thesub;
Handle(STEPCAFControl_DictionaryOfExternFile) thenext;
Handle(STEPCAFControl_ExternFile) theitem;
};
#endif // _STEPCAFControl_DictionaryOfExternFile_HeaderFile

View File

@ -1,47 +0,0 @@
// Created on: 2000-04-09
// Created by: Sergey MOZOKHIN
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <Standard_Type.hxx>
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <STEPCAFControl_ExternFile.hxx>
#include <Standard_NoSuchObject.hxx>
#include <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#include <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Handle(STEPCAFControl_ExternFile)
#define TheItem_hxx <STEPCAFControl_ExternFile.hxx>
#define Dico_Iterator STEPCAFControl_IteratorOfDictionaryOfExternFile
#define Dico_Iterator_hxx <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#define Dico_StackItem STEPCAFControl_StackItemOfDictionaryOfExternFile
#define Dico_StackItem_hxx <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#define Handle_Dico_StackItem Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile)
#define Dico_Dictionary STEPCAFControl_DictionaryOfExternFile
#define Dico_Dictionary_hxx <STEPCAFControl_DictionaryOfExternFile.hxx>
#define Handle_Dico_Dictionary Handle(STEPCAFControl_DictionaryOfExternFile)
#include <Dico_Dictionary.gxx>

View File

@ -1,103 +0,0 @@
// Created on: 2000-04-09
// Created by: Sergey MOZOKHIN
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _STEPCAFControl_IteratorOfDictionaryOfExternFile_HeaderFile
#define _STEPCAFControl_IteratorOfDictionaryOfExternFile_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
class STEPCAFControl_DictionaryOfExternFile;
class STEPCAFControl_StackItemOfDictionaryOfExternFile;
class Standard_NoSuchObject;
class STEPCAFControl_ExternFile;
class TCollection_AsciiString;
class STEPCAFControl_IteratorOfDictionaryOfExternFile
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an iterator which will work on all the dictionary
Standard_EXPORT STEPCAFControl_IteratorOfDictionaryOfExternFile(const Handle(STEPCAFControl_DictionaryOfExternFile)& acell);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
Standard_EXPORT STEPCAFControl_IteratorOfDictionaryOfExternFile(const Handle(STEPCAFControl_DictionaryOfExternFile)& acell, const Standard_CString basename);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
//! Same as above, but basename is String instead of CString
Standard_EXPORT STEPCAFControl_IteratorOfDictionaryOfExternFile(const Handle(STEPCAFControl_DictionaryOfExternFile)& acell, const TCollection_AsciiString& basename);
//! Allows to Start a new Iteration from beginning
Standard_EXPORT void Start();
//! Returns True if there are more entries to return
Standard_EXPORT Standard_Boolean More();
//! Go to the next entry
//! (if there is not, Value will raise an exception)
Standard_EXPORT void Next();
//! Returns item value of current entry
Standard_EXPORT const Handle(STEPCAFControl_ExternFile)& Value() const;
//! Returns name of current entry
Standard_EXPORT TCollection_AsciiString Name() const;
protected:
private:
//! Appends a new value to the Iteration Stack
Standard_EXPORT void AppendStack (const Handle(STEPCAFControl_DictionaryOfExternFile)& val);
Handle(STEPCAFControl_DictionaryOfExternFile) thebase;
TCollection_AsciiString thename;
Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile) thelast;
Standard_Integer thenb;
Standard_Boolean themore;
Standard_Boolean theinit;
Standard_Boolean thenext;
};
#endif // _STEPCAFControl_IteratorOfDictionaryOfExternFile_HeaderFile

View File

@ -1,36 +0,0 @@
// Created on: 2000-04-09
// Created by: Sergey MOZOKHIN
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#include <Standard_NoSuchObject.hxx>
#include <STEPCAFControl_ExternFile.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Handle(STEPCAFControl_ExternFile)
#define TheItem_hxx <STEPCAFControl_ExternFile.hxx>
#define Dico_Iterator STEPCAFControl_IteratorOfDictionaryOfExternFile
#define Dico_Iterator_hxx <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#define Dico_StackItem STEPCAFControl_StackItemOfDictionaryOfExternFile
#define Dico_StackItem_hxx <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#define Handle_Dico_StackItem Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile)
#define Dico_Dictionary STEPCAFControl_DictionaryOfExternFile
#define Dico_Dictionary_hxx <STEPCAFControl_DictionaryOfExternFile.hxx>
#define Handle_Dico_Dictionary Handle(STEPCAFControl_DictionaryOfExternFile)
#include <Dico_Iterator.gxx>

View File

@ -44,7 +44,6 @@
#include <STEPCAFControl_DataMapOfPDExternFile.hxx> #include <STEPCAFControl_DataMapOfPDExternFile.hxx>
#include <STEPCAFControl_DataMapOfSDRExternFile.hxx> #include <STEPCAFControl_DataMapOfSDRExternFile.hxx>
#include <STEPCAFControl_DataMapOfShapePD.hxx> #include <STEPCAFControl_DataMapOfShapePD.hxx>
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <STEPCAFControl_ExternFile.hxx> #include <STEPCAFControl_ExternFile.hxx>
#include <STEPCAFControl_Reader.hxx> #include <STEPCAFControl_Reader.hxx>
#include <STEPConstruct.hxx> #include <STEPConstruct.hxx>
@ -322,7 +321,6 @@ STEPCAFControl_Reader::STEPCAFControl_Reader ():
myMatMode ( Standard_True ) myMatMode ( Standard_True )
{ {
STEPCAFControl_Controller::Init(); STEPCAFControl_Controller::Init();
myFiles = new STEPCAFControl_DictionaryOfExternFile;
} }
@ -356,7 +354,7 @@ void STEPCAFControl_Reader::Init (const Handle(XSControl_WorkSession)& WS,
{ {
// necessary only in Writer, to set good actor: WS->SelectNorm ( "STEP" ); // necessary only in Writer, to set good actor: WS->SelectNorm ( "STEP" );
myReader.SetWS (WS,scratch); myReader.SetWS (WS,scratch);
myFiles = new STEPCAFControl_DictionaryOfExternFile; myFiles.Clear();
} }
@ -438,7 +436,7 @@ Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString &
//purpose : //purpose :
//======================================================================= //=======================================================================
const Handle(STEPCAFControl_DictionaryOfExternFile) &STEPCAFControl_Reader::ExternFiles () const const NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& STEPCAFControl_Reader::ExternFiles () const
{ {
return myFiles; return myFiles;
} }
@ -453,9 +451,9 @@ Standard_Boolean STEPCAFControl_Reader::ExternFile (const Standard_CString name,
Handle(STEPCAFControl_ExternFile) &ef) const Handle(STEPCAFControl_ExternFile) &ef) const
{ {
ef.Nullify(); ef.Nullify();
if ( myFiles.IsNull() || ! myFiles->HasItem ( name ) ) if ( myFiles.IsEmpty() || !myFiles.IsBound ( name ) )
return Standard_False; return Standard_False;
ef = myFiles->Item ( name ); ef = myFiles.Find ( name );
return Standard_True; return Standard_True;
} }
@ -800,8 +798,8 @@ Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile (const S
Handle(TDocStd_Document)& doc) Handle(TDocStd_Document)& doc)
{ {
// if the file is already read, associate it with SDR // if the file is already read, associate it with SDR
if ( myFiles->HasItem ( file, Standard_True ) ) { if ( myFiles.IsBound ( file ) ) {
return myFiles->Item ( file ); return myFiles.ChangeFind ( file );
} }
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
@ -829,7 +827,7 @@ Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile (const S
} }
// add read file to dictionary // add read file to dictionary
myFiles->SetItem ( file, EF ); myFiles.Bind( file, EF );
return EF; return EF;
} }

View File

@ -31,7 +31,6 @@
#include <STEPCAFControl_DataMapOfPDExternFile.hxx> #include <STEPCAFControl_DataMapOfPDExternFile.hxx>
#include <XCAFDoc_DataMapOfShapeLabel.hxx> #include <XCAFDoc_DataMapOfShapeLabel.hxx>
#include <TColStd_HSequenceOfTransient.hxx> #include <TColStd_HSequenceOfTransient.hxx>
class STEPCAFControl_DictionaryOfExternFile;
class XSControl_WorkSession; class XSControl_WorkSession;
class TDocStd_Document; class TDocStd_Document;
class TCollection_AsciiString; class TCollection_AsciiString;
@ -104,7 +103,7 @@ public:
//! Returns data on external files //! Returns data on external files
//! Returns Null handle if no external files are read //! Returns Null handle if no external files are read
Standard_EXPORT const Handle(STEPCAFControl_DictionaryOfExternFile)& ExternFiles() const; Standard_EXPORT const NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> & ExternFiles() const;
//! Returns data on external file by its name //! Returns data on external file by its name
//! Returns False if no external file with given name is read //! Returns False if no external file with given name is read
@ -242,7 +241,7 @@ private:
STEPControl_Reader myReader; STEPControl_Reader myReader;
Handle(STEPCAFControl_DictionaryOfExternFile) myFiles; NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
Standard_Boolean myColorMode; Standard_Boolean myColorMode;
Standard_Boolean myNameMode; Standard_Boolean myNameMode;
Standard_Boolean myLayerMode; Standard_Boolean myLayerMode;

View File

@ -1,78 +0,0 @@
// Created on: 2000-04-09
// Created by: Sergey MOZOKHIN
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _STEPCAFControl_StackItemOfDictionaryOfExternFile_HeaderFile
#define _STEPCAFControl_StackItemOfDictionaryOfExternFile_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MMgt_TShared.hxx>
class STEPCAFControl_DictionaryOfExternFile;
class STEPCAFControl_ExternFile;
class STEPCAFControl_IteratorOfDictionaryOfExternFile;
class STEPCAFControl_StackItemOfDictionaryOfExternFile;
DEFINE_STANDARD_HANDLE(STEPCAFControl_StackItemOfDictionaryOfExternFile, MMgt_TShared)
class STEPCAFControl_StackItemOfDictionaryOfExternFile : public MMgt_TShared
{
public:
//! Creates a StackItem with no Previous one
Standard_EXPORT STEPCAFControl_StackItemOfDictionaryOfExternFile();
//! Creates a StackItem with a Previous one
Standard_EXPORT STEPCAFControl_StackItemOfDictionaryOfExternFile(const Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile)& previous);
//! Returns the Previous Item (is Null if no Previous defined)
Standard_EXPORT Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile) Previous() const;
//! Returns the Dictionary Cell corresponding to an Item
Standard_EXPORT Handle(STEPCAFControl_DictionaryOfExternFile) Value() const;
//! Sets a new Dictionary Cell as Value of an Item
Standard_EXPORT void SetValue (const Handle(STEPCAFControl_DictionaryOfExternFile)& cval);
DEFINE_STANDARD_RTTI_INLINE(STEPCAFControl_StackItemOfDictionaryOfExternFile,MMgt_TShared)
protected:
private:
Handle(STEPCAFControl_DictionaryOfExternFile) thevalue;
Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile) theprev;
};
#endif // _STEPCAFControl_StackItemOfDictionaryOfExternFile_HeaderFile

View File

@ -1,45 +0,0 @@
// Created on: 2000-04-09
// Created by: Sergey MOZOKHIN
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#include <Standard_Type.hxx>
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#include <STEPCAFControl_ExternFile.hxx>
#include <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#define TheItem Handle(STEPCAFControl_ExternFile)
#define TheItem_hxx <STEPCAFControl_ExternFile.hxx>
#define Dico_Iterator STEPCAFControl_IteratorOfDictionaryOfExternFile
#define Dico_Iterator_hxx <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#define Dico_StackItem STEPCAFControl_StackItemOfDictionaryOfExternFile
#define Dico_StackItem_hxx <STEPCAFControl_StackItemOfDictionaryOfExternFile.hxx>
#define Handle_Dico_StackItem Handle(STEPCAFControl_StackItemOfDictionaryOfExternFile)
#define Dico_Dictionary STEPCAFControl_DictionaryOfExternFile
#define Dico_Dictionary_hxx <STEPCAFControl_DictionaryOfExternFile.hxx>
#define Handle_Dico_Dictionary Handle(STEPCAFControl_DictionaryOfExternFile)
#include <Dico_StackItem.gxx>

View File

@ -47,9 +47,7 @@
#include <StepBasic_SiUnitAndPlaneAngleUnit.hxx> #include <StepBasic_SiUnitAndPlaneAngleUnit.hxx>
#include <STEPCAFControl_ActorWrite.hxx> #include <STEPCAFControl_ActorWrite.hxx>
#include <STEPCAFControl_Controller.hxx> #include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <STEPCAFControl_ExternFile.hxx> #include <STEPCAFControl_ExternFile.hxx>
#include <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#include <STEPCAFControl_Writer.hxx> #include <STEPCAFControl_Writer.hxx>
#include <STEPConstruct.hxx> #include <STEPConstruct.hxx>
#include <STEPConstruct_DataMapOfAsciiStringTransient.hxx> #include <STEPConstruct_DataMapOfAsciiStringTransient.hxx>
@ -317,7 +315,7 @@ void STEPCAFControl_Writer::Init (const Handle(XSControl_WorkSession)& WS,
{ {
WS->SelectNorm ( "STEP" ); WS->SelectNorm ( "STEP" );
myWriter.SetWS (WS,scratch); myWriter.SetWS (WS,scratch);
myFiles = new STEPCAFControl_DictionaryOfExternFile; myFiles.Clear();
myLabEF.Clear(); myLabEF.Clear();
myLabels.Clear(); myLabels.Clear();
} }
@ -339,7 +337,7 @@ IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString filen
TCollection_AsciiString dpath; TCollection_AsciiString dpath;
mainfile.SystemName ( dpath ); mainfile.SystemName ( dpath );
STEPCAFControl_IteratorOfDictionaryOfExternFile it ( myFiles ); NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator it(myFiles);
for ( ; it.More(); it.Next() ) { for ( ; it.More(); it.Next() ) {
Handle(STEPCAFControl_ExternFile) EF = it.Value(); Handle(STEPCAFControl_ExternFile) EF = it.Value();
if ( EF->GetWriteStatus() != IFSelect_RetVoid ) continue; if ( EF->GetWriteStatus() != IFSelect_RetVoid ) continue;
@ -433,7 +431,7 @@ Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document)
//purpose : //purpose :
//======================================================================= //=======================================================================
const Handle(STEPCAFControl_DictionaryOfExternFile) &STEPCAFControl_Writer::ExternFiles () const const NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& STEPCAFControl_Writer::ExternFiles () const
{ {
return myFiles; return myFiles;
} }
@ -463,9 +461,9 @@ Standard_Boolean STEPCAFControl_Writer::ExternFile (const Standard_CString name,
Handle(STEPCAFControl_ExternFile) &ef) const Handle(STEPCAFControl_ExternFile) &ef) const
{ {
ef.Nullify(); ef.Nullify();
if ( ! myFiles.IsNull() || ! myFiles->HasItem ( name ) ) if ( ! myFiles.IsEmpty() || ! myFiles.IsBound ( name ) )
return Standard_False; return Standard_False;
ef = myFiles->Item ( name ); ef = myFiles.Find( name );
return Standard_True; return Standard_True;
} }
@ -741,13 +739,13 @@ TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
GetLabelName ( L, basename ); GetLabelName ( L, basename );
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString ( basename ); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString ( basename );
name->AssignCat ( ".stp" ); name->AssignCat ( ".stp" );
if ( myFiles->HasItem ( name->ToCString() ) ) { // avoid confusions if ( myFiles.IsBound( name->ToCString() ) ) { // avoid confusions
for ( Standard_Integer k=1; k < 32000; k++ ) { for ( Standard_Integer k=1; k < 32000; k++ ) {
name = new TCollection_HAsciiString ( basename ); name = new TCollection_HAsciiString ( basename );
name->AssignCat ( "_" ); name->AssignCat ( "_" );
name->AssignCat ( TCollection_AsciiString ( k ).ToCString() ); name->AssignCat ( TCollection_AsciiString ( k ).ToCString() );
name->AssignCat ( ".stp" ); name->AssignCat ( ".stp" );
if ( ! myFiles->HasItem ( name->ToCString() ) ) break; if ( ! myFiles.IsBound ( name->ToCString() ) ) break;
} }
} }
@ -762,7 +760,7 @@ TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
EF->SetTransferStatus ( Transfer ( sw, Lseq, mode, multi, Standard_True ) ); EF->SetTransferStatus ( Transfer ( sw, Lseq, mode, multi, Standard_True ) );
Interface_Static::SetIVal ("write.step.assembly", assemblymode); Interface_Static::SetIVal ("write.step.assembly", assemblymode);
myLabEF.Bind ( L, EF ); myLabEF.Bind ( L, EF );
myFiles->SetItem ( name->ToCString(), EF ); myFiles.Bind ( name->ToCString(), EF );
// return empty compound as replacement for the shape // return empty compound as replacement for the shape
myLabels.Bind ( L, C ); myLabels.Bind ( L, C );

View File

@ -29,7 +29,6 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <STEPControl_StepModelType.hxx> #include <STEPControl_StepModelType.hxx>
#include <TDF_LabelSequence.hxx> #include <TDF_LabelSequence.hxx>
class STEPCAFControl_DictionaryOfExternFile;
class XSControl_WorkSession; class XSControl_WorkSession;
class TDocStd_Document; class TDocStd_Document;
class TDF_Label; class TDF_Label;
@ -91,7 +90,7 @@ public:
//! Returns data on external files //! Returns data on external files
//! Returns Null handle if no external files are read //! Returns Null handle if no external files are read
Standard_EXPORT const Handle(STEPCAFControl_DictionaryOfExternFile)& ExternFiles() const; Standard_EXPORT const NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& ExternFiles() const;
//! Returns data on external file by its original label //! Returns data on external file by its original label
//! Returns False if no external file with given name is read //! Returns False if no external file with given name is read
@ -197,7 +196,7 @@ private:
STEPControl_Writer myWriter; STEPControl_Writer myWriter;
Handle(STEPCAFControl_DictionaryOfExternFile) myFiles; NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
STEPCAFControl_DataMapOfLabelShape myLabels; STEPCAFControl_DataMapOfLabelShape myLabels;
STEPCAFControl_DataMapOfLabelExternFile myLabEF; STEPCAFControl_DataMapOfLabelExternFile myLabEF;
Standard_Boolean myColorMode; Standard_Boolean myColorMode;

View File

@ -2,10 +2,6 @@ ShapeProcess.cxx
ShapeProcess.hxx ShapeProcess.hxx
ShapeProcess_Context.cxx ShapeProcess_Context.cxx
ShapeProcess_Context.hxx ShapeProcess_Context.hxx
ShapeProcess_DictionaryOfOperator.hxx
ShapeProcess_DictionaryOfOperator_0.cxx
ShapeProcess_IteratorOfDictionaryOfOperator.hxx
ShapeProcess_IteratorOfDictionaryOfOperator_0.cxx
ShapeProcess_Operator.cxx ShapeProcess_Operator.cxx
ShapeProcess_Operator.hxx ShapeProcess_Operator.hxx
ShapeProcess_OperFunc.hxx ShapeProcess_OperFunc.hxx
@ -13,7 +9,5 @@ ShapeProcess_OperLibrary.cxx
ShapeProcess_OperLibrary.hxx ShapeProcess_OperLibrary.hxx
ShapeProcess_ShapeContext.cxx ShapeProcess_ShapeContext.cxx
ShapeProcess_ShapeContext.hxx ShapeProcess_ShapeContext.hxx
ShapeProcess_StackItemOfDictionaryOfOperator.hxx
ShapeProcess_StackItemOfDictionaryOfOperator_0.cxx
ShapeProcess_UOperator.cxx ShapeProcess_UOperator.cxx
ShapeProcess_UOperator.hxx ShapeProcess_UOperator.hxx

View File

@ -13,20 +13,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <NCollection_DataMap.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>
#include <Message_Msg.hxx> #include <Message_Msg.hxx>
#include <ShapeProcess.hxx> #include <ShapeProcess.hxx>
#include <ShapeProcess_Context.hxx> #include <ShapeProcess_Context.hxx>
#include <ShapeProcess_DictionaryOfOperator.hxx>
#include <ShapeProcess_Operator.hxx> #include <ShapeProcess_Operator.hxx>
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx> #include <Standard_Failure.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <TColStd_SequenceOfAsciiString.hxx> #include <TColStd_SequenceOfAsciiString.hxx>
static Handle(ShapeProcess_DictionaryOfOperator) dic; static NCollection_DataMap<TCollection_AsciiString, Handle(ShapeProcess_Operator)> aMapOfOperators;
//======================================================================= //=======================================================================
//function : RegisterOperator //function : RegisterOperator
//purpose : //purpose :
@ -35,14 +33,13 @@ static Handle(ShapeProcess_DictionaryOfOperator) dic;
Standard_Boolean ShapeProcess::RegisterOperator (const Standard_CString name, Standard_Boolean ShapeProcess::RegisterOperator (const Standard_CString name,
const Handle(ShapeProcess_Operator)& op) const Handle(ShapeProcess_Operator)& op)
{ {
if ( dic.IsNull() ) dic = new ShapeProcess_DictionaryOfOperator; if (aMapOfOperators.IsBound(name)) {
if ( dic->HasItem ( name, Standard_True ) ) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "Warning: operator with name " << name << " is already registered!" << endl; cout << "Warning: operator with name " << name << " is already registered!" << endl;
#endif #endif
return Standard_False; return Standard_False;
} }
dic->SetItem ( name, op ); aMapOfOperators.Bind( name, op );
return Standard_True; return Standard_True;
} }
@ -54,14 +51,13 @@ Standard_Boolean ShapeProcess::RegisterOperator (const Standard_CString name,
Standard_Boolean ShapeProcess::FindOperator (const Standard_CString name, Standard_Boolean ShapeProcess::FindOperator (const Standard_CString name,
Handle(ShapeProcess_Operator)& op) Handle(ShapeProcess_Operator)& op)
{ {
if ( dic.IsNull() ) dic = new ShapeProcess_DictionaryOfOperator; if (!aMapOfOperators.IsBound(name)) {
if ( ! dic->HasItem ( name, Standard_True ) ) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "Error: no operator with name " << name << " registered!" << endl; cout << "Error: no operator with name " << name << " registered!" << endl;
#endif #endif
return Standard_False; return Standard_False;
} }
op = dic->Item ( name ); op = aMapOfOperators.ChangeFind(name);
return !op.IsNull(); return !op.IsNull();
} }

View File

@ -29,10 +29,6 @@ class ShapeProcess_ShapeContext;
class ShapeProcess_Operator; class ShapeProcess_Operator;
class ShapeProcess_UOperator; class ShapeProcess_UOperator;
class ShapeProcess_OperLibrary; class ShapeProcess_OperLibrary;
class ShapeProcess_DictionaryOfOperator;
class ShapeProcess_IteratorOfDictionaryOfOperator;
class ShapeProcess_StackItemOfDictionaryOfOperator;
//! Shape Processing module //! Shape Processing module
//! allows to define and apply general Shape Processing as a //! allows to define and apply general Shape Processing as a
@ -77,9 +73,6 @@ friend class ShapeProcess_ShapeContext;
friend class ShapeProcess_Operator; friend class ShapeProcess_Operator;
friend class ShapeProcess_UOperator; friend class ShapeProcess_UOperator;
friend class ShapeProcess_OperLibrary; friend class ShapeProcess_OperLibrary;
friend class ShapeProcess_DictionaryOfOperator;
friend class ShapeProcess_IteratorOfDictionaryOfOperator;
friend class ShapeProcess_StackItemOfDictionaryOfOperator;
}; };

View File

@ -1,209 +0,0 @@
// Created on: 2000-08-21
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeProcess_DictionaryOfOperator_HeaderFile
#define _ShapeProcess_DictionaryOfOperator_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Character.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Size.hxx>
#include <Standard_Integer.hxx>
class ShapeProcess_Operator;
class Standard_NoSuchObject;
class ShapeProcess_IteratorOfDictionaryOfOperator;
class ShapeProcess_StackItemOfDictionaryOfOperator;
class TCollection_AsciiString;
class ShapeProcess_DictionaryOfOperator;
DEFINE_STANDARD_HANDLE(ShapeProcess_DictionaryOfOperator, MMgt_TShared)
class ShapeProcess_DictionaryOfOperator : public MMgt_TShared
{
public:
//! Creates a Dictionary cell.
//! A Dictionary is always created then handled by its first cell
//! After creating a Dictionary, user can call methods HasItem,
//! Item, SetItem ... (internal cells and entries are also
//! defined as objects from the same class)
//! Also iteration can be made, by an Iterator on this Dictionary
Standard_EXPORT ShapeProcess_DictionaryOfOperator();
//! Returns True if an Item is bound to a Name in the Dictionnary
//! <exact> : if True, commands exact matching
//! if False, accept completion, only if ONE AND ONLY ONE
//! Dictionnary Entry has <name> as beginning of its name
Standard_EXPORT Standard_Boolean HasItem (const Standard_CString name, const Standard_Boolean exact = Standard_False) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean HasItem (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Returns item bound to a name in the Dictionnary
//! <exact> : same as for HasItem
Standard_EXPORT const Handle(ShapeProcess_Operator)& Item (const Standard_CString name, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT const Handle(ShapeProcess_Operator)& Item (const TCollection_AsciiString& name, const Standard_Boolean exact = Standard_True) const;
//! Gathers HasItem and Item, in a less regular but faster way
//! If return is True, <anitem> is returned too, else it is not
//! <exact> : same as for HasItem
Standard_EXPORT Standard_Boolean GetItem (const Standard_CString name, Handle(ShapeProcess_Operator)& anitem, const Standard_Boolean exact = Standard_True) const;
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean GetItem (const TCollection_AsciiString& name, Handle(ShapeProcess_Operator)& anitem, const Standard_Boolean exact = Standard_True) const;
//! Binds an item to a dictionnary entry
//! If <name> is already known in the dictionary, its value
//! is changed. Else, the dictionary entry is created.
//! If <exact> is given False, completion is tried, it is accepted
//! If it gives a UNIQUE entry : hence this one will be modified
//! Else, new entry is created with the exact name given
Standard_EXPORT void SetItem (const Standard_CString name, const Handle(ShapeProcess_Operator)& anitem, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT void SetItem (const TCollection_AsciiString& name, const Handle(ShapeProcess_Operator)& anitem, const Standard_Boolean exact = Standard_True);
//! Returns the Item AS AN ADDRESS which corresponds to a Name,
//! in order to be changed or set.
//! If this name is not yet recorded, the Dictionary creates it.
//! <isvalued> is returned True if the Item is recorded in the
//! Dictionary, False else, in that case the Item is reserved and
//! the name is noted as beeing valued now.
Standard_EXPORT Handle(ShapeProcess_Operator)& NewItem (const Standard_CString name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Handle(ShapeProcess_Operator)& NewItem (const TCollection_AsciiString& name, Standard_Boolean& isvalued, const Standard_Boolean exact = Standard_True);
//! Removes a dictionary entry given by its name then Returns True
//! If the entry does not exists, Does nothing then Returns False
//! <exact> : as for HasItem, if completion works, the found entry
//! is removed (else returned value is False)
//! <cln> commands cleaning dictionary (to recover memory space)
//! For an isolated call, it is recommanded to give it at True
//! For a sequence of calls, rather give False, then call Clean
Standard_EXPORT Standard_Boolean RemoveItem (const Standard_CString name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Works as above method but accepts a String from TCollection
Standard_EXPORT Standard_Boolean RemoveItem (const TCollection_AsciiString& name, const Standard_Boolean cln = Standard_True, const Standard_Boolean exact = Standard_True);
//! Deletes physically in one step the entries which were removed
//! (can be used for a more efficient Memory Management : first
//! Remove several Items (<cln> = False), then Clean the Memory)
Standard_EXPORT void Clean();
//! Returns True if no Item is recorded
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Clears all the Dictionary : all recorded Items are removed
Standard_EXPORT void Clear();
//! Copies the Dictionary as a Tree, without Copying the Items
Standard_EXPORT Handle(ShapeProcess_DictionaryOfOperator) Copy() const;
//! Internal routine used for completion (returns True if success)
Standard_EXPORT Standard_Boolean Complete (Handle(ShapeProcess_DictionaryOfOperator)& acell) const;
friend class ShapeProcess_IteratorOfDictionaryOfOperator;
DEFINE_STANDARD_RTTI_INLINE(ShapeProcess_DictionaryOfOperator,MMgt_TShared)
protected:
private:
//! Defines cell's character (internal use, to build dict. tree)
Standard_EXPORT void SetChar (const Standard_Character car);
//! Returns True if this cell has a subcell
Standard_EXPORT Standard_Boolean HasSub() const;
//! Returns subcell
Standard_EXPORT Handle(ShapeProcess_DictionaryOfOperator) Sub() const;
//! Returns True if this cell has a next cell
Standard_EXPORT Standard_Boolean HasNext() const;
//! Returns next cell
Standard_EXPORT Handle(ShapeProcess_DictionaryOfOperator) Next() const;
//! Defines subcell
Standard_EXPORT void SetSub (const Handle(ShapeProcess_DictionaryOfOperator)& acell);
//! Defines next cell
Standard_EXPORT void SetNext (const Handle(ShapeProcess_DictionaryOfOperator)& acell);
//! Internal method used to get an entry from a given name
Standard_EXPORT void SearchCell (const Standard_CString name, const Standard_Size lmax, const Standard_Character car, const Standard_Size level, Handle(ShapeProcess_DictionaryOfOperator)& acell, Standard_Size& reslev, Standard_Integer& stat) const;
//! Internal method used to create a new entry for a name
Standard_EXPORT void NewCell (const Standard_CString name, const Standard_Size namlen, Handle(ShapeProcess_DictionaryOfOperator)& acell, const Standard_Size reslev, const Standard_Integer stat);
//! Returns True if a cell has an associated item value
Standard_EXPORT Standard_Boolean HasIt() const;
//! Returns item value associated to a cell
Standard_EXPORT const Handle(ShapeProcess_Operator)& It() const;
//! Returns item address associated to a cell
Standard_EXPORT Handle(ShapeProcess_Operator)& ItAdr();
//! Binds an item value to a cell
Standard_EXPORT void SetIt (const Handle(ShapeProcess_Operator)& anitem);
//! Declares a cell as Valued : used by NewItem (when an Item
//! is created if it did not exist and is returned)
Standard_EXPORT void DeclIt();
//! Removes item bound to a cell (cancels effect of DeclIt)
Standard_EXPORT void RemoveIt();
//! Returns cell's character as a node feature
Standard_EXPORT Standard_Character CellChar() const;
//! Performs Copy from an original <fromcell> to <me>
//! Called by Copy
Standard_EXPORT void GetCopied (const Handle(ShapeProcess_DictionaryOfOperator)& fromcell);
Standard_Character thecars[4];
Handle(ShapeProcess_DictionaryOfOperator) thesub;
Handle(ShapeProcess_DictionaryOfOperator) thenext;
Handle(ShapeProcess_Operator) theitem;
};
#endif // _ShapeProcess_DictionaryOfOperator_HeaderFile

View File

@ -1,47 +0,0 @@
// Created on: 2000-08-21
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeProcess_DictionaryOfOperator.hxx>
#include <Standard_Type.hxx>
#include <ShapeProcess_DictionaryOfOperator.hxx>
#include <ShapeProcess_Operator.hxx>
#include <Standard_NoSuchObject.hxx>
#include <ShapeProcess_IteratorOfDictionaryOfOperator.hxx>
#include <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Handle(ShapeProcess_Operator)
#define TheItem_hxx <ShapeProcess_Operator.hxx>
#define Dico_Iterator ShapeProcess_IteratorOfDictionaryOfOperator
#define Dico_Iterator_hxx <ShapeProcess_IteratorOfDictionaryOfOperator.hxx>
#define Dico_StackItem ShapeProcess_StackItemOfDictionaryOfOperator
#define Dico_StackItem_hxx <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#define Handle_Dico_StackItem Handle(ShapeProcess_StackItemOfDictionaryOfOperator)
#define Dico_Dictionary ShapeProcess_DictionaryOfOperator
#define Dico_Dictionary_hxx <ShapeProcess_DictionaryOfOperator.hxx>
#define Handle_Dico_Dictionary Handle(ShapeProcess_DictionaryOfOperator)
#include <Dico_Dictionary.gxx>

View File

@ -1,103 +0,0 @@
// Created on: 2000-08-21
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeProcess_IteratorOfDictionaryOfOperator_HeaderFile
#define _ShapeProcess_IteratorOfDictionaryOfOperator_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
class ShapeProcess_DictionaryOfOperator;
class ShapeProcess_StackItemOfDictionaryOfOperator;
class Standard_NoSuchObject;
class ShapeProcess_Operator;
class TCollection_AsciiString;
class ShapeProcess_IteratorOfDictionaryOfOperator
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an iterator which will work on all the dictionary
Standard_EXPORT ShapeProcess_IteratorOfDictionaryOfOperator(const Handle(ShapeProcess_DictionaryOfOperator)& acell);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
Standard_EXPORT ShapeProcess_IteratorOfDictionaryOfOperator(const Handle(ShapeProcess_DictionaryOfOperator)& acell, const Standard_CString basename);
//! Creates an iterator which will consider only entries
//! which name begin by the string given as basename (subpart)
//! Same as above, but basename is String instead of CString
Standard_EXPORT ShapeProcess_IteratorOfDictionaryOfOperator(const Handle(ShapeProcess_DictionaryOfOperator)& acell, const TCollection_AsciiString& basename);
//! Allows to Start a new Iteration from beginning
Standard_EXPORT void Start();
//! Returns True if there are more entries to return
Standard_EXPORT Standard_Boolean More();
//! Go to the next entry
//! (if there is not, Value will raise an exception)
Standard_EXPORT void Next();
//! Returns item value of current entry
Standard_EXPORT const Handle(ShapeProcess_Operator)& Value() const;
//! Returns name of current entry
Standard_EXPORT TCollection_AsciiString Name() const;
protected:
private:
//! Appends a new value to the Iteration Stack
Standard_EXPORT void AppendStack (const Handle(ShapeProcess_DictionaryOfOperator)& val);
Handle(ShapeProcess_DictionaryOfOperator) thebase;
TCollection_AsciiString thename;
Handle(ShapeProcess_StackItemOfDictionaryOfOperator) thelast;
Standard_Integer thenb;
Standard_Boolean themore;
Standard_Boolean theinit;
Standard_Boolean thenext;
};
#endif // _ShapeProcess_IteratorOfDictionaryOfOperator_HeaderFile

View File

@ -1,36 +0,0 @@
// Created on: 2000-08-21
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeProcess_IteratorOfDictionaryOfOperator.hxx>
#include <ShapeProcess_DictionaryOfOperator.hxx>
#include <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#include <Standard_NoSuchObject.hxx>
#include <ShapeProcess_Operator.hxx>
#include <TCollection_AsciiString.hxx>
#define TheItem Handle(ShapeProcess_Operator)
#define TheItem_hxx <ShapeProcess_Operator.hxx>
#define Dico_Iterator ShapeProcess_IteratorOfDictionaryOfOperator
#define Dico_Iterator_hxx <ShapeProcess_IteratorOfDictionaryOfOperator.hxx>
#define Dico_StackItem ShapeProcess_StackItemOfDictionaryOfOperator
#define Dico_StackItem_hxx <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#define Handle_Dico_StackItem Handle(ShapeProcess_StackItemOfDictionaryOfOperator)
#define Dico_Dictionary ShapeProcess_DictionaryOfOperator
#define Dico_Dictionary_hxx <ShapeProcess_DictionaryOfOperator.hxx>
#define Handle_Dico_Dictionary Handle(ShapeProcess_DictionaryOfOperator)
#include <Dico_Iterator.gxx>

View File

@ -1,78 +0,0 @@
// Created on: 2000-08-21
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeProcess_StackItemOfDictionaryOfOperator_HeaderFile
#define _ShapeProcess_StackItemOfDictionaryOfOperator_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MMgt_TShared.hxx>
class ShapeProcess_DictionaryOfOperator;
class ShapeProcess_Operator;
class ShapeProcess_IteratorOfDictionaryOfOperator;
class ShapeProcess_StackItemOfDictionaryOfOperator;
DEFINE_STANDARD_HANDLE(ShapeProcess_StackItemOfDictionaryOfOperator, MMgt_TShared)
class ShapeProcess_StackItemOfDictionaryOfOperator : public MMgt_TShared
{
public:
//! Creates a StackItem with no Previous one
Standard_EXPORT ShapeProcess_StackItemOfDictionaryOfOperator();
//! Creates a StackItem with a Previous one
Standard_EXPORT ShapeProcess_StackItemOfDictionaryOfOperator(const Handle(ShapeProcess_StackItemOfDictionaryOfOperator)& previous);
//! Returns the Previous Item (is Null if no Previous defined)
Standard_EXPORT Handle(ShapeProcess_StackItemOfDictionaryOfOperator) Previous() const;
//! Returns the Dictionary Cell corresponding to an Item
Standard_EXPORT Handle(ShapeProcess_DictionaryOfOperator) Value() const;
//! Sets a new Dictionary Cell as Value of an Item
Standard_EXPORT void SetValue (const Handle(ShapeProcess_DictionaryOfOperator)& cval);
DEFINE_STANDARD_RTTI_INLINE(ShapeProcess_StackItemOfDictionaryOfOperator,MMgt_TShared)
protected:
private:
Handle(ShapeProcess_DictionaryOfOperator) thevalue;
Handle(ShapeProcess_StackItemOfDictionaryOfOperator) theprev;
};
#endif // _ShapeProcess_StackItemOfDictionaryOfOperator_HeaderFile

View File

@ -1,45 +0,0 @@
// Created on: 2000-08-21
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#include <Standard_Type.hxx>
#include <ShapeProcess_DictionaryOfOperator.hxx>
#include <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#include <ShapeProcess_Operator.hxx>
#include <ShapeProcess_IteratorOfDictionaryOfOperator.hxx>
#define TheItem Handle(ShapeProcess_Operator)
#define TheItem_hxx <ShapeProcess_Operator.hxx>
#define Dico_Iterator ShapeProcess_IteratorOfDictionaryOfOperator
#define Dico_Iterator_hxx <ShapeProcess_IteratorOfDictionaryOfOperator.hxx>
#define Dico_StackItem ShapeProcess_StackItemOfDictionaryOfOperator
#define Dico_StackItem_hxx <ShapeProcess_StackItemOfDictionaryOfOperator.hxx>
#define Handle_Dico_StackItem Handle(ShapeProcess_StackItemOfDictionaryOfOperator)
#define Dico_Dictionary ShapeProcess_DictionaryOfOperator
#define Dico_Dictionary_hxx <ShapeProcess_DictionaryOfOperator.hxx>
#define Handle_Dico_Dictionary Handle(ShapeProcess_DictionaryOfOperator)
#include <Dico_StackItem.gxx>

View File

@ -12,7 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfInteger.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <StepData_Described.hxx> #include <StepData_Described.hxx>
@ -24,19 +23,19 @@
IMPLEMENT_STANDARD_RTTIEXT(StepData_ESDescr,StepData_EDescr) IMPLEMENT_STANDARD_RTTIEXT(StepData_ESDescr,StepData_EDescr)
StepData_ESDescr::StepData_ESDescr (const Standard_CString name) StepData_ESDescr::StepData_ESDescr (const Standard_CString name)
: thenom (name) { thenames = new Dico_DictionaryOfInteger; } : thenom (name) { }
void StepData_ESDescr::SetNbFields (const Standard_Integer nb) void StepData_ESDescr::SetNbFields (const Standard_Integer nb)
{ {
Standard_Integer minb,i, oldnb = NbFields(); Standard_Integer minb,i, oldnb = NbFields();
thenames->Clear(); thenames.Clear();
if (nb == 0) { thedescr.Nullify(); return; } if (nb == 0) { thedescr.Nullify(); return; }
Handle(TColStd_HArray1OfTransient) li = new TColStd_HArray1OfTransient(1,nb); Handle(TColStd_HArray1OfTransient) li = new TColStd_HArray1OfTransient(1,nb);
if (oldnb == 0) { thedescr = li; return; } if (oldnb == 0) { thedescr = li; return; }
minb = (oldnb > nb ? nb : oldnb); minb = (oldnb > nb ? nb : oldnb);
for (i = 1; i <= minb; i ++) { for (i = 1; i <= minb; i ++) {
DeclareAndCast(StepData_PDescr,pde,thedescr->Value(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); li->SetValue (i, pde);
} }
thedescr = li; thedescr = li;
@ -52,7 +51,7 @@ void StepData_ESDescr::SetNbFields (const Standard_Integer nb)
pde->SetFrom (descr); pde->SetFrom (descr);
pde->SetName (name); pde->SetName (name);
thedescr->SetValue (num,pde); thedescr->SetValue (num,pde);
thenames->SetItem (name,num); thenames.Bind(name,num);
} }
void StepData_ESDescr::SetBase (const Handle(StepData_ESDescr)& base) 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 StepData_ESDescr::Rank (const Standard_CString name) const
{ {
Standard_Integer rank; Standard_Integer rank;
if (!thenames->GetItem (name,rank)) return 0; if (!thenames.Find(name, rank))
return 0;
return rank; return rank;
} }

View File

@ -26,9 +26,10 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
class Dico_DictionaryOfInteger; #include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Transient.hxx>
class StepData_PDescr; class StepData_PDescr;
class TCollection_AsciiString;
class StepData_Described; class StepData_Described;
@ -117,7 +118,7 @@ private:
TCollection_AsciiString thenom; TCollection_AsciiString thenom;
Handle(TColStd_HArray1OfTransient) thedescr; Handle(TColStd_HArray1OfTransient) thedescr;
Handle(Dico_DictionaryOfInteger) thenames; NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thenames;
Handle(StepData_ESDescr) thebase; Handle(StepData_ESDescr) thebase;
Handle(StepData_ESDescr) thesuper; Handle(StepData_ESDescr) thesuper;

View File

@ -12,12 +12,12 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <StepData_Field.hxx> #include <StepData_Field.hxx>
#include <StepData_FreeFormEntity.hxx> #include <StepData_FreeFormEntity.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Transient.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepData_FreeFormEntity,MMgt_TShared) IMPLEMENT_STANDARD_RTTIEXT(StepData_FreeFormEntity,MMgt_TShared)
@ -81,20 +81,20 @@ void StepData_FreeFormEntity::SetStepType (const Standard_CString typenam)
if (!afr) return afr; if (!afr) return afr;
// remise en ordre avec un dictionnaire // remise en ordre avec un dictionnaire
e1 = ent; e2.Nullify(); e1 = ent; e2.Nullify();
Handle(Dico_DictionaryOfTransient) dic = new Dico_DictionaryOfTransient; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> dic;
while (!e1.IsNull()) { while (!e1.IsNull()) {
dic->SetItem (e1->StepType(), e1); dic.Bind(e1->StepType(), e1);
e1 = e1->Next(); e1 = e1->Next();
} }
// d abord effacer les next en cours ... // d abord effacer les next en cours ...
Dico_IteratorOfDictionaryOfTransient iter(dic); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(dic);
for (iter.Start(); iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
e1 = GetCasted(StepData_FreeFormEntity,iter.Value()); e1 = GetCasted(StepData_FreeFormEntity,iter.Value());
if (!e1.IsNull()) e1->SetNext(e2); if (!e1.IsNull()) e1->SetNext(e2);
} }
// ... puis les remettre dans l ordre // ... puis les remettre dans l ordre
e1.Nullify(); e1.Nullify();
for (iter.Start(); iter.More(); iter.Next()) { for (iter.Reset(); iter.More(); iter.Next()) {
e2 = GetCasted(StepData_FreeFormEntity,iter.Value()); e2 = GetCasted(StepData_FreeFormEntity,iter.Value());
if (!e1.IsNull()) e1->SetNext(e2); if (!e1.IsNull()) e1->SetNext(e2);
e1 = e2; e1 = e2;

View File

@ -11,13 +11,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Standard_Transient.hxx>
#include <Dico_DictionaryOfTransient.hxx> #include <Standard_Type.hxx>
#include <Interface_DataMapIteratorOfDataMapOfTransientInteger.hxx> #include <Interface_DataMapIteratorOfDataMapOfTransientInteger.hxx>
#include <Interface_InterfaceModel.hxx> #include <Interface_InterfaceModel.hxx>
#include <Interface_Protocol.hxx> #include <Interface_Protocol.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <StepData_Described.hxx> #include <StepData_Described.hxx>
#include <StepData_ECDescr.hxx> #include <StepData_ECDescr.hxx>
#include <StepData_EDescr.hxx> #include <StepData_EDescr.hxx>
@ -125,17 +123,16 @@ void StepData_Protocol::AddDescr
// Simple : memorisee selon son nom // Simple : memorisee selon son nom
// sinon que faire ? on memorise selon le numero passe en alpha-num ... // sinon que faire ? on memorise selon le numero passe en alpha-num ...
// (temporaire) // (temporaire)
if (thedscnam.IsNull()) thedscnam = new Dico_DictionaryOfTransient; if (!sd.IsNull()) thedscnam.Bind(sd->TypeName(),sd);
if (!sd.IsNull()) thedscnam->SetItem (sd->TypeName(),sd);
char fonom[10]; char fonom[10];
sprintf(fonom,"%d",CN); sprintf(fonom,"%d",CN);
thedscnam->SetItem (fonom,adescr); thedscnam.Bind(fonom,adescr);
} }
Standard_Boolean StepData_Protocol::HasDescr () const 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 (const Standard_Integer num) const
{ {
Handle(StepData_EDescr) dsc; Handle(StepData_EDescr) dsc;
if (thedscnam.IsNull()) return dsc; if (thedscnam.IsEmpty()) return dsc;
char fonom[10]; char fonom[10];
sprintf(fonom,"%d",num); 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; return dsc;
} }
@ -155,8 +156,10 @@ Handle(StepData_EDescr) StepData_Protocol::Descr
(const Standard_CString name, const Standard_Boolean anylevel) const (const Standard_CString name, const Standard_Boolean anylevel) const
{ {
Handle(StepData_EDescr) sd; Handle(StepData_EDescr) sd;
if (!thedscnam.IsNull()) { if (!thedscnam.IsEmpty()) {
if (thedscnam->GetItem (name,sd)) return sd; Handle(Standard_Transient) aTSd;
if (thedscnam.Find(name, aTSd))
return Handle(StepData_EDescr)::DownCast(aTSd);
} }
if (!anylevel) return sd; if (!anylevel) return sd;
@ -211,8 +214,7 @@ Handle(StepData_ECDescr) StepData_Protocol::ECDescr
void StepData_Protocol::AddPDescr void StepData_Protocol::AddPDescr
(const Handle(StepData_PDescr)& pdescr) (const Handle(StepData_PDescr)& pdescr)
{ {
if (thepdescr.IsNull()) thepdescr = new Dico_DictionaryOfTransient; thepdescr.Bind(pdescr->Name(),pdescr);
thepdescr->SetItem (pdescr->Name(),pdescr);
} }
@ -220,8 +222,10 @@ Handle(StepData_PDescr) StepData_Protocol::PDescr
(const Standard_CString name, const Standard_Boolean anylevel) const (const Standard_CString name, const Standard_Boolean anylevel) const
{ {
Handle(StepData_PDescr) sd; Handle(StepData_PDescr) sd;
if (!thepdescr.IsNull()) { if (!thepdescr.IsEmpty()) {
if (thepdescr->GetItem (name,sd)) return sd; Handle(Standard_Transient) aTSd;
if (thepdescr.Find(name, aTSd))
return Handle(StepData_PDescr)::DownCast(aTSd);
} }
if (!anylevel) return sd; if (!anylevel) return sd;
@ -239,8 +243,7 @@ Handle(StepData_PDescr) StepData_Protocol::PDescr
void StepData_Protocol::AddBasicDescr void StepData_Protocol::AddBasicDescr
(const Handle(StepData_ESDescr)& esdescr) (const Handle(StepData_ESDescr)& esdescr)
{ {
if (thedscbas.IsNull()) thedscbas = new Dico_DictionaryOfTransient; thedscbas.Bind(esdescr->TypeName(),esdescr);
thedscbas->SetItem (esdescr->TypeName(),esdescr);
} }
@ -248,8 +251,10 @@ Handle(StepData_EDescr) StepData_Protocol::BasicDescr
(const Standard_CString name, const Standard_Boolean anylevel) const (const Standard_CString name, const Standard_Boolean anylevel) const
{ {
Handle(StepData_EDescr) sd; Handle(StepData_EDescr) sd;
if (!thedscbas.IsNull()) { if (!thedscbas.IsEmpty()) {
if (thedscbas->GetItem (name,sd)) return sd; Handle(Standard_Transient) aTSd;
if (thedscbas.Find(name, aTSd))
return Handle(StepData_EDescr)::DownCast(aTSd);
} }
if (!anylevel) return sd; if (!anylevel) return sd;

View File

@ -27,7 +27,6 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
#include <TColStd_SequenceOfAsciiString.hxx> #include <TColStd_SequenceOfAsciiString.hxx>
class Dico_DictionaryOfTransient;
class Interface_Protocol; class Interface_Protocol;
class Standard_Transient; class Standard_Transient;
class Interface_InterfaceModel; class Interface_InterfaceModel;
@ -149,9 +148,9 @@ private:
Interface_DataMapOfTransientInteger thedscnum; Interface_DataMapOfTransientInteger thedscnum;
Handle(Dico_DictionaryOfTransient) thedscnam; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscnam;
Handle(Dico_DictionaryOfTransient) thepdescr; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thepdescr;
Handle(Dico_DictionaryOfTransient) thedscbas; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedscbas;
}; };

View File

@ -12,6 +12,5 @@ TCollection
TShort TShort
Units Units
UnitsAPI UnitsAPI
Dico
NCollection NCollection
Message Message

View File

@ -12,8 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Geom2d_CartesianPoint.hxx> #include <Geom2d_CartesianPoint.hxx>
#include <Interface_IntVal.hxx> #include <Interface_IntVal.hxx>
#include <Standard_Transient.hxx> #include <Standard_Transient.hxx>
@ -44,23 +42,22 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
void Transfer_Finder::SetAttribute void Transfer_Finder::SetAttribute
(const Standard_CString name, const Handle(Standard_Transient)& val) (const Standard_CString name, const Handle(Standard_Transient)& val)
{ {
if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient; theattrib.Bind(name,val);
theattrib->SetItem (name,val);
} }
Standard_Boolean Transfer_Finder::RemoveAttribute Standard_Boolean Transfer_Finder::RemoveAttribute
(const Standard_CString name) (const Standard_CString name)
{ {
if (theattrib.IsNull()) return Standard_False; if (theattrib.IsEmpty()) return Standard_False;
return theattrib->RemoveItem (name); return theattrib.UnBind (name);
} }
Standard_Boolean Transfer_Finder::GetAttribute Standard_Boolean Transfer_Finder::GetAttribute
(const Standard_CString name, const Handle(Standard_Type)& type, (const Standard_CString name, const Handle(Standard_Type)& type,
Handle(Standard_Transient)& val) const Handle(Standard_Transient)& val) const
{ {
if (theattrib.IsNull()) { val.Nullify(); return Standard_False; } if (theattrib.IsEmpty()) { val.Nullify(); return Standard_False; }
if (!theattrib->GetItem (name,val)) { val.Nullify(); return Standard_False; } if (!theattrib.Find(name, val)) { val.Nullify(); return Standard_False; }
if (!val->IsKind(type)) { val.Nullify(); return Standard_False; } if (!val->IsKind(type)) { val.Nullify(); return Standard_False; }
return Standard_True; return Standard_True;
} }
@ -69,8 +66,8 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
(const Standard_CString name) const (const Standard_CString name) const
{ {
Handle(Standard_Transient) atr; Handle(Standard_Transient) atr;
if (theattrib.IsNull()) return atr; if (theattrib.IsEmpty()) return atr;
if (!theattrib->GetItem (name,atr)) atr.Nullify(); if (!theattrib.Find(name, atr)) atr.Nullify();
return atr; return atr;
} }
@ -166,8 +163,8 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
return hval->ToCString(); return hval->ToCString();
} }
Handle(Dico_DictionaryOfTransient) Transfer_Finder::AttrList () const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Transfer_Finder::AttrList ()
{ return theattrib; } { return theattrib; }
void Transfer_Finder::SameAttributes (const Handle(Transfer_Finder)& other) void Transfer_Finder::SameAttributes (const Handle(Transfer_Finder)& other)
{ if (!other.IsNull()) theattrib = other->AttrList(); } { if (!other.IsNull()) theattrib = other->AttrList(); }
@ -176,14 +173,14 @@ void Transfer_Finder::SetHashCode (const Standard_Integer code)
(const Handle(Transfer_Finder)& other, (const Handle(Transfer_Finder)& other,
const Standard_CString fromname, const Standard_Boolean copied) const Standard_CString fromname, const Standard_Boolean copied)
{ {
if (other.IsNull()) return; if (other.IsNull()) return;
Handle(Dico_DictionaryOfTransient) list = other->AttrList(); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list = other->AttrList();
if (list.IsNull()) return; if (list.IsEmpty()) return;
if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient;
for (Dico_IteratorOfDictionaryOfTransient iter (list,fromname); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(list);
iter.More(); iter.Next()) { for (; iter.More(); iter.Next()) {
TCollection_AsciiString name = iter.Name(); TCollection_AsciiString name = iter.Key();
if (!name.StartsWith(fromname)) continue;
Handle(Standard_Transient) atr = iter.Value(); Handle(Standard_Transient) atr = iter.Value();
Handle(Standard_Transient) newatr = atr; 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.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx> #include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
@ -27,8 +29,8 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Interface_ParamType.hxx> #include <Interface_ParamType.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
class Dico_DictionaryOfTransient; #include <TCollection_AsciiString.hxx>
class Standard_Transient;
class Transfer_Finder; class Transfer_Finder;
@ -123,7 +125,7 @@ public:
Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const; Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const;
//! Returns the exhaustive list of attributes //! 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. //! Gets the list of attributes from <other>, as such, i.e.
//! not copied : attributes are shared, any attribute edited, //! not copied : attributes are shared, any attribute edited,
@ -162,7 +164,7 @@ private:
Standard_Integer thecode; 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 <Transfer_TransferDeadLoop.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_Array1OfInteger.hxx> #include <TColStd_Array1OfInteger.hxx>
#include <TColStd_HArray1OfInteger.hxx> #include <TColStd_HArray1OfInteger.hxx>

View File

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

View File

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

View File

@ -16,8 +16,6 @@
#include <DDocStd.hxx> #include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <IFSelect_SessionPilot.hxx> #include <IFSelect_SessionPilot.hxx>
@ -25,9 +23,7 @@
#include <IGESCAFControl_Writer.hxx> #include <IGESCAFControl_Writer.hxx>
#include <IGESControl_Controller.hxx> #include <IGESControl_Controller.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
#include <STEPCAFControl_DictionaryOfExternFile.hxx>
#include <STEPCAFControl_ExternFile.hxx> #include <STEPCAFControl_ExternFile.hxx>
#include <STEPCAFControl_IteratorOfDictionaryOfExternFile.hxx>
#include <STEPCAFControl_Reader.hxx> #include <STEPCAFControl_Reader.hxx>
#include <STEPCAFControl_Writer.hxx> #include <STEPCAFControl_Writer.hxx>
#include <STEPControl_Controller.hxx> #include <STEPControl_Controller.hxx>
@ -56,11 +52,11 @@
//============================================================ //============================================================
// Support for several models in DRAW // Support for several models in DRAW
//============================================================ //============================================================
static Handle(Dico_DictionaryOfTransient) thedictws = new Dico_DictionaryOfTransient; static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedictws;
static Standard_Boolean ClearDicWS() static Standard_Boolean ClearDicWS()
{ {
thedictws->Clear(); thedictws.Clear();
return Standard_True; return Standard_True;
} }
@ -68,20 +64,20 @@ static void AddWS(TCollection_AsciiString filename,
const Handle(XSControl_WorkSession)& WS) const Handle(XSControl_WorkSession)& WS)
{ {
WS->SetVars ( new XSDRAW_Vars ); // support of DRAW variables WS->SetVars ( new XSDRAW_Vars ); // support of DRAW variables
thedictws->SetItem( filename, WS ); thedictws.Bind( filename, WS );
} }
static Standard_Boolean FillDicWS(Handle(STEPCAFControl_DictionaryOfExternFile)& dicFile) static Standard_Boolean FillDicWS(NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& dicFile)
{ {
ClearDicWS(); ClearDicWS();
if ( dicFile->IsEmpty() ) { if ( dicFile.IsEmpty() ) {
return Standard_False; return Standard_False;
} }
Handle(STEPCAFControl_ExternFile) EF; Handle(STEPCAFControl_ExternFile) EF;
STEPCAFControl_IteratorOfDictionaryOfExternFile DicEFIt ( dicFile ); NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator DicEFIt(dicFile);
for (; DicEFIt.More(); DicEFIt.Next() ) { for (; DicEFIt.More(); DicEFIt.Next() ) {
TCollection_AsciiString filename = DicEFIt.Name(); TCollection_AsciiString filename = DicEFIt.Key();
EF = DicEFIt.Value(); EF = DicEFIt.Value();
AddWS ( filename, EF->GetWS() ); AddWS ( filename, EF->GetWS() );
} }
@ -90,9 +86,9 @@ static Standard_Boolean FillDicWS(Handle(STEPCAFControl_DictionaryOfExternFile)&
static Standard_Boolean SetCurrentWS (TCollection_AsciiString filename) static Standard_Boolean SetCurrentWS (TCollection_AsciiString filename)
{ {
if ( !thedictws->HasItem(filename) ) return Standard_False; if ( !thedictws.IsBound(filename) ) return Standard_False;
Handle(XSControl_WorkSession) CurrentWS = Handle(XSControl_WorkSession) CurrentWS =
Handle(XSControl_WorkSession)::DownCast( thedictws->Item(filename) ); Handle(XSControl_WorkSession)::DownCast( thedictws.ChangeFind(filename) );
XSDRAW::Pilot()->SetSession( CurrentWS ); XSDRAW::Pilot()->SetSession( CurrentWS );
return Standard_True; return Standard_True;
@ -123,13 +119,13 @@ static Standard_Integer SetCurWS (Draw_Interpretor& di , Standard_Integer argc,
static Standard_Integer GetDicWSList (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/) static Standard_Integer GetDicWSList (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
{ {
Handle(Dico_DictionaryOfTransient) DictWS = thedictws; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> DictWS = thedictws;
if ( DictWS->IsEmpty() ) return 1; if ( DictWS.IsEmpty() ) return 1;
Dico_IteratorOfDictionaryOfTransient DicIt ( DictWS ); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator DicIt(DictWS);
di << " The list of last translated files:\n"; di << " The list of last translated files:\n";
Standard_Integer num = 0; Standard_Integer num = 0;
for (; DicIt.More() ; DicIt.Next(), num++ ) { for (; DicIt.More() ; DicIt.Next(), num++ ) {
TCollection_AsciiString strng ( DicIt.Name() ); TCollection_AsciiString strng ( DicIt.Key() );
if ( num ) di << "\n"; if ( num ) di << "\n";
di << "\"" << strng.ToCString() << "\""; di << "\"" << strng.ToCString() << "\"";
} }
@ -162,12 +158,12 @@ static Standard_Integer FromShape (Draw_Interpretor& di, Standard_Integer argc,
char command[256]; char command[256];
Sprintf ( command, "fromshape %.200s -1", argv[1] ); Sprintf ( command, "fromshape %.200s -1", argv[1] );
Handle(Dico_DictionaryOfTransient) DictWS = thedictws; NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> DictWS = thedictws;
if ( DictWS->IsEmpty() ) return di.Eval ( command ); if ( DictWS.IsEmpty() ) return di.Eval ( command );
Handle(XSControl_WorkSession) WS = XSDRAW::Session(); Handle(XSControl_WorkSession) WS = XSDRAW::Session();
Dico_IteratorOfDictionaryOfTransient DicIt ( DictWS ); NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator DicIt ( DictWS );
// di << "Searching for shape among all the loaded files:\n"; // di << "Searching for shape among all the loaded files:\n";
Standard_Integer num = 0; Standard_Integer num = 0;
for (; DicIt.More() ; DicIt.Next(), num++ ) { for (; DicIt.More() ; DicIt.Next(), num++ ) {
@ -351,7 +347,7 @@ static Standard_Integer ReadStep (Draw_Interpretor& di, Standard_Integer argc, c
Draw::Set(argv[1],DD); Draw::Set(argv[1],DD);
di << "Document saved with name " << argv[1]; di << "Document saved with name " << argv[1];
Handle(STEPCAFControl_DictionaryOfExternFile) DicFile = reader.ExternFiles(); NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> DicFile = reader.ExternFiles();
FillDicWS( DicFile ); FillDicWS( DicFile );
AddWS ( fnom , XSDRAW::Session() ); AddWS ( fnom , XSDRAW::Session() );
@ -460,7 +456,7 @@ static Standard_Integer WriteStep (Draw_Interpretor& di, Standard_Integer argc,
case IFSelect_RetDone : { case IFSelect_RetDone : {
di<<"File "<<argv[2]<<" written\n"; di<<"File "<<argv[2]<<" written\n";
Handle(STEPCAFControl_DictionaryOfExternFile) DicFile = writer.ExternFiles(); NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> DicFile = writer.ExternFiles();
FillDicWS( DicFile ); FillDicWS( DicFile );
AddWS( argv[2], XSDRAW::Session() ); AddWS( argv[2], XSDRAW::Session() );
break; break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,8 +23,9 @@
#include <MMgt_TShared.hxx> #include <MMgt_TShared.hxx>
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
class Dico_DictionaryOfTransient; #include <Standard_Transient.hxx>
class Standard_Transient; #include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
class Geom_Geometry; class Geom_Geometry;
class Geom2d_Curve; class Geom2d_Curve;
class Geom_Curve; class Geom_Curve;
@ -92,7 +93,7 @@ protected:
private: 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 //:i1 pdn 03.04.99 BUC60301
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Geom2d_Point.hxx> #include <Geom2d_Point.hxx>
#include <Interface_Check.hxx> #include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx> #include <Interface_CheckIterator.hxx>
@ -148,7 +146,7 @@ Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc)
//purpose : //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; myContext = context;
myTransferReader->Context() = context; myTransferReader->Context() = context;
@ -162,8 +160,8 @@ void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransien
void XSControl_WorkSession::ClearContext () void XSControl_WorkSession::ClearContext ()
{ {
myContext.Nullify(); myContext.Clear();
myTransferReader->Context().Nullify(); myTransferReader->Context().Clear();
} }

View File

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

View File

@ -13,7 +13,6 @@
#include <DBRep.hxx> #include <DBRep.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Draw_Appli.hxx> #include <Draw_Appli.hxx>
#include <IFSelect_Functions.hxx> #include <IFSelect_Functions.hxx>
#include <IFSelect_SessionPilot.hxx> #include <IFSelect_SessionPilot.hxx>
@ -44,7 +43,7 @@ static int deja = 0, dejald = 0;
//unused variable //unused variable
//static int okxset = 0; //static int okxset = 0;
static Handle(Dico_DictionaryOfInteger) theolds; static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theolds;
static Handle(TColStd_HSequenceOfAsciiString) thenews; static Handle(TColStd_HSequenceOfAsciiString) thenews;
static Handle(IFSelect_SessionPilot) thepilot; // detient Session, Model static Handle(IFSelect_SessionPilot) thepilot; // detient Session, Model
@ -64,7 +63,6 @@ static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& , Standard_Integer argc,
void XSDRAW::ChangeCommand void XSDRAW::ChangeCommand
(const Standard_CString oldname, const Standard_CString newname) (const Standard_CString oldname, const Standard_CString newname)
{ {
if (theolds.IsNull()) theolds = new Dico_DictionaryOfInteger;
Standard_Integer num = 0; Standard_Integer num = 0;
if (newname[0] != '\0') { if (newname[0] != '\0') {
if (thenews.IsNull()) thenews = new TColStd_HSequenceOfAsciiString(); if (thenews.IsNull()) thenews = new TColStd_HSequenceOfAsciiString();
@ -72,7 +70,7 @@ static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& , Standard_Integer argc,
thenews->Append(newstr); thenews->Append(newstr);
num = thenews->Length(); num = thenews->Length();
} }
theolds->SetItem (oldname,num); theolds.Bind(oldname,num);
} }
void XSDRAW::RemoveCommand void XSDRAW::RemoveCommand
@ -118,8 +116,8 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
Standard_Integer nact, num = -1; Standard_Integer nact, num = -1;
char help[200]; char help[200];
com = list->Value(i); com = list->Value(i);
if (!theolds.IsNull()) if (!theolds.IsEmpty())
if (theolds->HasItem(com.ToCString())) num = theolds->Item(com.ToCString()); theolds.Find(com, num);
if (num == 0) continue; if (num == 0) continue;
if (!IFSelect_Activator::Select(com.ToCString(),nact,act)) if (!IFSelect_Activator::Select(com.ToCString(),nact,act))
Sprintf (help,"type : xhelp %s for help",com.ToCString()); Sprintf (help,"type : xhelp %s for help",com.ToCString());