718ed36f50917a739f301d2b224beb78e803fa04
[occt.git] / src / BinMDF / BinMDF_ADriverTable.hxx
1 // Created on: 2002-10-29
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _BinMDF_ADriverTable_HeaderFile
17 #define _BinMDF_ADriverTable_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <BinMDF_TypeADriverMap.hxx>
23 #include <BinMDF_TypeIdMap.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Standard_Type.hxx>
26 #include <Standard_Integer.hxx>
27 #include <TColStd_IndexedMapOfTransient.hxx>
28 #include <TColStd_SequenceOfAsciiString.hxx>
29 class BinMDF_ADriver;
30
31
32 class BinMDF_ADriverTable;
33 DEFINE_STANDARD_HANDLE(BinMDF_ADriverTable, Standard_Transient)
34
35 //! A driver table is an object building links between
36 //! object types and object drivers. In the
37 //! translation process, a driver table is asked to
38 //! give a translation driver for each current object
39 //! to be translated.
40 class BinMDF_ADriverTable : public Standard_Transient
41 {
42
43 public:
44
45   
46   //! Constructor
47   Standard_EXPORT BinMDF_ADriverTable();
48   
49   //! Adds a translation driver <theDriver>.
50   Standard_EXPORT void AddDriver (const Handle(BinMDF_ADriver)& theDriver);
51   
52   //! Assigns the IDs to the drivers of the given Types.
53   //! It uses indices in the map as IDs.
54   //! Useful in storage procedure.
55   Standard_EXPORT void AssignIds (const TColStd_IndexedMapOfTransient& theTypes);
56   
57   //! Assigns the IDs to the drivers of the given Type Names;
58   //! It uses indices in the sequence as IDs.
59   //! Useful in retrieval procedure.
60   Standard_EXPORT void AssignIds (const TColStd_SequenceOfAsciiString& theTypeNames);
61   
62   //! Gets a driver <theDriver> according to <theType>.
63   //! Returns Type ID if the driver was assigned an ID; 0 otherwise.
64     Standard_Integer GetDriver (const Handle(Standard_Type)& theType, Handle(BinMDF_ADriver)& theDriver) const;
65   
66   //! Returns a driver according to <theTypeId>.
67   //! Returns null handle if a driver is not found
68     Handle(BinMDF_ADriver) GetDriver (const Standard_Integer theTypeId) const;
69
70
71
72
73   DEFINE_STANDARD_RTTIEXT(BinMDF_ADriverTable,Standard_Transient)
74
75 protected:
76
77
78
79
80 private:
81
82   
83   //! Assigns the ID to the driver of the Type
84     void AssignId (const Handle(Standard_Type)& theType, const Standard_Integer theId);
85
86   BinMDF_TypeADriverMap myMap;
87   BinMDF_TypeIdMap myMapId;
88
89
90 };
91
92
93 #include <BinMDF_ADriverTable.lxx>
94
95
96
97
98
99 #endif // _BinMDF_ADriverTable_HeaderFile