|
|
|||
File indexing completed on 2026-09-16 09:17:27
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 <TCollection_HAsciiString.hxx> 0025 #include <NCollection_Sequence.hxx> 0026 #include <NCollection_HSequence.hxx> 0027 #include <IFSelect_PrintCount.hxx> 0028 #include <NCollection_IndexedDataMap.hxx> 0029 class TCollection_HAsciiString; 0030 class Interface_InterfaceModel; 0031 0032 //! A SignatureList is given as result from a Counter (any kind) 0033 //! It gives access to a list of signatures, with counts, and 0034 //! optionally with list of corresponding entities 0035 //! 0036 //! It can also be used only to give a signature, through SignOnly 0037 //! Mode. This can be useful for a specific counter (used in a 0038 //! Selection), while it remains better to use a Signature 0039 //! whenever possible 0040 class IFSelect_SignatureList : public Standard_Transient 0041 { 0042 0043 public: 0044 //! Creates a SignatureList. If <withlist> is True, entities will 0045 //! be not only counted per signature, but also listed. 0046 Standard_EXPORT IFSelect_SignatureList(const bool withlist = false); 0047 0048 //! Changes the record-list status. The list is not cleared but 0049 //! its use changes 0050 Standard_EXPORT void SetList(const bool withlist); 0051 0052 //! Returns modifiable the SignOnly Mode 0053 //! If False (D), the counter normally counts 0054 //! If True, the counting work is turned off, Add only fills the 0055 //! LastValue, which can be used as signature, when a counter 0056 //! works from data which are not available from a Signature 0057 Standard_EXPORT bool& ModeSignOnly(); 0058 0059 Standard_EXPORT virtual void Clear(); 0060 0061 //! Adds an entity with its signature, i.e. : 0062 //! - counts an item more for <sign> 0063 //! - if record-list status is set, records the entity 0064 //! Accepts a null entity (the signature is then for the global 0065 //! model). But if the string is empty, counts a Null item. 0066 //! 0067 //! If SignOnly Mode is set, this work is replaced by just 0068 //! setting LastValue 0069 Standard_EXPORT void Add(const occ::handle<Standard_Transient>& ent, const char* const sign); 0070 0071 //! Returns the last value recorded by Add (only if SignMode set) 0072 //! Cleared by Clear or Init 0073 Standard_EXPORT const char* LastValue() const; 0074 0075 //! Acknowledges the list in once. Name identifies the Signature 0076 Standard_EXPORT void Init(const char* const name, 0077 const NCollection_IndexedDataMap<TCollection_AsciiString, int>& count, 0078 const NCollection_IndexedDataMap<TCollection_AsciiString, 0079 occ::handle<Standard_Transient>>& list, 0080 const int nbnuls); 0081 0082 //! Returns the list of signatures, as a sequence of strings 0083 //! (but without their respective counts). It is ordered. 0084 //! By default, for all the signatures. 0085 //! If <root> is given non empty, for the signatures which 0086 //! begin by <root> 0087 Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>> List( 0088 const char* const root = "") const; 0089 0090 //! Returns True if the list of Entities is acknowledged, else 0091 //! the method Entities will always return a Null Handle 0092 Standard_EXPORT bool HasEntities() const; 0093 0094 //! Returns the count of null entities 0095 Standard_EXPORT int 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 int NbTimes(const char* const 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 occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> Entities( 0105 const char* const sign) const; 0106 0107 //! Defines a name for a SignatureList (used to print it) 0108 Standard_EXPORT void SetName(const char* const name); 0109 0110 //! Returns the recorded Name. 0111 //! Remark : default is "..." (no SetName called) 0112 Standard_EXPORT virtual const char* Name() const; 0113 0114 //! Prints the counts of items (not the list) 0115 Standard_EXPORT virtual void PrintCount(Standard_OStream& S) const; 0116 0117 //! Prints the lists of items, if they are present (else, prints 0118 //! a message "no list available") 0119 //! Uses <model> to determine for each entity to be listed, its 0120 //! number, and its specific identifier (by PrintLabel) 0121 //! <mod> gives a mode for printing : 0122 //! - CountByItem : just count (as PrintCount) 0123 //! - ShortByItem : minimum i.e. count plus 5 first entity numbers 0124 //! - ShortByItem(D) complete list of entity numbers (0: "Global") 0125 //! - EntitiesByItem : list of (entity number/PrintLabel from the model) 0126 //! other modes are ignored 0127 Standard_EXPORT virtual void PrintList(Standard_OStream& S, 0128 const occ::handle<Interface_InterfaceModel>& model, 0129 const IFSelect_PrintCount mod = IFSelect_ListByItem) const; 0130 0131 //! Prints a summary 0132 //! Item which has the greatest count of entities 0133 //! For items which are numeric values : their count, maximum, 0134 //! minimum values, cumul, average 0135 Standard_EXPORT virtual void PrintSum(Standard_OStream& S) const; 0136 0137 DEFINE_STANDARD_RTTIEXT(IFSelect_SignatureList, Standard_Transient) 0138 0139 private: 0140 bool thesignonly; 0141 bool thelistat; 0142 int thenbnuls; 0143 occ::handle<TCollection_HAsciiString> thename; 0144 TCollection_AsciiString thelastval; 0145 NCollection_IndexedDataMap<TCollection_AsciiString, int> thedicount; 0146 NCollection_IndexedDataMap<TCollection_AsciiString, occ::handle<Standard_Transient>> thediclist; 0147 }; 0148 0149 #endif // _IFSelect_SignatureList_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|