Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:23

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 
0019 class DE_ConfigurationNode;
0020 class TopoDS_Shape;
0021 class XSControl_WorkSession;
0022 class TDocStd_Document;
0023 
0024 //! Base class to make transfer process.
0025 //! Reads or Writes specialized CAD files into/from OCCT.
0026 //! Each operation needs the Configuration Node.
0027 //!
0028 //! Providers are grouped by Vendor's name and Format type.
0029 //! The Vendor name is not defined by default.
0030 //! The Format type is not defined by default.
0031 //! The import process is not supported.
0032 //! The export process is not supported.
0033 //!
0034 //! The algorithm for standalone transfer operation:
0035 //! 1) Create new empty Provider object
0036 //! 2) Configure the current object by special Configuration Node (::SetNode)
0037 //! 3) Initiate the transfer process:
0038 //!   3.1) Call the required Read method (if Read methods are implemented)
0039 //!   3.2) Call the required Write method (if Write methods are implemented)
0040 //! 4) Validate the output values
0041 class DE_Provider : public Standard_Transient
0042 {
0043 public:
0044   DEFINE_STANDARD_RTTIEXT(DE_Provider, Standard_Transient)
0045 
0046 public:
0047 
0048   //! Default constructor
0049   //! Configure translation process with global configuration
0050   Standard_EXPORT DE_Provider();
0051 
0052   //! Configure translation process
0053   //! @param[in] theNode object to copy
0054   Standard_EXPORT DE_Provider(const Handle(DE_ConfigurationNode)& theNode);
0055 
0056 public:
0057 
0058   //! Reads a CAD file, according internal configuration
0059   //! @param[in] thePath path to the import CAD file
0060   //! @param[out] theDocument document to save result
0061   //! @param[in] theWS current work session
0062   //! @param theProgress[in] progress indicator
0063   //! @return True if Read was successful
0064   Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
0065                                                 const Handle(TDocStd_Document)& theDocument,
0066                                                 Handle(XSControl_WorkSession)& theWS,
0067                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0068 
0069   //! Writes a CAD file, according internal configuration
0070   //! @param[in] thePath path to the export CAD file
0071   //! @param[out] theDocument document to export
0072   //! @param[in] theWS current work session
0073   //! @param theProgress[in] progress indicator
0074   //! @return True if Write was successful
0075   Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
0076                                                  const Handle(TDocStd_Document)& theDocument,
0077                                                  Handle(XSControl_WorkSession)& theWS,
0078                                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
0079 
0080   //! Reads a CAD file, according internal configuration
0081   //! @param[in] thePath path to the import CAD file
0082   //! @param[out] theDocument document to save result
0083   //! @param theProgress[in] progress indicator
0084   //! @return True if Read was successful
0085   Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
0086                                                 const Handle(TDocStd_Document)& theDocument,
0087                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0088 
0089   //! Writes a CAD file, according internal configuration
0090   //! @param[in] thePath path to the export CAD file
0091   //! @param[out] theDocument document to export
0092   //! @param theProgress[in] progress indicator
0093   //! @return True if Write was successful
0094   Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
0095                                                  const Handle(TDocStd_Document)& theDocument,
0096                                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
0097 
0098   //! Reads a CAD file, according internal configuration
0099   //! @param[in] thePath path to the import CAD file
0100   //! @param[out] theShape shape to save result
0101   //! @param[in] theWS current work session
0102   //! @param theProgress[in] progress indicator
0103   //! @return True if Read was successful
0104   Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
0105                                                 TopoDS_Shape& theShape,
0106                                                 Handle(XSControl_WorkSession)& theWS,
0107                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0108 
0109   //! Writes a CAD file, according internal configuration
0110   //! @param[in] thePath path to the export CAD file
0111   //! @param[out] theShape shape to export
0112   //! @param[in] theWS current work session
0113   //! @param theProgress[in] progress indicator
0114   //! @return True if Write was successful
0115   Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
0116                                                  const TopoDS_Shape& theShape,
0117                                                  Handle(XSControl_WorkSession)& theWS,
0118                                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
0119 
0120   //! Reads a CAD file, according internal configuration
0121   //! @param[in] thePath path to the import CAD file
0122   //! @param[out] theShape shape to save result
0123   //! @param theProgress[in] progress indicator
0124   //! @return True if Read was successful
0125   Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
0126                                                 TopoDS_Shape& theShape,
0127                                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0128 
0129   //! Writes a CAD file, according internal configuration
0130   //! @param[in] thePath path to the export CAD file
0131   //! @param[out] theShape shape to export
0132   //! @param theProgress[in] progress indicator
0133   //! @return True if Write was successful
0134   Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
0135                                                  const TopoDS_Shape& theShape,
0136                                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
0137 
0138 public:
0139 
0140   //! Gets CAD format name of associated provider
0141   //! @return provider CAD format
0142   Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0;
0143 
0144   //! Gets provider's vendor name of associated provider
0145   //! @return provider's vendor name
0146   Standard_EXPORT virtual TCollection_AsciiString GetVendor() const = 0;
0147 
0148   //! Gets internal configuration node
0149   //! @return configuration node object
0150   Handle(DE_ConfigurationNode) GetNode() const
0151   {
0152     return myNode;
0153   }
0154 
0155   //! Sets internal configuration node
0156   //! @param[in] theNode configuration node to set
0157   void SetNode(const Handle(DE_ConfigurationNode)& theNode)
0158   {
0159     myNode = theNode;
0160   }
0161 
0162 private:
0163 
0164   Handle(DE_ConfigurationNode) myNode; //!< Internal configuration for the own format
0165 };
0166 
0167 #endif // _DE_Provider_HeaderFile