1 // Created on: 2002-10-29
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BinMDF_ADriverTable_HeaderFile
17 #define _BinMDF_ADriverTable_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
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>
32 class BinMDF_ADriverTable;
33 DEFINE_STANDARD_HANDLE(BinMDF_ADriverTable, Standard_Transient)
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
40 class BinMDF_ADriverTable : public Standard_Transient
47 Standard_EXPORT BinMDF_ADriverTable();
49 //! Adds a translation driver <theDriver>.
50 Standard_EXPORT void AddDriver (const Handle(BinMDF_ADriver)& theDriver);
52 //! Adds a translation driver for the derived attribute. The base driver must be already added.
53 //! @param theInstance is newly created attribute, detached from any label
54 Standard_EXPORT void AddDerivedDriver (const Handle(TDF_Attribute)& theInstance);
56 //! Adds a translation driver for the derived attribute. The base driver must be already added.
57 //! @param theDerivedType is registered attribute type using IMPLEMENT_DERIVED_ATTRIBUTE macro
58 Standard_EXPORT const Handle(Standard_Type)& AddDerivedDriver (Standard_CString theDerivedType);
60 //! Assigns the IDs to the drivers of the given Types.
61 //! It uses indices in the map as IDs.
62 //! Useful in storage procedure.
63 Standard_EXPORT void AssignIds (const TColStd_IndexedMapOfTransient& theTypes);
65 //! Assigns the IDs to the drivers of the given Type Names;
66 //! It uses indices in the sequence as IDs.
67 //! Useful in retrieval procedure.
68 Standard_EXPORT void AssignIds (const TColStd_SequenceOfAsciiString& theTypeNames);
70 //! Gets a driver <theDriver> according to <theType>.
71 //! Returns Type ID if the driver was assigned an ID; 0 otherwise.
72 Standard_Integer GetDriver (const Handle(Standard_Type)& theType, Handle(BinMDF_ADriver)& theDriver);
74 //! Returns a driver according to <theTypeId>.
75 //! Returns null handle if a driver is not found
76 Handle(BinMDF_ADriver) GetDriver (const Standard_Integer theTypeId);
81 DEFINE_STANDARD_RTTIEXT(BinMDF_ADriverTable,Standard_Transient)
91 //! Assigns the ID to the driver of the Type
92 void AssignId (const Handle(Standard_Type)& theType, const Standard_Integer theId);
94 BinMDF_TypeADriverMap myMap;
95 BinMDF_TypeIdMap myMapId;
101 #include <BinMDF_ADriverTable.lxx>
107 #endif // _BinMDF_ADriverTable_HeaderFile