42cf5bc1 |
1 | // Created on: 1999-06-11 |
2 | // Created by: Vladislav ROMASHKO |
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 _TFunction_DriverTable_HeaderFile |
18 | #define _TFunction_DriverTable_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <TFunction_DataMapOfGUIDDriver.hxx> |
24 | #include <TFunction_HArray1OfDataMapOfGUIDDriver.hxx> |
25 | #include <MMgt_TShared.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <Standard_OStream.hxx> |
29 | class Standard_GUID; |
30 | class TFunction_Driver; |
31 | |
32 | |
33 | class TFunction_DriverTable; |
34 | DEFINE_STANDARD_HANDLE(TFunction_DriverTable, MMgt_TShared) |
35 | |
36 | //! A container for instances of drivers. |
37 | //! You create a new instance of TFunction_Driver |
38 | //! and use the method AddDriver to load it into the driver table. |
39 | class TFunction_DriverTable : public MMgt_TShared |
40 | { |
41 | |
42 | public: |
43 | |
44 | |
45 | //! Returns the driver table. If a driver does not exist, creates it. |
46 | Standard_EXPORT static Handle(TFunction_DriverTable) Get(); |
47 | |
48 | //! Default constructor |
49 | Standard_EXPORT TFunction_DriverTable(); |
50 | |
51 | //! Returns true if the driver has been added successfully to the driver table. |
52 | Standard_EXPORT Standard_Boolean AddDriver (const Standard_GUID& guid, const Handle(TFunction_Driver)& driver, const Standard_Integer thread = 0); |
53 | |
54 | //! Returns true if the driver exists in the driver table. |
55 | Standard_EXPORT Standard_Boolean HasDriver (const Standard_GUID& guid, const Standard_Integer thread = 0) const; |
56 | |
57 | //! Returns true if the driver was found. |
58 | Standard_EXPORT Standard_Boolean FindDriver (const Standard_GUID& guid, Handle(TFunction_Driver)& driver, const Standard_Integer thread = 0) const; |
59 | |
60 | Standard_EXPORT Standard_OStream& Dump (Standard_OStream& anOS) const; |
61 | Standard_OStream& operator << (Standard_OStream& anOS) const |
62 | { |
63 | return Dump(anOS); |
64 | } |
65 | |
66 | //! Removes a driver with the given GUID. |
67 | //! Returns true if the driver has been removed successfully. |
68 | Standard_EXPORT Standard_Boolean RemoveDriver (const Standard_GUID& guid, const Standard_Integer thread = 0); |
69 | |
70 | //! Removes all drivers. Returns true if the driver has been removed successfully. |
71 | Standard_EXPORT void Clear(); |
72 | |
73 | |
74 | |
75 | |
76 | DEFINE_STANDARD_RTTI(TFunction_DriverTable,MMgt_TShared) |
77 | |
78 | protected: |
79 | |
80 | |
81 | |
82 | |
83 | private: |
84 | |
85 | |
86 | TFunction_DataMapOfGUIDDriver myDrivers; |
87 | Handle(TFunction_HArray1OfDataMapOfGUIDDriver) myThreadDrivers; |
88 | |
89 | |
90 | }; |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | #endif // _TFunction_DriverTable_HeaderFile |