1 // Created on: 1999-08-04
2 // Created by: Denis PASCAL
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 #ifndef _TPrsStd_DriverTable_HeaderFile
18 #define _TPrsStd_DriverTable_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 
23 #include <TPrsStd_DataMapOfGUIDDriver.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Standard_Boolean.hxx>
26 class Standard_GUID;
27 class TPrsStd_Driver;
28 
29 
30 class TPrsStd_DriverTable;
31 DEFINE_STANDARD_HANDLE(TPrsStd_DriverTable, Standard_Transient)
32 
33 //! This class is   a  container to record  (AddDriver)
34 //! binding between  GUID and  TPrsStd_Driver.
35 //! You create a new instance of TPrsStd_Driver
36 //! and use the method AddDriver to load it into the driver table. the method
37 class TPrsStd_DriverTable : public Standard_Transient
38 {
39 
40 public:
41 
42 
43   //! Returns the static table.
44   //! If it does not exist, creates it and fills it with standard drivers.
45   Standard_EXPORT static Handle(TPrsStd_DriverTable) Get();
46 
47   //! Default constructor
48   Standard_EXPORT TPrsStd_DriverTable();
49 
50   //! Fills the table with standard drivers
51   Standard_EXPORT void InitStandardDrivers();
52 
53   //! Returns true if the driver has been added successfully to the driver table.
54   Standard_EXPORT Standard_Boolean AddDriver (const Standard_GUID& guid, const Handle(TPrsStd_Driver)& driver);
55 
56   //! Returns true if the driver was found.
57   Standard_EXPORT Standard_Boolean FindDriver (const Standard_GUID& guid, Handle(TPrsStd_Driver)& driver) const;
58 
59 
60   //! Removes a driver with the given GUID.
61   //! Returns true if the driver has been removed successfully.
62   Standard_EXPORT Standard_Boolean RemoveDriver (const Standard_GUID& guid);
63 
64   //! Removes all drivers. Returns
65   //! true if the driver has been removed successfully.
66   //! If this method is used, the InitStandardDrivers method should be
67   //! called to fill the table with standard drivers.
68   Standard_EXPORT void Clear();
69 
70 
71 
72 
73   DEFINE_STANDARD_RTTIEXT(TPrsStd_DriverTable,Standard_Transient)
74 
75 protected:
76 
77 
78 
79 
80 private:
81 
82 
83   TPrsStd_DataMapOfGUIDDriver myDrivers;
84 
85 
86 };
87 
88 
89 
90 
91 
92 
93 
94 #endif // _TPrsStd_DriverTable_HeaderFile
95