Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/BinMDF_ADriverTable.lxx is written in an unsupported language. File is not indexed.

0001 // Created on: 2002-10-29
0002 // Created by: Michael SAZONOV
0003 // Copyright (c) 2002-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 //=======================================================================
0017 //function : AssignId
0018 //purpose  : Assigns the ID to the driver of the Type
0019 //=======================================================================
0020 
0021 inline void BinMDF_ADriverTable::AssignId
0022                 (const Handle(Standard_Type)& theType,
0023                  const Standard_Integer theId)
0024 {
0025   myMapId.Bind (theType, theId);
0026 }
0027 
0028 //=======================================================================
0029 //function : GetDriver
0030 //purpose  : Gets a driver <theDriver> according to <theType>.
0031 //           Returns Type ID if the driver was assigned an ID; 0 otherwise.
0032 //=======================================================================
0033 
0034 inline Standard_Integer BinMDF_ADriverTable::GetDriver
0035                 (const Handle(Standard_Type)&   theType,
0036                  Handle(BinMDF_ADriver)&        theDriver)
0037 {
0038   if (!myMap.IsBound (theType)) // try to assign driver for derived type
0039   {
0040     AddDerivedDriver (theType->Name());
0041   }
0042 
0043   Standard_Integer anId = 0;
0044   if (myMap.IsBound(theType)) {
0045     theDriver = myMap (theType);
0046     if (myMapId.IsBound1(theType))
0047       anId = myMapId.Find1 (theType);
0048   }
0049   return anId;
0050 }
0051 
0052 //=======================================================================
0053 //function : GetDriver
0054 //purpose  : Returns a driver according to <theTypeId>.
0055 //           Returns null handle if a driver is not found
0056 //=======================================================================
0057 
0058 inline Handle(BinMDF_ADriver) BinMDF_ADriverTable::GetDriver
0059                 (const Standard_Integer theTypeId)
0060 {
0061   Handle(BinMDF_ADriver) aDriver;
0062   if (myMapId.IsBound2(theTypeId)) {
0063     const Handle(Standard_Type)& aType = myMapId.Find2 (theTypeId);
0064     aDriver = myMap (aType);
0065   }
0066   return aDriver;
0067 }