|
|
|||
File indexing completed on 2026-09-14 09:15:00
0001 // Created on: 1993-02-02 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1993-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_CopyTool_HeaderFile 0018 #define _Interface_CopyTool_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_GeneralLib.hxx> 0026 #include <Standard_Integer.hxx> 0027 #include <NCollection_Sequence.hxx> 0028 class Interface_InterfaceModel; 0029 class Interface_CopyControl; 0030 class Interface_CopyMap; 0031 class Standard_Transient; 0032 class Interface_GeneralModule; 0033 class Interface_Protocol; 0034 class Interface_EntityIterator; 0035 0036 //! Performs Deep Copies of sets of Entities 0037 //! Allows to perform Copy of Interface Entities from a Model to 0038 //! another one. Works by calling general services GetFromAnother 0039 //! and GetImplied. 0040 //! Uses a CopyMap to bind a unique Result to each Copied Entity 0041 //! 0042 //! It is possible to command Copies of Entities (and those they 0043 //! reference) by call to the General Service Library, or to 0044 //! enforce results for transfer of some Entities (calling Bind) 0045 //! 0046 //! A Same CopyTool can be used for several successive Copies from 0047 //! the same Model : either by restarting from scratch (e.g. to 0048 //! copy different parts of a starting Model to several Targets), 0049 //! or incremental : in that case, it is possible to know what is 0050 //! the content of the last increment (defined by last call to 0051 //! ClearLastFlags and queried by call to LastCopiedAfter) 0052 //! 0053 //! Works in two times : first, create the list of copied Entities 0054 //! second, pushes them to a target Model (manages also Model's 0055 //! Header) or returns the Result as an Iterator, as desired 0056 //! 0057 //! The core action (Copy) works by using ShallowCopy (method 0058 //! attached to each class) and Copy from GeneralLib (itself using 0059 //! dedicated tools). It can be redefined for specific actions. 0060 class Interface_CopyTool 0061 { 0062 public: 0063 DEFINE_STANDARD_ALLOC 0064 0065 //! Creates a CopyTool adapted to work from a Model. Works 0066 //! with a General Service Library, given as an argument 0067 Standard_EXPORT Interface_CopyTool(const occ::handle<Interface_InterfaceModel>& amodel, 0068 const Interface_GeneralLib& lib); 0069 0070 //! Same as above, but Library is defined through a Protocol 0071 Standard_EXPORT Interface_CopyTool(const occ::handle<Interface_InterfaceModel>& amodel, 0072 const occ::handle<Interface_Protocol>& protocol); 0073 0074 //! Same as above, but works with the Active Protocol 0075 Standard_EXPORT Interface_CopyTool(const occ::handle<Interface_InterfaceModel>& amodel); 0076 0077 //! Returns the Model on which the CopyTool works 0078 Standard_EXPORT occ::handle<Interface_InterfaceModel> Model() const; 0079 0080 //! Changes the Map of Result for another one. This allows to work 0081 //! with a more sophisticated Mapping Control than the Standard 0082 //! one which is CopyMap (e.g. TransferProcess from Transfer) 0083 Standard_EXPORT void SetControl(const occ::handle<Interface_CopyControl>& othermap); 0084 0085 //! Returns the object used for Control 0086 Standard_EXPORT occ::handle<Interface_CopyControl> Control() const; 0087 0088 //! Clears Transfer List. Gets Ready to begin another Transfer 0089 Standard_EXPORT virtual void Clear(); 0090 0091 //! Creates the CounterPart of an Entity (by ShallowCopy), Binds 0092 //! it, then Copies the content of the former Entity to the other 0093 //! one (same Type), by call to the General Service Library 0094 //! It may command the Copy of Referenced Entities 0095 //! Then, its returns True. 0096 //! 0097 //! If <mapped> is True, the Map is used to store the Result 0098 //! Else, the Result is simply produced : it can be used to Copy 0099 //! internal sub-parts of Entities, which are not intended to be 0100 //! shared (Strings, Arrays, etc...) 0101 //! If <errstat> is True, this means that the Entity is recorded 0102 //! in the Model as Erroneous : in this case, the General Service 0103 //! for Deep Copy is not called (this could be dangerous) : hence 0104 //! the Counter-Part is produced but empty, it can be referenced. 0105 //! 0106 //! This method does nothing and returns False if the Protocol 0107 //! does not recognize <ent>. 0108 //! It basically makes a Deep Copy without changing the Types. 0109 //! It can be redefined for special uses. 0110 Standard_EXPORT virtual bool Copy(const occ::handle<Standard_Transient>& entfrom, 0111 occ::handle<Standard_Transient>& entto, 0112 const bool mapped, 0113 const bool errstat); 0114 0115 //! Transfers one Entity, if not yet bound to a result 0116 //! Remark : For an Entity which is reported in the Starting Model, 0117 //! the ReportEntity will also be copied with its Content if it 0118 //! has one (at least ShallowCopy; Complete Copy if the Protocol 0119 //! recognizes the Content : see method Copy) 0120 Standard_EXPORT occ::handle<Standard_Transient> Transferred( 0121 const occ::handle<Standard_Transient>& ent); 0122 0123 //! Defines a Result for the Transfer of a Starting object. 0124 //! Used by method Transferred (which performs a normal Copy), 0125 //! but can also be called to enforce a result : in the latter 0126 //! case, the enforced result must be compatible with the other 0127 //! Transfers which are performed 0128 Standard_EXPORT void Bind(const occ::handle<Standard_Transient>& ent, 0129 const occ::handle<Standard_Transient>& res); 0130 0131 //! Search for the result of a Starting Object (i.e. an Entity) 0132 //! Returns True if a Result is Bound (and fills "result") 0133 //! Returns False if no result is Bound 0134 Standard_EXPORT bool Search(const occ::handle<Standard_Transient>& ent, 0135 occ::handle<Standard_Transient>& res) const; 0136 0137 //! Clears LastFlags only. This allows to know what Entities are 0138 //! copied after its call (see method LastCopiedAfter). It can be 0139 //! used when copies are done by increments, which must be 0140 //! distinguished. ClearLastFlags is also called by Clear. 0141 Standard_EXPORT void ClearLastFlags(); 0142 0143 //! Returns an copied Entity and its Result which were operated 0144 //! after last call to ClearLastFlags. It returns the first 0145 //! "Last Copied Entity" which Number follows <numfrom>, Zero if 0146 //! none. It is used in a loop as follow : 0147 //! Integer num = 0; 0148 //! while ( (num = CopyTool.LastCopiedAfter(num,ent,res)) ) { 0149 //! .. Process Starting <ent> and its Result <res> 0150 //! } 0151 Standard_EXPORT int LastCopiedAfter(const int numfrom, 0152 occ::handle<Standard_Transient>& ent, 0153 occ::handle<Standard_Transient>& res) const; 0154 0155 //! Transfers one Entity and records result into the Transfer List 0156 //! Calls method Transferred 0157 Standard_EXPORT void TransferEntity(const occ::handle<Standard_Transient>& ent); 0158 0159 //! Renews the Implied References. These References do not involve 0160 //! Copying of referenced Entities. For such a Reference, if the 0161 //! Entity which defines it AND the referenced Entity are both 0162 //! copied, then this Reference is renewed. Else it is deleted in 0163 //! the copied Entities. 0164 //! Remark : this concerns only some specific references, such as 0165 //! "back pointers". 0166 Standard_EXPORT void RenewImpliedRefs(); 0167 0168 //! Fills a Model with the result of the transfer (TransferList) 0169 //! Commands copy of Header too, and calls RenewImpliedRefs 0170 Standard_EXPORT void FillModel(const occ::handle<Interface_InterfaceModel>& bmodel); 0171 0172 //! Returns the complete list of copied Entities 0173 //! If <withreports> is given True, the entities which were 0174 //! reported in the Starting Model are replaced in the list 0175 //! by the copied ReportEntities 0176 Standard_EXPORT Interface_EntityIterator CompleteResult(const bool withreports = false) const; 0177 0178 //! Returns the list of Root copied Entities (those which were 0179 //! asked for copy by the user of CopyTool, not by copying 0180 //! another Entity) 0181 Standard_EXPORT Interface_EntityIterator RootResult(const bool withreports = false) const; 0182 Standard_EXPORT virtual ~Interface_CopyTool(); 0183 0184 protected: 0185 //! Creates a new void instance (just created) of the same class 0186 //! as <entfrom>. Uses the general service GeneralModule:NewVoid 0187 //! Returns True if OK (Recognize has succeeded), False else 0188 //! (in such a case, the standard method ShallowCopy is called 0189 //! to produce <ento> from <entfrom> : hence it is not void) 0190 //! 0191 //! No mapping is managed by this method 0192 Standard_EXPORT virtual bool NewVoid(const occ::handle<Standard_Transient>& entfrom, 0193 occ::handle<Standard_Transient>& entto); 0194 0195 Interface_GeneralLib thelib; 0196 0197 private: 0198 //! Renews the Implied References of one already Copied Entity 0199 Standard_EXPORT virtual void Implied(const occ::handle<Standard_Transient>& entfrom, 0200 const occ::handle<Standard_Transient>& entto); 0201 0202 occ::handle<Interface_InterfaceModel> themod; 0203 occ::handle<Interface_CopyControl> themap; 0204 occ::handle<Interface_CopyMap> therep; 0205 Interface_BitMap thelst; 0206 int thelev; 0207 NCollection_Sequence<int> therts; 0208 bool theimp; 0209 occ::handle<Standard_Transient> theent; 0210 occ::handle<Interface_GeneralModule> themdu; 0211 int theCN; 0212 }; 0213 0214 #endif // _Interface_CopyTool_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|