|
||||
File indexing completed on 2025-01-18 10:03:54
0001 // Created on: 1993-08-26 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 _IFSelect_ModelCopier_HeaderFile 0018 #define _IFSelect_ModelCopier_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <IFSelect_SequenceOfInterfaceModel.hxx> 0024 #include <TColStd_SequenceOfAsciiString.hxx> 0025 #include <IFSelect_SequenceOfAppliedModifiers.hxx> 0026 #include <TColStd_HArray1OfInteger.hxx> 0027 #include <TColStd_HSequenceOfHAsciiString.hxx> 0028 #include <Standard_Transient.hxx> 0029 #include <Standard_Integer.hxx> 0030 class IFSelect_ShareOut; 0031 class TCollection_AsciiString; 0032 class Interface_InterfaceModel; 0033 class IFSelect_AppliedModifiers; 0034 class Interface_CheckIterator; 0035 class IFSelect_ShareOutResult; 0036 class IFSelect_WorkLibrary; 0037 class Interface_Protocol; 0038 class Interface_CopyTool; 0039 class Interface_Graph; 0040 class Interface_EntityIterator; 0041 0042 class IFSelect_ModelCopier; 0043 DEFINE_STANDARD_HANDLE(IFSelect_ModelCopier, Standard_Transient) 0044 0045 //! This class performs the Copy operations involved by the 0046 //! description of a ShareOut (evaluated by a ShareOutResult) 0047 //! plus, if there are, the Modifications on the results, with 0048 //! the help of Modifiers. Each Modifier can work on one or more 0049 //! resulting packets, according to its criteria : it operates on 0050 //! a Model once copied and filled with the content of the packet. 0051 //! 0052 //! Modifiers can be : 0053 //! - Model Modifiers, inheriting from the specific class Modifier 0054 //! able to run on the content of a Model (header or entities), 0055 //! activated by the ModelCopier itself 0056 //! - File Modifiers, inheriting directly from GeneralModifier, 0057 //! intended to be activated under the control of a WorkLibrary, 0058 //! once the Model has been produced (i.e. to act on output 0059 //! format, or other specific file features) 0060 //! 0061 //! The Copy operations can be : 0062 //! - immediately put to files : for each packet, a Model is 0063 //! created and filled, then the file is output, at that's all 0064 //! - memorized : for each packet, a Model is created and filled, 0065 //! it is memorized with the corresponding file name. 0066 //! it is possible to query the result of memorization (list of 0067 //! produced Models and their file names) 0068 //! -> it is also possible to send it into the files : 0069 //! once files are written, the result is cleared 0070 //! 0071 //! In addition, a list of really written files is managed : 0072 //! A first call to BeginSentFiles clears the list and commands, 0073 //! either to begin a new list, or to stop recording it. A call 0074 //! to SentFiles returns the list (if recording has been required) 0075 //! This list allows to globally exploit the set of produced files 0076 //! 0077 //! Remark : For operations which concern specific Entities, see 0078 //! also in package IFAdapt : a sub-class of ModelCopier allows 0079 //! to work with EntityModifier, in addition to Modifier itself 0080 //! which still applies to a whole copied Model. 0081 class IFSelect_ModelCopier : public Standard_Transient 0082 { 0083 0084 public: 0085 0086 //! Creates an empty ModelCopier 0087 Standard_EXPORT IFSelect_ModelCopier(); 0088 0089 //! Sets the ShareOut, which is used to define Modifiers to apply 0090 Standard_EXPORT void SetShareOut (const Handle(IFSelect_ShareOut)& sho); 0091 0092 //! Clears the list of produced Models 0093 Standard_EXPORT void ClearResult(); 0094 0095 //! Records a new File to be sent, as a couple 0096 //! (Name as AsciiString, Content as InterfaceModel) 0097 //! Returns True if Done, False if <filename> is already attached 0098 //! to another File 0099 Standard_EXPORT Standard_Boolean AddFile (const TCollection_AsciiString& filename, const Handle(Interface_InterfaceModel)& content); 0100 0101 //! Changes the Name attached to a File which was formerly defined 0102 //! by a call to AddFile 0103 //! Returns True if Done, False else : if <num> out of range or if 0104 //! the new <filename> is already attached to another File 0105 //! Remark : Giving an empty File Name is equivalent to ClearFile 0106 Standard_EXPORT Standard_Boolean NameFile (const Standard_Integer num, const TCollection_AsciiString& filename); 0107 0108 //! Clears the Name attached to a File which was formerly defined 0109 //! by a call to AddFile. This Clearing can be undone by a call to 0110 //! NameFile (with same <num>) 0111 //! Returns True if Done, False else : if <num> is out of range 0112 Standard_EXPORT Standard_Boolean ClearFile (const Standard_Integer num); 0113 0114 //! Sets a list of File Modifiers to be applied on a file 0115 Standard_EXPORT Standard_Boolean SetAppliedModifiers (const Standard_Integer num, const Handle(IFSelect_AppliedModifiers)& applied); 0116 0117 //! Clears the list of File Modifiers to be applied on a file 0118 Standard_EXPORT Standard_Boolean ClearAppliedModifiers (const Standard_Integer num); 0119 0120 //! Performs the Copy Operations, which include the Modifications 0121 //! defined by the list of Modifiers. Memorizes the result, as a 0122 //! list of InterfaceModels with the corresponding FileNames 0123 //! They can then be sent, by the method Send, or queried 0124 //! Copy calls internal method Copying. 0125 //! Returns the produced CheckList 0126 Standard_EXPORT Interface_CheckIterator Copy (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); 0127 0128 //! Sends the formerly defined results (see method Copy) to files, 0129 //! then clears it 0130 //! Remark : A Null File Name cause file to be not produced 0131 Standard_EXPORT Interface_CheckIterator SendCopied (const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); 0132 0133 //! Performs the Copy Operations (which include the Modifications) 0134 //! and Sends the result on files, without memorizing it. 0135 //! (the memorized result is ignored : neither queried not filled) 0136 Standard_EXPORT Interface_CheckIterator Send (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); 0137 0138 //! Sends a model (defined in <G>) into one file, without managing 0139 //! remaining data, already sent files, etc. Applies the Model and 0140 //! File Modifiers. 0141 //! Returns True if well done, False else 0142 Standard_EXPORT Interface_CheckIterator SendAll (const Standard_CString filename, const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); 0143 0144 //! Sends a part of a model into one file. Model is gotten from 0145 //! <G>, the part is defined in <iter>. 0146 //! Remaining data are managed and can be later be worked on. 0147 //! Returns True if well done, False else 0148 Standard_EXPORT Interface_CheckIterator SendSelected (const Standard_CString filename, const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, const Interface_EntityIterator& iter); 0149 0150 //! Produces a Model copied from the Remaining List as <newmod> 0151 //! <newmod> is a Null Handle if this list is empty 0152 //! <WL> performs the copy by using <TC> 0153 //! <TC> is assumed to have been defined with the starting model 0154 //! same as defined by <G>. 0155 Standard_EXPORT void CopiedRemaining (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod); 0156 0157 //! Updates Graph status for remaining data, for each entity : 0158 //! - Entities just Sent to file or Copied (by CopiedRemaining) 0159 //! have their status set to 1 0160 //! - the other keep their former status (1 for Send/Copied, 0161 //! 0 for Remaining) 0162 //! These status are computed by Copying/Sending/CopiedRemaining 0163 //! Then, SetRemaining updates graph status, and mustr be called 0164 //! just after one of these method has been called 0165 //! Returns True if done, False if remaining info if not in phase 0166 //! which the Graph (not same counts of items) 0167 Standard_EXPORT Standard_Boolean SetRemaining (Interface_Graph& CG) const; 0168 0169 //! Returns the count of Files produced, i.e. the count of Models 0170 //! memorized (produced by the mmethod Copy) with their file names 0171 Standard_EXPORT Standard_Integer NbFiles() const; 0172 0173 //! Returns the File Name for a file given its rank 0174 //! It is empty after a call to ClearFile on same <num> 0175 Standard_EXPORT TCollection_AsciiString FileName (const Standard_Integer num) const; 0176 0177 //! Returns the content of a file before sending, under the form 0178 //! of an InterfaceModel, given its rank 0179 Standard_EXPORT Handle(Interface_InterfaceModel) FileModel (const Standard_Integer num) const; 0180 0181 //! Returns the list of File Modifiers to be applied on a file 0182 //! when it will be sent, as computed by CopiedModel : 0183 //! If it is a null handle, no File Modifier has to be applied. 0184 Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers (const Standard_Integer num) const; 0185 0186 //! Begins a sequence of recording the really sent files 0187 //! <sho> : the default file numbering is cleared 0188 //! If <record> is False, clears the list and stops recording 0189 //! If <record> is True, clears the list and commands recording 0190 //! Creation time corresponds to "stop recording" 0191 Standard_EXPORT void BeginSentFiles (const Handle(IFSelect_ShareOut)& sho, const Standard_Boolean record); 0192 0193 //! Adds the name of a just sent file, if BeginSentFiles 0194 //! has commanded recording; else does nothing 0195 //! It is called by methods SendCopied Sending 0196 Standard_EXPORT void AddSentFile (const Standard_CString filename); 0197 0198 //! Returns the list of recorded names of sent files. Can be empty 0199 //! (if no file has been sent). Returns a Null Handle if 0200 //! BeginSentFiles has stopped recording. 0201 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) SentFiles() const; 0202 0203 DEFINE_STANDARD_RTTIEXT(IFSelect_ModelCopier,Standard_Transient) 0204 0205 protected: 0206 0207 //! Internal routine which does the effective Copy. It allows to 0208 //! work, either with a standard CopyTool, or a specialised one 0209 //! Copying itself is done by <WL> which uses a CopyTool 0210 Standard_EXPORT Interface_CheckIterator Copying (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC); 0211 0212 //! Internal routine which does the effective Send. It allows to 0213 //! work, either with a standard CopyTool, or a specialised one 0214 Standard_EXPORT Interface_CheckIterator Sending (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC); 0215 0216 //! Performs the Copy of a unitary Packet 0217 //! Input parameters are : 0218 //! <G> is the graph which defines the starting entities, it 0219 //! contains the original InterfaceModel 0220 //! <WL> performs the copy by using <TC> 0221 //! <protocol> is the used protocol (can be useful for Modifiers) 0222 //! <topcopy> is the list of Entities which are the Roots of the 0223 //! packet to be copied 0224 //! <filename> is the name of the file which will receive it 0225 //! <dispid> is the Identifier of the Dispatch which have produced 0226 //! this packet, <numod> is the rank of the packet for this 0227 //! Dispatch 0228 //! <TC> is a CopyTool, which performs the copy 0229 //! 0230 //! Returned values (as arguments) are : 0231 //! <newmod> is the result of the copy, as a new InterfaceModel on 0232 //! which Model Modifiers have already been applied (if there are) 0233 //! <applied> determines the File Modifiers which remain to be 0234 //! applied (when the file itself will be output) : for each File 0235 //! Modifier recorded in <me>, <applied>'s Value is : 0236 //! - Null if this Modifier has not to be applied 0237 //! - an empty list if this Modifier has to be applied without 0238 //! distinguishing specific entities 0239 //! - a list of numbers of entities in <model> if this Modifier 0240 //! concerns particularly these entities (which are the results 0241 //! of copying the result of its input selection) 0242 //! <checks> is the produced Check List (by Modifiers as required) 0243 //! 0244 //! Warning : File Modifiers are evaluated at the time of Copy itself 0245 //! If their list is changed between this Copy and the Sending 0246 //! itself of the file, these changes are ignored 0247 Standard_EXPORT void CopiedModel (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, const Interface_EntityIterator& topcopy, const TCollection_AsciiString& filename, const Standard_Integer dispnum, const Standard_Integer numod, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod, Handle(IFSelect_AppliedModifiers)& applied, Interface_CheckIterator& checks) const; 0248 0249 private: 0250 0251 IFSelect_SequenceOfInterfaceModel thefilemodels; 0252 TColStd_SequenceOfAsciiString thefilenames; 0253 IFSelect_SequenceOfAppliedModifiers theapplieds; 0254 Handle(IFSelect_ShareOut) theshareout; 0255 Handle(TColStd_HArray1OfInteger) theremain; 0256 Handle(TColStd_HSequenceOfHAsciiString) thesentfiles; 0257 0258 }; 0259 0260 #endif // _IFSelect_ModelCopier_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |