#include #include #include #include #include #include #include #include IFSelect_SignatureList::IFSelect_SignatureList (const Standard_Boolean withlist) { thesignonly = Standard_False; thelistat = withlist; thenbnuls = 0; thedicount = new Dico_DictionaryOfInteger; thediclist = new Dico_DictionaryOfTransient; SetName("..."); } void IFSelect_SignatureList::SetList (const Standard_Boolean withlist) { thelistat = withlist; } Standard_Boolean& IFSelect_SignatureList::ModeSignOnly () { return thesignonly; } void IFSelect_SignatureList::Clear () { thelastval.Clear(); thenbnuls = 0; thedicount = new Dico_DictionaryOfInteger; thediclist = new Dico_DictionaryOfTransient; } void IFSelect_SignatureList::Add (const Handle(Standard_Transient)& ent, const Standard_CString sign) { if (thesignonly) { thelastval.Clear(); thelastval.AssignCat (sign); return; } if (sign[0] == '\0') { thenbnuls ++; return; } Standard_Boolean deja; Standard_Integer& nb = thedicount->NewItem(sign,deja); if (!deja) nb = 0; nb ++; if (thelistat) { Handle(Standard_Transient)& anitem = thediclist->NewItem(sign,deja); DeclareAndCast(TColStd_HSequenceOfTransient,alist,anitem); if (!deja) { alist = new TColStd_HSequenceOfTransient(); anitem = alist; } alist->Append(ent); } } Standard_CString IFSelect_SignatureList::LastValue () const { return thelastval.ToCString(); } void IFSelect_SignatureList::Init (const Standard_CString name, const Handle(Dico_DictionaryOfInteger)& count, const Handle(Dico_DictionaryOfTransient)& list, const Standard_Integer nbnuls) { thelastval.Clear(); thename = new TCollection_HAsciiString (name); thedicount = count; thediclist = list; thenbnuls = nbnuls; if (thediclist.IsNull()) thelistat = Standard_False; } Handle(TColStd_HSequenceOfHAsciiString) IFSelect_SignatureList::List (const Standard_CString root) const { Handle(TColStd_HSequenceOfHAsciiString) list = new TColStd_HSequenceOfHAsciiString(); Dico_IteratorOfDictionaryOfInteger iter(thedicount,root); for (; iter.More(); iter.Next()) { Handle(TCollection_HAsciiString) sign = new TCollection_HAsciiString (iter.Name()); list->Append(sign); } return list; } Standard_Boolean IFSelect_SignatureList::HasEntities () const { return thelistat; } Standard_Integer IFSelect_SignatureList::NbNulls () const { return thenbnuls; } Standard_Integer IFSelect_SignatureList::NbTimes (const Standard_CString sign) const { Standard_Integer nb; if (thedicount->GetItem(sign,nb)) return nb; else return 0; } Handle(TColStd_HSequenceOfTransient) IFSelect_SignatureList::Entities (const Standard_CString sign) const { Handle(TColStd_HSequenceOfTransient) list; if (!thelistat) return list; if (thediclist->GetItem(sign,list)) return list; list = new TColStd_HSequenceOfTransient(); return list; } void IFSelect_SignatureList::SetName (const Standard_CString name) { thename = new TCollection_HAsciiString (name); } Standard_CString IFSelect_SignatureList::Name () const { return thename->ToCString(); } void IFSelect_SignatureList::PrintCount (const Handle(Message_Messenger)& S) const { Standard_Integer nbtot = 0, nbsign = 0; Dico_IteratorOfDictionaryOfInteger iter(thedicount,""); S << " Count "<ToCString()<<"\n ----- -----------"< 0) S << thename->ToCString()<< " Nul : " << thenbnuls<Length(); S<<" - Nb: "< 5 && mod == IFSelect_ShortByItem) nc = 5; for (Standard_Integer i = 1; i <= nc; i ++) { if (list->Value(i).IsNull()) { S<<" 0"; if (mod == IFSelect_EntitiesByItem) S<<":(Global)"; continue; } Standard_Integer num = model->Number(list->Value(i)); if (num == IFSelect_ShortByItem) { S<<" ??"; continue; } S<<" "<PrintLabel(list->Value(i),S); } } if (nc < nb) S<<" .. etc"; S<ToCString()<<"\n ----- -----------"< maxent) maxent = nbent; TCollection_AsciiString name = iter.Name(); // if (!name.IsIntegerValue()) continue; pas bien fiable Standard_Integer ic, nc = name.Length(); Standard_Boolean iaint = Standard_True; for (ic = 1; ic <= nc; ic ++) { char unc = name.Value(ic); if (ic == 1 && (unc == ' ' || unc == '+' || unc == '-')) continue; if (unc >= '0' && unc <= '9') continue; iaint = Standard_False; break; } if (!iaint) continue; Standard_Integer val = name.IntegerValue(); if (nbval == 0) { minval = maxval = val; } if (minval > val) minval = val; if (maxval < val) maxval = val; nbval ++; nbve += nbent; totval += (val*nbent); } S << " Nb Total:"< 0) { S<<" Summary on Integer Values"<