|
|
|||
File indexing completed on 2026-09-26 09:03:33
0001 // Created on: 1992-11-17 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 _IFSelect_ShareOut_HeaderFile 0018 #define _IFSelect_ShareOut_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <IFSelect_Dispatch.hxx> 0024 #include <NCollection_Sequence.hxx> 0025 #include <IFSelect_GeneralModifier.hxx> 0026 #include <Standard_Integer.hxx> 0027 #include <Standard_Transient.hxx> 0028 class TCollection_HAsciiString; 0029 class IFSelect_Dispatch; 0030 class IFSelect_GeneralModifier; 0031 class IFSelect_Modifier; 0032 class TCollection_AsciiString; 0033 0034 //! This class gathers the information required to produce one or 0035 //! several file(s) from the content of an InterfaceModel (passing 0036 //! through the creation of intermediate Models). 0037 //! 0038 //! It can correspond to a complete Divide up of a set of Entities 0039 //! intended to be exhaustive and to limit duplications. Or to a 0040 //! simple Extraction of some Entities, in order to work on them. 0041 //! 0042 //! A ShareOut is composed of a list of Dispatches. 0043 //! To Each Dispatch in the ShareOut, is bound an Id. Number 0044 //! This Id. Number allows to identify a Display inside the 0045 //! ShareOut in a stable way (for instance, to attach file names) 0046 //! 0047 //! ShareOut can be seen as a "passive" description, activated 0048 //! through a ShareOutResult, which gives the InterfaceModel on 0049 //! which to work, as a unique source. Thus it is easy to change 0050 //! it without coherence problems 0051 //! 0052 //! Services about it are provided by the class ShareOutResult 0053 //! which is a service class : simulation (list of files and of 0054 //! entities per file; "forgotten" entities; duplicated entities), 0055 //! exploitation (generation of derivated Models, each of them 0056 //! generating an output file) 0057 class IFSelect_ShareOut : public Standard_Transient 0058 { 0059 0060 public: 0061 //! Creates an empty ShareOut 0062 Standard_EXPORT IFSelect_ShareOut(); 0063 0064 //! Removes in one operation all the Dispatches with their Idents 0065 //! Also clears all information about Names, and all Results but 0066 //! naming information which are : 0067 //! - kept if <onlydisp> is True. 0068 //! - cleared if <onlydisp> is False (complete clearing) 0069 //! If <onlydisp> is True, that's all. Else, clears also Modifiers 0070 Standard_EXPORT void Clear(const bool onlydisp); 0071 0072 //! Clears all data produced (apart from Dispatches, etc...) 0073 //! if <alsoname> is True, all is cleared. Else, information 0074 //! about produced Names are kept (to maintain unicity of naming 0075 //! across clearings) 0076 Standard_EXPORT void ClearResult(const bool alsoname); 0077 0078 //! Removes an item, which can be, either a Dispatch (removed from 0079 //! the list of Dispatches), or a GeneralModifier (removed from 0080 //! the list of Model Modifiers or from the list of File Modifiers 0081 //! according to its type). 0082 //! Returns True if done, False if has not been found or if it is 0083 //! neither a Dispatch, nor a Modifier. 0084 Standard_EXPORT bool RemoveItem(const occ::handle<Standard_Transient>& item); 0085 0086 //! Returns the rank of last run item (ClearResult resets it to 0) 0087 Standard_EXPORT int LastRun() const; 0088 0089 //! Records a new value for the rank of last run item 0090 Standard_EXPORT void SetLastRun(const int last); 0091 0092 //! Returns the count of Dispatches 0093 Standard_EXPORT int NbDispatches() const; 0094 0095 //! Returns the Rank of a Dispatch, given its Value (Handle). 0096 //! Returns 0 if the Dispatch is unknown in the ShareOut 0097 Standard_EXPORT int DispatchRank(const occ::handle<IFSelect_Dispatch>& disp) const; 0098 0099 //! Returns a Dispatch, given its rank in the list 0100 Standard_EXPORT const occ::handle<IFSelect_Dispatch>& Dispatch(const int num) const; 0101 0102 //! Adds a Dispatch to the list 0103 Standard_EXPORT void AddDispatch(const occ::handle<IFSelect_Dispatch>& disp); 0104 0105 //! Removes a Dispatch, given its rank in the list 0106 //! Returns True if done, False if rank is not between 0107 //! (LastRun + 1) and (NbDispatches) 0108 Standard_EXPORT bool RemoveDispatch(const int rank); 0109 0110 //! Sets a Modifier to be applied on all Dispatches to be run 0111 //! If <modifier> is a ModelModifier, adds it to the list of 0112 //! Model Modifiers; else to the list of File Modifiers 0113 //! By default (atnum = 0) at the end of the list, else at <atnum> 0114 //! Each Modifier is used, after each copy of a packet of Entities 0115 //! into a Model : its criteria are checked and if they are OK, 0116 //! the method Perform of this Modifier is run. 0117 Standard_EXPORT void AddModifier(const occ::handle<IFSelect_GeneralModifier>& modifier, 0118 const int atnum); 0119 0120 //! Sets a Modifier to be applied on the Dispatch <dispnum> 0121 //! If <modifier> is a ModelModifier, adds it to the list of 0122 //! Model Modifiers; else to the list of File Modifiers 0123 //! This is the same list as for all Dispatches, but the 0124 //! Modifier is qualified to be applied to one Dispatch only 0125 //! Then, <atnum> refers to the entire list 0126 //! By default (atnum = 0) at the end of the list, else at <atnum> 0127 //! Remark : if the Modifier was already in the list and if 0128 //! <atnum> = 0, the Modifier is not moved, but only qualified 0129 //! for a Dispatch 0130 Standard_EXPORT void AddModifier(const occ::handle<IFSelect_GeneralModifier>& modifier, 0131 const int dispnum, 0132 const int atnum); 0133 0134 //! Adds a Modifier to the list of Modifiers : Model Modifiers if 0135 //! <formodel> is True, File Modifiers else (internal). 0136 Standard_EXPORT void AddModif(const occ::handle<IFSelect_GeneralModifier>& modifier, 0137 const bool formodel, 0138 const int atnum = 0); 0139 0140 //! Returns count of Modifiers (which apply to complete Models) : 0141 //! Model Modifiers if <formodel> is True, File Modifiers else 0142 Standard_EXPORT int NbModifiers(const bool formodel) const; 0143 0144 //! Returns a Modifier of the list, given its rank : 0145 //! Model Modifiers if <formodel> is True, File Modifiers else 0146 Standard_EXPORT occ::handle<IFSelect_GeneralModifier> GeneralModifier(const bool formodel, 0147 const int num) const; 0148 0149 //! Returns a Modifier of the list of Model Modifiers, duely casted 0150 Standard_EXPORT occ::handle<IFSelect_Modifier> ModelModifier(const int num) const; 0151 0152 //! Gives the rank of a Modifier in the list, 0 if not in the list 0153 //! Model Modifiers if <modifier> is kind of ModelModifer, 0154 //! File Modifiers else 0155 Standard_EXPORT int ModifierRank(const occ::handle<IFSelect_GeneralModifier>& modifier) const; 0156 0157 //! Removes a Modifier, given it rank in the list : 0158 //! Model Modifiers if <formodel> is True, File Modifiers else 0159 //! Returns True if done, False if <num> is out of range 0160 Standard_EXPORT bool RemoveModifier(const bool formodel, const int num); 0161 0162 //! Changes the rank of a modifier in the list : 0163 //! Model Modifiers if <formodel> is True, File Modifiers else 0164 //! from <before> to <after> 0165 //! Returns True if done, False else (before or after out of range) 0166 Standard_EXPORT bool ChangeModifierRank(const bool formodel, const int befor, const int after); 0167 0168 //! Attaches a Root Name to a Dispatch given its rank, as an 0169 //! HAsciiString (standard form). A Null Handle resets this name. 0170 //! Returns True if OK, False if this Name is already attached, 0171 //! for a Dispatch or for Default, or <num> out of range 0172 Standard_EXPORT bool SetRootName(const int num, 0173 const occ::handle<TCollection_HAsciiString>& name); 0174 0175 //! Returns True if the Dispatch of rank <num> has an attached 0176 //! Root Name. False else, or if num is out of range 0177 Standard_EXPORT bool HasRootName(const int num) const; 0178 0179 //! Returns the Root bound to a Dispatch, given its rank 0180 //! Returns a Null Handle if not defined 0181 Standard_EXPORT occ::handle<TCollection_HAsciiString> RootName(const int num) const; 0182 0183 //! Returns an integer value about a given root name : 0184 //! - positive : it's the rank of the Dispatch which has this name 0185 //! - null : this root name is unknown 0186 //! - negative (-1) : this root name is the default root name 0187 Standard_EXPORT int RootNumber(const occ::handle<TCollection_HAsciiString>& name) const; 0188 0189 //! Defines or Changes the general Prefix (which is prepended to 0190 //! complete file name generated). If this method is not call, 0191 //! Prefix remains empty 0192 Standard_EXPORT void SetPrefix(const occ::handle<TCollection_HAsciiString>& pref); 0193 0194 //! Defines or Changes the Default Root Name to a new value (which 0195 //! is used for dispatches which have no attached root name). 0196 //! If this method is not called, DefaultRootName remains empty 0197 //! Returns True if OK, False if this Name is already attached, 0198 //! for a Dispatch or for Default 0199 Standard_EXPORT bool SetDefaultRootName(const occ::handle<TCollection_HAsciiString>& defrt); 0200 0201 //! Defines or Changes the general Extension (which is appended to 0202 //! complete file name generated). If this method is not call, 0203 //! Extension remains empty 0204 Standard_EXPORT void SetExtension(const occ::handle<TCollection_HAsciiString>& ext); 0205 0206 //! Returns the general Prefix. Can be empty. 0207 Standard_EXPORT occ::handle<TCollection_HAsciiString> Prefix() const; 0208 0209 //! Returns the Default Root Name. Can be empty. 0210 Standard_EXPORT occ::handle<TCollection_HAsciiString> DefaultRootName() const; 0211 0212 //! Returns the general Extension. Can be empty (not recommended) 0213 Standard_EXPORT occ::handle<TCollection_HAsciiString> Extension() const; 0214 0215 //! Computes the complete file name for a Packet of a Dispatch, 0216 //! given Dispatch Number (Rank), Packet Number, and Count of 0217 //! Packets generated by this Dispatch (0 if unknown) 0218 //! 0219 //! File Name is made of following strings, concatenated : 0220 //! General Prefix, Root Name for Dispatch, Packet Suffix, and 0221 //! General Extension. If no Root Name is specified for a 0222 //! Dispatch, DefaultRootName is considered (and pnum is not used, 0223 //! but <thenbdefs> is incremented and used 0224 //! Error if no Root is defined for this <idnum> 0225 Standard_EXPORT TCollection_AsciiString FileName(const int dnum, 0226 const int pnum, 0227 const int nbpack = 0); 0228 0229 DEFINE_STANDARD_RTTIEXT(IFSelect_ShareOut, Standard_Transient) 0230 0231 private: 0232 NCollection_Sequence<occ::handle<IFSelect_Dispatch>> thedisps; 0233 NCollection_Sequence<occ::handle<IFSelect_GeneralModifier>> themodelmodifiers; 0234 NCollection_Sequence<occ::handle<IFSelect_GeneralModifier>> thefilemodifiers; 0235 occ::handle<TCollection_HAsciiString> thepref; 0236 occ::handle<TCollection_HAsciiString> thedefrt; 0237 occ::handle<TCollection_HAsciiString> theext; 0238 int thenbdefs; 0239 int thelastrun; 0240 }; 0241 0242 #endif // _IFSelect_ShareOut_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|