|
||||
File indexing completed on 2025-01-18 10:04:07
0001 // Created on: 1992-09-22 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1992-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 _Interface_Graph_HeaderFile 0018 #define _Interface_Graph_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <Interface_BitMap.hxx> 0025 #include <Interface_InterfaceModel.hxx> 0026 0027 #include <TCollection_HAsciiString.hxx> 0028 #include <TColStd_HArray1OfInteger.hxx> 0029 #include <TColStd_HArray1OfListOfInteger.hxx> 0030 #include <TColStd_HSequenceOfTransient.hxx> 0031 0032 class Interface_GeneralLib; 0033 class Interface_Protocol; 0034 class Interface_GTool; 0035 class Standard_Transient; 0036 class Interface_EntityIterator; 0037 0038 // resolve name collisions with X11 headers 0039 #ifdef Status 0040 #undef Status 0041 #endif 0042 0043 //! Gives basic data structure for operating and storing 0044 //! graph results (usage is normally internal) 0045 //! Entities are Mapped according their Number in the Model 0046 //! 0047 //! Each Entity from the Model can be known as "Present" or 0048 //! not; if it is, it is Mapped with a Status : an Integer 0049 //! which can be used according to needs of each algorithm 0050 //! In addition, the Graph brings a BitMap which can be used 0051 //! by any caller 0052 //! 0053 //! Also, it is bound with two lists : a list of Shared 0054 //! Entities (in fact, their Numbers in the Model) which is 0055 //! filled by a ShareTool, and a list of Sharing Entities, 0056 //! computed by deduction from the Shared Lists 0057 //! 0058 //! Moreover, it is possible to redefine the list of Entities 0059 //! Shared by an Entity (instead of standard answer by general 0060 //! service Shareds) : this new list can be empty; it can 0061 //! be changed or reset (i.e. to come back to standard answer) 0062 class Interface_Graph 0063 { 0064 public: 0065 0066 DEFINE_STANDARD_ALLOC 0067 0068 0069 //! Creates an empty graph, ready to receive Entities from amodel 0070 //! Note that this way of Creation allows <me> to verify that 0071 //! Entities to work with are contained in <amodel> 0072 //! Basic Shared and Sharing lists are obtained from a General 0073 //! Services Library, given directly as an argument 0074 Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib, const Standard_Boolean theModeStats = Standard_True); 0075 0076 //! Same as above, but the Library is defined through a Protocol 0077 Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol, const Standard_Boolean theModeStats = Standard_True); 0078 0079 //! Same as above, but the Library is defined through a Protocol 0080 Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_GTool)& gtool, const Standard_Boolean theModeStats = Standard_True); 0081 0082 //! Same a above but works with the Protocol recorded in the Model 0083 Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Standard_Boolean theModeStats = Standard_True); 0084 0085 //! Creates a Graph from another one, getting all its data 0086 //! Remark that status are copied from <agraph>, but the other 0087 //! lists (sharing/shared) are copied only if <copied> = True 0088 Standard_EXPORT Interface_Graph(const Interface_Graph& agraph, const Standard_Boolean copied = Standard_False); 0089 0090 //! Assignment 0091 Standard_EXPORT Interface_Graph& operator= (const Interface_Graph& theOther); 0092 0093 //! Erases data, making graph ready to rebegin from void 0094 //! (also resets Shared lists redefinitions) 0095 Standard_EXPORT void Reset(); 0096 0097 //! Erases Status (Values and Flags of Presence), making graph 0098 //! ready to rebegin from void. Does not concerns Shared lists 0099 Standard_EXPORT void ResetStatus(); 0100 0101 //! Returns size (max nb of entities, i.e. Model's nb of entities) 0102 Standard_EXPORT Standard_Integer Size() const; 0103 0104 //! Returns size of array of statuses 0105 Standard_EXPORT Standard_Integer NbStatuses() const; 0106 0107 //! Returns the Number of the entity in the Map, computed at 0108 //! creation time (Entities loaded from the Model) 0109 //! Returns 0 if <ent> not contained by Model used to create <me> 0110 //! (that is, <ent> is unknown from <me>) 0111 Standard_EXPORT Standard_Integer EntityNumber (const Handle(Standard_Transient)& ent) const; 0112 0113 //! Returns True if an Entity is noted as present in the graph 0114 //! (See methods Get... which determine this status) 0115 //! Returns False if <num> is out of range too 0116 Standard_EXPORT Standard_Boolean IsPresent (const Standard_Integer num) const; 0117 0118 //! Same as above but directly on an Entity <ent> : if it is not 0119 //! contained in the Model, returns False. Else calls 0120 //! IsPresent(num) with <num> given by EntityNumber 0121 Standard_EXPORT Standard_Boolean IsPresent (const Handle(Standard_Transient)& ent) const; 0122 0123 //! Returns mapped Entity given its no (if it is present) 0124 Standard_EXPORT const Handle(Standard_Transient)& Entity (const Standard_Integer num) const; 0125 0126 //! Returns Status associated to a numero (only to read it) 0127 Standard_EXPORT Standard_Integer Status (const Standard_Integer num) const; 0128 0129 //! Modifies Status associated to a numero 0130 Standard_EXPORT void SetStatus (const Standard_Integer num, const Standard_Integer stat); 0131 0132 //! Clears Entity and sets Status to 0, for a numero 0133 Standard_EXPORT void RemoveItem (const Standard_Integer num); 0134 0135 //! Changes all status which value is oldstat to new value newstat 0136 Standard_EXPORT void ChangeStatus (const Standard_Integer oldstat, const Standard_Integer newstat); 0137 0138 //! Removes all items of which status has a given value stat 0139 Standard_EXPORT void RemoveStatus (const Standard_Integer stat); 0140 0141 //! Returns the Bit Map in order to read or edit flag values 0142 Standard_EXPORT const Interface_BitMap& BitMap() const; 0143 0144 //! Returns the Bit Map in order to edit it (add new flags) 0145 Standard_EXPORT Interface_BitMap& CBitMap(); 0146 0147 //! Returns the Model with which this Graph was created 0148 Standard_EXPORT const Handle(Interface_InterfaceModel)& Model() const; 0149 0150 //! Loads Graph with all Entities contained in the Model 0151 Standard_EXPORT void GetFromModel(); 0152 0153 //! Gets an Entity, plus its shared ones (at every level) if 0154 //! "shared" is True. New items are set to status "newstat" 0155 //! Items already present in graph remain unchanged 0156 //! Of course, redefinitions of Shared lists are taken into 0157 //! account if there are some 0158 Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean shared, const Standard_Integer newstat = 0); 0159 0160 //! Gets an Entity, plus its shared ones (at every level) if 0161 //! "shared" is True. New items are set to status "newstat". 0162 //! Items already present in graph are processed as follows : 0163 //! - if they already have status "newstat", they remain unchanged 0164 //! - if they have another status, this one is modified : 0165 //! if cumul is True, to former status + overlapstat (cumul) 0166 //! if cumul is False, to overlapstat (enforce) 0167 Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean shared, const Standard_Integer newstat, const Standard_Integer overlapstat, const Standard_Boolean cumul); 0168 0169 //! Gets Entities given by an EntityIterator. Entities which were 0170 //! not yet present in the graph are mapped with status "newstat" 0171 //! Entities already present remain unchanged 0172 Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter, const Standard_Integer newstat); 0173 0174 //! Gets Entities given by an EntityIterator and distinguishes 0175 //! those already present in the Graph : 0176 //! - new entities added to the Graph with status "newstst" 0177 //! - entities already present with status = "newstat" remain 0178 //! unchanged 0179 //! - entities already present with status different form 0180 //! "newstat" have their status modified : 0181 //! if cumul is True, to former status + overlapstat (cumul) 0182 //! if cumul is False, to overlapstat (enforce) 0183 //! (Note : works as GetEntity, shared = False, for each entity) 0184 Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter, const Standard_Integer newstat, const Standard_Integer overlapstat, const Standard_Boolean cumul); 0185 0186 //! Gets all present items from another graph 0187 Standard_EXPORT void GetFromGraph (const Interface_Graph& agraph); 0188 0189 //! Gets items from another graph which have a specific Status 0190 Standard_EXPORT void GetFromGraph (const Interface_Graph& agraph, const Standard_Integer stat); 0191 0192 //! Returns True if <ent> or the list of entities shared by <ent> 0193 //! (not redefined) contains items unknown from this Graph 0194 //! Remark : apart from the status HasShareError, these items 0195 //! are ignored 0196 Standard_EXPORT Standard_Boolean HasShareErrors (const Handle(Standard_Transient)& ent) const; 0197 0198 //! Returns the sequence of Entities Shared by an Entity 0199 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShareds (const Handle(Standard_Transient)& ent) const; 0200 0201 //! Returns the list of Entities Shared by an Entity, as recorded 0202 //! by the Graph. That is, by default Basic Shared List, else it 0203 //! can be redefined by methods SetShare, SetNoShare ... see below 0204 Standard_EXPORT Interface_EntityIterator Shareds (const Handle(Standard_Transient)& ent) const; 0205 0206 //! Returns the list of Entities which Share an Entity, computed 0207 //! from the Basic or Redefined Shared Lists 0208 Standard_EXPORT Interface_EntityIterator Sharings (const Handle(Standard_Transient)& ent) const; 0209 0210 //! Returns the sequence of Entities Sharings by an Entity 0211 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharings (const Handle(Standard_Transient)& ent) const; 0212 0213 //! Returns the list of sharings entities, AT ANY LEVEL, which are 0214 //! kind of a given type. A sharing entity kind of this type 0215 //! ends the exploration of its branch 0216 Standard_EXPORT Interface_EntityIterator TypedSharings (const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& type) const; 0217 0218 //! Returns the Entities which are not Shared (their Sharing List 0219 //! is empty) in the Model 0220 Standard_EXPORT Interface_EntityIterator RootEntities() const; 0221 0222 //! Determines the name attached to an entity, by using the 0223 //! general service Name in GeneralModule 0224 //! Returns a null handle if no name could be computed or if 0225 //! the entity is not in the model 0226 Standard_EXPORT Handle(TCollection_HAsciiString) Name (const Handle(Standard_Transient)& ent) const; 0227 0228 //! Returns the Table of Sharing lists. Used to Create 0229 //! another Graph from <me> 0230 Standard_EXPORT const Handle(TColStd_HArray1OfListOfInteger)& SharingTable() const; 0231 0232 //! Returns mode responsible for computation of statuses; 0233 Standard_EXPORT Standard_Boolean ModeStat() const; 0234 0235 0236 0237 0238 protected: 0239 0240 0241 //! Initialize statuses and flags 0242 Standard_EXPORT void InitStats(); 0243 0244 0245 Handle(Interface_InterfaceModel) themodel; 0246 TCollection_AsciiString thepresents; 0247 Handle(TColStd_HArray1OfInteger) thestats; 0248 Handle(TColStd_HArray1OfListOfInteger) thesharings; 0249 0250 0251 private: 0252 0253 0254 //! Performs the Evaluation of the Graph, from an initial Library, 0255 //! either defined through a Protocol, or given dierctly 0256 //! Called by the non-empty Constructors 0257 //! 0258 //! Normally, gtool suffices. But if a Graph is created from a 0259 //! GeneralLib directly, it cannot be used 0260 //! If <gtool> is defined, it has priority 0261 Standard_EXPORT void Evaluate(); 0262 0263 0264 Interface_BitMap theflags; 0265 0266 0267 }; 0268 0269 0270 0271 0272 0273 0274 0275 #endif // _Interface_Graph_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |