Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:54

0001 // Created on: 1994-10-27
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IFSelect_SignatureList_HeaderFile
0018 #define _IFSelect_SignatureList_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <Standard_Transient.hxx>
0024 #include <TColStd_HSequenceOfHAsciiString.hxx>
0025 #include <TColStd_HSequenceOfTransient.hxx>
0026 #include <IFSelect_PrintCount.hxx>
0027 #include <NCollection_IndexedDataMap.hxx>
0028 class TCollection_HAsciiString;
0029 class Interface_InterfaceModel;
0030 
0031 
0032 class IFSelect_SignatureList;
0033 DEFINE_STANDARD_HANDLE(IFSelect_SignatureList, Standard_Transient)
0034 
0035 //! A SignatureList is given as result from a Counter (any kind)
0036 //! It gives access to a list of signatures, with counts, and
0037 //! optionally with list of corresponding entities
0038 //!
0039 //! It can also be used only to give a signature, through SignOnly
0040 //! Mode. This can be useful for a specific counter (used in a
0041 //! Selection), while it remains better to use a Signature
0042 //! whenever possible
0043 class IFSelect_SignatureList : public Standard_Transient
0044 {
0045 
0046 public:
0047 
0048   
0049   //! Creates a SignatureList. If <withlist> is True, entities will
0050   //! be not only counted per signature, but also listed.
0051   Standard_EXPORT IFSelect_SignatureList(const Standard_Boolean withlist = Standard_False);
0052   
0053   //! Changes the record-list status. The list is not cleared but
0054   //! its use changes
0055   Standard_EXPORT void SetList (const Standard_Boolean withlist);
0056   
0057   //! Returns modifiable the SignOnly Mode
0058   //! If False (D), the counter normally counts
0059   //! If True, the counting work is turned off, Add only fills the
0060   //! LastValue, which can be used as signature, when a counter
0061   //! works from data which are not available from a Signature
0062   Standard_EXPORT Standard_Boolean& ModeSignOnly();
0063   
0064   Standard_EXPORT virtual void Clear();
0065   
0066   //! Adds an entity with its signature, i.e. :
0067   //! - counts an item more for <sign>
0068   //! - if record-list status is set, records the entity
0069   //! Accepts a null entity (the signature is then for the global
0070   //! model). But if the string is empty, counts a Null item.
0071   //!
0072   //! If SignOnly Mode is set, this work is replaced by just
0073   //! setting LastValue
0074   Standard_EXPORT void Add (const Handle(Standard_Transient)& ent, const Standard_CString sign);
0075   
0076   //! Returns the last value recorded by Add (only if SignMode set)
0077   //! Cleared by Clear or Init
0078   Standard_EXPORT Standard_CString LastValue() const;
0079   
0080   //! Aknowledges the list in once. Name identifies the Signature
0081   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);
0082   
0083   //! Returns the list of signatures, as a sequence of strings
0084   //! (but without their respective counts). It is ordered.
0085   //! By default, for all the signatures.
0086   //! If <root> is given non empty, for the signatures which
0087   //! begin by <root>
0088   Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) List (const Standard_CString root = "") const;
0089   
0090   //! Returns True if the list of Entities is aknowledged, else
0091   //! the method Entities will always return a Null Handle
0092   Standard_EXPORT Standard_Boolean HasEntities() const;
0093   
0094   //! Returns the count of null entities
0095   Standard_EXPORT Standard_Integer NbNulls() const;
0096   
0097   //! Returns the number of times a signature was counted,
0098   //! 0 if it has not been recorded at all
0099   Standard_EXPORT Standard_Integer NbTimes (const Standard_CString sign) const;
0100   
0101   //! Returns the list of entities attached to a signature
0102   //! It is empty if <sign> has not been recorded
0103   //! It is a Null Handle if the list of entities is not known
0104   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Entities (const Standard_CString sign) const;
0105   
0106   //! Defines a name for a SignatureList (used to print it)
0107   Standard_EXPORT void SetName (const Standard_CString name);
0108   
0109   //! Returns the recorded Name.
0110   //! Remark : default is "..." (no SetName called)
0111   Standard_EXPORT virtual Standard_CString Name() const;
0112   
0113   //! Prints the counts of items (not the list)
0114   Standard_EXPORT virtual void PrintCount (Standard_OStream& S) const;
0115   
0116   //! Prints the lists of items, if they are present (else, prints
0117   //! a message "no list available")
0118   //! Uses <model> to determine for each entity to be listed, its
0119   //! number, and its specific identifier (by PrintLabel)
0120   //! <mod> gives a mode for printing :
0121   //! - CountByItem : just count (as PrintCount)
0122   //! - ShortByItem : minimum i.e. count plus 5 first entity numbers
0123   //! - ShortByItem(D) complete list of entity numbers (0: "Global")
0124   //! - EntitiesByItem : list of (entity number/PrintLabel from the model)
0125   //! other modes are ignored
0126   Standard_EXPORT virtual void PrintList (Standard_OStream& S, const Handle(Interface_InterfaceModel)& model, const IFSelect_PrintCount mod = IFSelect_ListByItem) const;
0127   
0128   //! Prints a summary
0129   //! Item which has the greatest count of entities
0130   //! For items which are numeric values : their count, maximum,
0131   //! minimum values, cumul, average
0132   Standard_EXPORT virtual void PrintSum (Standard_OStream& S) const;
0133 
0134 
0135 
0136 
0137   DEFINE_STANDARD_RTTIEXT(IFSelect_SignatureList,Standard_Transient)
0138 
0139 protected:
0140 
0141 
0142 
0143 
0144 private:
0145 
0146 
0147   Standard_Boolean thesignonly;
0148   Standard_Boolean thelistat;
0149   Standard_Integer thenbnuls;
0150   Handle(TCollection_HAsciiString) thename;
0151   TCollection_AsciiString thelastval;
0152   NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer> thedicount;
0153   NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)> thediclist;
0154 
0155 
0156 };
0157 
0158 
0159 
0160 
0161 
0162 
0163 
0164 #endif // _IFSelect_SignatureList_HeaderFile