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 //=======================================================================
18 //purpose : Assigns the ID to the driver of the Type
19 //=======================================================================
21 inline void BinMDF_ADriverTable::AssignId
22 (const Handle(Standard_Type)& theType,
23 const Standard_Integer theId)
25 myMapId.Bind (theType, theId);
28 //=======================================================================
29 //function : GetDriver
30 //purpose : Gets a driver <theDriver> according to <theType>.
31 // Returns Type ID if the driver was assigned an ID; 0 otherwise.
32 //=======================================================================
34 inline Standard_Integer BinMDF_ADriverTable::GetDriver
35 (const Handle(Standard_Type)& theType,
36 Handle(BinMDF_ADriver)& theDriver)
38 if (!myMap.IsBound (theType)) // try to assign driver for derived type
40 AddDerivedDriver (theType->Name());
43 Standard_Integer anId = 0;
44 if (myMap.IsBound(theType)) {
45 theDriver = myMap (theType);
46 if (myMapId.IsBound1(theType))
47 anId = myMapId.Find1 (theType);
52 //=======================================================================
53 //function : GetDriver
54 //purpose : Returns a driver according to <theTypeId>.
55 // Returns null handle if a driver is not found
56 //=======================================================================
58 inline Handle(BinMDF_ADriver) BinMDF_ADriverTable::GetDriver
59 (const Standard_Integer theTypeId)
61 Handle(BinMDF_ADriver) aDriver;
62 if (myMapId.IsBound2(theTypeId)) {
63 const Handle(Standard_Type)& aType = myMapId.Find2 (theTypeId);
64 aDriver = myMap (aType);