|
|
|||
File indexing completed on 2026-10-02 09:11:54
0001 // Copyright (c) 2022 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _DE_Provider_HeaderFile 0015 #define _DE_Provider_HeaderFile 0016 0017 #include <Message_ProgressRange.hxx> 0018 #include <NCollection_List.hxx> 0019 #include <Standard_IStream.hxx> 0020 #include <Standard_OStream.hxx> 0021 0022 class DE_ConfigurationNode; 0023 class TopoDS_Shape; 0024 class XSControl_WorkSession; 0025 class TDocStd_Document; 0026 0027 //! Base class to make transfer process. 0028 //! Reads or Writes specialized CAD files into/from OCCT. 0029 //! Each operation needs the Configuration Node. 0030 //! 0031 //! Providers are grouped by Vendor's name and Format type. 0032 //! The Vendor name is not defined by default. 0033 //! The Format type is not defined by default. 0034 //! The import process is not supported. 0035 //! The export process is not supported. 0036 //! 0037 //! The algorithm for standalone transfer operation: 0038 //! 1) Create new empty Provider object 0039 //! 2) Configure the current object by special Configuration Node (::SetNode) 0040 //! 3) Initiate the transfer process: 0041 //! 3.1) Call the required Read method (if Read methods are implemented) 0042 //! 3.2) Call the required Write method (if Write methods are implemented) 0043 //! 4) Validate the output values 0044 class DE_Provider : public Standard_Transient 0045 { 0046 public: 0047 DEFINE_STANDARD_RTTIEXT(DE_Provider, Standard_Transient) 0048 0049 //! Node to store write stream information 0050 //! Contains relative path and reference to output stream 0051 struct WriteStreamNode 0052 { 0053 TCollection_AsciiString Path; //!< Relative path to the output file 0054 Standard_OStream& Stream; //!< Reference to output stream 0055 0056 //! Constructor 0057 WriteStreamNode(const TCollection_AsciiString& thePath, Standard_OStream& theStream) 0058 : Path(thePath), 0059 Stream(theStream) 0060 { 0061 } 0062 }; 0063 0064 //! Node to store read stream information 0065 //! Contains relative path and reference to input stream 0066 struct ReadStreamNode 0067 { 0068 TCollection_AsciiString Path; //!< Relative path to the input file 0069 Standard_IStream& Stream; //!< Reference to input stream 0070 0071 //! Constructor 0072 ReadStreamNode(const TCollection_AsciiString& thePath, Standard_IStream& theStream) 0073 : Path(thePath), 0074 Stream(theStream) 0075 { 0076 } 0077 }; 0078 0079 public: 0080 //! List to store write stream nodes 0081 //! First element is the main stream, others are for internal referencing 0082 using WriteStreamList = NCollection_List<WriteStreamNode>; 0083 0084 //! List to store read stream nodes 0085 //! First element is the main stream, others are for internal referencing 0086 using ReadStreamList = NCollection_List<ReadStreamNode>; 0087 0088 public: 0089 //! Default constructor 0090 //! Configure translation process with global configuration 0091 Standard_EXPORT DE_Provider(); 0092 0093 //! Configure translation process 0094 //! @param[in] theNode object to copy 0095 Standard_EXPORT DE_Provider(const occ::handle<DE_ConfigurationNode>& theNode); 0096 0097 public: 0098 //! Reads a CAD file, according internal configuration 0099 //! @param[in] thePath path to the import CAD file 0100 //! @param[out] theDocument document to save result 0101 //! @param[in] theWS current work session 0102 //! @param[in] theProgress progress indicator 0103 //! @return True if Read was successful 0104 Standard_EXPORT virtual bool Read( 0105 const TCollection_AsciiString& thePath, 0106 const occ::handle<TDocStd_Document>& theDocument, 0107 occ::handle<XSControl_WorkSession>& theWS, 0108 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0109 0110 //! Writes a CAD file, according internal configuration 0111 //! @param[in] thePath path to the export CAD file 0112 //! @param[out] theDocument document to export 0113 //! @param[in] theWS current work session 0114 //! @param[in] theProgress progress indicator 0115 //! @return True if Write was successful 0116 Standard_EXPORT virtual bool Write( 0117 const TCollection_AsciiString& thePath, 0118 const occ::handle<TDocStd_Document>& theDocument, 0119 occ::handle<XSControl_WorkSession>& theWS, 0120 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0121 0122 //! Reads streams according to internal configuration 0123 //! @param[in] theStreams streams to read from 0124 //! @param[out] theDocument document to save result 0125 //! @param[in] theWS current work session 0126 //! @param[in] theProgress progress indicator 0127 //! @return True if Read was successful 0128 Standard_EXPORT virtual bool Read( 0129 ReadStreamList& theStreams, 0130 const occ::handle<TDocStd_Document>& theDocument, 0131 occ::handle<XSControl_WorkSession>& theWS, 0132 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0133 0134 //! Writes streams according to internal configuration 0135 //! @param[in] theStreams streams to write to 0136 //! @param[out] theDocument document to export 0137 //! @param[in] theWS current work session 0138 //! @param[in] theProgress progress indicator 0139 //! @return True if Write was successful 0140 Standard_EXPORT virtual bool Write( 0141 WriteStreamList& theStreams, 0142 const occ::handle<TDocStd_Document>& theDocument, 0143 occ::handle<XSControl_WorkSession>& theWS, 0144 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0145 0146 //! Reads a CAD file, according internal configuration 0147 //! @param[in] thePath path to the import CAD file 0148 //! @param[out] theDocument document to save result 0149 //! @param[in] theProgress progress indicator 0150 //! @return True if Read was successful 0151 Standard_EXPORT virtual bool Read( 0152 const TCollection_AsciiString& thePath, 0153 const occ::handle<TDocStd_Document>& theDocument, 0154 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0155 0156 //! Writes a CAD file, according internal configuration 0157 //! @param[in] thePath path to the export CAD file 0158 //! @param[out] theDocument document to export 0159 //! @param[in] theProgress progress indicator 0160 //! @return True if Write was successful 0161 Standard_EXPORT virtual bool Write( 0162 const TCollection_AsciiString& thePath, 0163 const occ::handle<TDocStd_Document>& theDocument, 0164 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0165 0166 //! Reads streams according to internal configuration 0167 //! @param[in] theStreams streams to read from 0168 //! @param[out] theDocument document to save result 0169 //! @param[in] theProgress progress indicator 0170 //! @return True if Read was successful 0171 Standard_EXPORT virtual bool Read( 0172 ReadStreamList& theStreams, 0173 const occ::handle<TDocStd_Document>& theDocument, 0174 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0175 0176 //! Writes streams according to internal configuration 0177 //! @param[in] theStreams streams to write to 0178 //! @param[out] theDocument document to export 0179 //! @param[in] theProgress progress indicator 0180 //! @return True if Write was successful 0181 Standard_EXPORT virtual bool Write( 0182 WriteStreamList& theStreams, 0183 const occ::handle<TDocStd_Document>& theDocument, 0184 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0185 0186 //! Reads a CAD file, according internal configuration 0187 //! @param[in] thePath path to the import CAD file 0188 //! @param[out] theShape shape to save result 0189 //! @param[in] theWS current work session 0190 //! @param[in] theProgress progress indicator 0191 //! @return True if Read was successful 0192 Standard_EXPORT virtual bool Read( 0193 const TCollection_AsciiString& thePath, 0194 TopoDS_Shape& theShape, 0195 occ::handle<XSControl_WorkSession>& theWS, 0196 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0197 0198 //! Writes a CAD file, according internal configuration 0199 //! @param[in] thePath path to the export CAD file 0200 //! @param[out] theShape shape to export 0201 //! @param[in] theWS current work session 0202 //! @param[in] theProgress progress indicator 0203 //! @return True if Write was successful 0204 Standard_EXPORT virtual bool Write( 0205 const TCollection_AsciiString& thePath, 0206 const TopoDS_Shape& theShape, 0207 occ::handle<XSControl_WorkSession>& theWS, 0208 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0209 0210 //! Reads streams according to internal configuration 0211 //! @param[in] theStreams streams to read from 0212 //! @param[out] theShape shape to save result 0213 //! @param[in] theWS current work session 0214 //! @param[in] theProgress progress indicator 0215 //! @return True if Read was successful 0216 Standard_EXPORT virtual bool Read( 0217 ReadStreamList& theStreams, 0218 TopoDS_Shape& theShape, 0219 occ::handle<XSControl_WorkSession>& theWS, 0220 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0221 0222 //! Writes streams according to internal configuration 0223 //! @param[in] theStreams streams to write to 0224 //! @param[out] theShape shape to export 0225 //! @param[in] theWS current work session 0226 //! @param[in] theProgress progress indicator 0227 //! @return True if Write was successful 0228 Standard_EXPORT virtual bool Write( 0229 WriteStreamList& theStreams, 0230 const TopoDS_Shape& theShape, 0231 occ::handle<XSControl_WorkSession>& theWS, 0232 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0233 0234 //! Reads a CAD file, according internal configuration 0235 //! @param[in] thePath path to the import CAD file 0236 //! @param[out] theShape shape to save result 0237 //! @param[in] theProgress progress indicator 0238 //! @return True if Read was successful 0239 Standard_EXPORT virtual bool Read( 0240 const TCollection_AsciiString& thePath, 0241 TopoDS_Shape& theShape, 0242 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0243 0244 //! Writes a CAD file, according internal configuration 0245 //! @param[in] thePath path to the export CAD file 0246 //! @param[out] theShape shape to export 0247 //! @param[in] theProgress progress indicator 0248 //! @return True if Write was successful 0249 Standard_EXPORT virtual bool Write( 0250 const TCollection_AsciiString& thePath, 0251 const TopoDS_Shape& theShape, 0252 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0253 0254 //! Reads streams according to internal configuration 0255 //! @param[in] theStreams streams to read from 0256 //! @param[out] theShape shape to save result 0257 //! @param[in] theProgress progress indicator 0258 //! @return True if Read was successful 0259 Standard_EXPORT virtual bool Read( 0260 ReadStreamList& theStreams, 0261 TopoDS_Shape& theShape, 0262 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0263 0264 //! Writes streams according to internal configuration 0265 //! @param[in] theStreams streams to write to 0266 //! @param[out] theShape shape to export 0267 //! @param[in] theProgress progress indicator 0268 //! @return True if Write was successful 0269 Standard_EXPORT virtual bool Write( 0270 WriteStreamList& theStreams, 0271 const TopoDS_Shape& theShape, 0272 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0273 0274 public: 0275 //! Gets CAD format name of associated provider 0276 //! @return provider CAD format 0277 Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0; 0278 0279 //! Gets provider's vendor name of associated provider 0280 //! @return provider's vendor name 0281 Standard_EXPORT virtual TCollection_AsciiString GetVendor() const = 0; 0282 0283 //! Gets internal configuration node 0284 //! @return configuration node object 0285 occ::handle<DE_ConfigurationNode> GetNode() const { return myNode; } 0286 0287 //! Sets internal configuration node 0288 //! @param[in] theNode configuration node to set 0289 void SetNode(const occ::handle<DE_ConfigurationNode>& theNode) { myNode = theNode; } 0290 0291 private: 0292 occ::handle<DE_ConfigurationNode> myNode; //!< Internal configuration for the own format 0293 }; 0294 0295 #endif // _DE_Provider_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|