Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:19:39

0001 // Copyright (c) 2025 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 _BRepMesh_DiscretAlgoFactory_HeaderFile
0015 #define _BRepMesh_DiscretAlgoFactory_HeaderFile
0016 
0017 #include <NCollection_List.hxx>
0018 #include <Standard_Handle.hxx>
0019 #include <Standard_Type.hxx>
0020 #include <TCollection_AsciiString.hxx>
0021 
0022 class BRepMesh_DiscretRoot;
0023 class TopoDS_Shape;
0024 
0025 //! Abstract factory for creating meshing algorithms.
0026 //! This class provides a registry-based factory pattern that allows multiple
0027 //! meshing algorithms to coexist without symbol collisions.
0028 //! It follows the pattern established by Graphic3d_GraphicDriverFactory.
0029 class BRepMesh_DiscretAlgoFactory : public Standard_Transient
0030 {
0031   DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretAlgoFactory, Standard_Transient)
0032 
0033 public:
0034   //! Registers a factory in the global registry.
0035   //! @param[in] theFactory     factory to register
0036   //! @param[in] theIsPreferred if TRUE, add to the beginning of the list (making it default),
0037   //!                           otherwise add to the end
0038   Standard_EXPORT static void RegisterFactory(
0039     const occ::handle<BRepMesh_DiscretAlgoFactory>& theFactory,
0040     bool                                            theIsPreferred = false);
0041 
0042   //! Unregisters a factory by name.
0043   //! @param[in] theName name of the factory to unregister
0044   Standard_EXPORT static void UnregisterFactory(const TCollection_AsciiString& theName);
0045 
0046   //! Returns the default (first registered) factory, or NULL if none registered.
0047   Standard_EXPORT static occ::handle<BRepMesh_DiscretAlgoFactory> DefaultFactory();
0048 
0049   //! Finds a factory by name.
0050   //! @param[in] theName name of the factory to find
0051   //! @return factory handle, or NULL if not found
0052   Standard_EXPORT static occ::handle<BRepMesh_DiscretAlgoFactory> FindFactory(
0053     const TCollection_AsciiString& theName);
0054 
0055   //! Returns the global list of registered factories.
0056   Standard_EXPORT static const NCollection_List<occ::handle<BRepMesh_DiscretAlgoFactory>>&
0057     Factories();
0058 
0059 public:
0060   //! Creates a new meshing algorithm instance.
0061   //! @param[in] theShape         shape to be meshed
0062   //! @param[in] theLinDeflection linear deflection for meshing
0063   //! @param[in] theAngDeflection angular deflection for meshing
0064   //! @return new meshing algorithm instance
0065   virtual occ::handle<BRepMesh_DiscretRoot> CreateAlgorithm(const TopoDS_Shape& theShape,
0066                                                             double              theLinDeflection,
0067                                                             double theAngDeflection) = 0;
0068 
0069   //! Returns the factory name.
0070   const TCollection_AsciiString& Name() const { return myName; }
0071 
0072 protected:
0073   //! Constructor.
0074   //! @param[in] theName factory name used for identification
0075   Standard_EXPORT BRepMesh_DiscretAlgoFactory(const TCollection_AsciiString& theName);
0076 
0077 protected:
0078   TCollection_AsciiString myName;
0079 };
0080 
0081 #endif // _BRepMesh_DiscretAlgoFactory_HeaderFile