Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/IMeshTools_ModelBuilder.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 2016-04-07
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _IMeshTools_ModelBuilder_HeaderFile
0017 #define _IMeshTools_ModelBuilder_HeaderFile
0018 
0019 #include <Message_Algorithm.hxx>
0020 #include <Standard_ErrorHandler.hxx>
0021 #include <Standard_Failure.hxx>
0022 #include <Standard_Type.hxx>
0023 #include <IMeshData_Model.hxx>
0024 
0025 struct IMeshTools_Parameters;
0026 
0027 //! Interface class represents API for tool building discrete model.
0028 //!
0029 //! The following statuses should be used by default:
0030 //! Message_Done1 - model has been successfully built.
0031 //! Message_Fail1 - empty shape.
0032 //! Message_Fail2 - model has not been build due to unexpected reason.
0033 class IMeshTools_ModelBuilder : public Message_Algorithm
0034 {
0035 public:
0036   //! Destructor.
0037   ~IMeshTools_ModelBuilder() override = default;
0038 
0039   //! Exceptions protected method to create discrete model for the given shape.
0040   //! Returns nullptr in case of failure.
0041   occ::handle<IMeshData_Model> Perform(const TopoDS_Shape&          theShape,
0042                                        const IMeshTools_Parameters& theParameters)
0043   {
0044     ClearStatus();
0045 
0046     try
0047     {
0048       OCC_CATCH_SIGNALS
0049 
0050       return performInternal(theShape, theParameters);
0051     }
0052     catch (Standard_Failure const&)
0053     {
0054       SetStatus(Message_Fail2);
0055       return nullptr;
0056     }
0057   }
0058 
0059   DEFINE_STANDARD_RTTIEXT(IMeshTools_ModelBuilder, Message_Algorithm)
0060 
0061 protected:
0062   //! Constructor.
0063   IMeshTools_ModelBuilder() {}
0064 
0065   //! Creates discrete model for the given shape.
0066   //! Returns nullptr in case of failure.
0067   Standard_EXPORT virtual occ::handle<IMeshData_Model> performInternal(
0068     const TopoDS_Shape&          theShape,
0069     const IMeshTools_Parameters& theParameters) = 0;
0070 };
0071 
0072 #endif