1 // Copyright (c) 2021 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _Graphic3d_GraphicDriverFactory_HeaderFile
15 #define _Graphic3d_GraphicDriverFactory_HeaderFile
17 #include <NCollection_List.hxx>
18 #include <Standard_Type.hxx>
19 #include <TCollection_AsciiString.hxx>
21 class Aspect_DisplayConnection;
22 class Graphic3d_GraphicDriver;
23 class Graphic3d_GraphicDriverFactory;
24 typedef NCollection_List<Handle(Graphic3d_GraphicDriverFactory)> Graphic3d_GraphicDriverFactoryList;
26 //! This class for creation of Graphic3d_GraphicDriver.
27 class Graphic3d_GraphicDriverFactory : public Standard_Transient
29 DEFINE_STANDARD_RTTIEXT(Graphic3d_GraphicDriverFactory, Standard_Transient)
32 //! Registers factory.
33 //! @param theFactory [in] factory to register
34 //! @param theIsPreferred [in] add to the beginning of the list when TRUE, or add to the end otherwise
35 Standard_EXPORT static void RegisterFactory (const Handle(Graphic3d_GraphicDriverFactory)& theFactory,
36 bool theIsPreferred = false);
38 //! Unregisters factory.
39 Standard_EXPORT static void UnregisterFactory (const TCollection_AsciiString& theName);
41 //! Return default driver factory or NULL if no one was registered.
42 Standard_EXPORT static Handle(Graphic3d_GraphicDriverFactory) DefaultDriverFactory();
44 //! Return the global map of registered driver factories.
45 Standard_EXPORT static const Graphic3d_GraphicDriverFactoryList& DriverFactories();
49 //! Creates new empty graphic driver.
50 virtual Handle(Graphic3d_GraphicDriver) CreateDriver (const Handle(Aspect_DisplayConnection)& theDisp) = 0;
52 //! Return driver factory name.
53 const TCollection_AsciiString& Name() const { return myName; }
57 //! Empty constructor.
58 Standard_EXPORT Graphic3d_GraphicDriverFactory (const TCollection_AsciiString& theName);
62 TCollection_AsciiString myName;
66 #endif // _Graphic3d_GraphicDriverFactory_HeaderFile