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(const occ::handle<Standard_Type>& theType,
0022                                           const int                         theId)
0023 {
0024   myMapId.Bind(theType, theId);
0025 }
0026 
0027 //=======================================================================
0028 // function : GetDriver
0029 // purpose  : Gets a driver <theDriver> according to <theType>.
0030 //           Returns Type ID if the driver was assigned an ID; 0 otherwise.
0031 //=======================================================================
0032 
0033 inline int BinMDF_ADriverTable::GetDriver(const occ::handle<Standard_Type>& theType,
0034                                           occ::handle<BinMDF_ADriver>&      theDriver)
0035 {
0036   if (!myMap.IsBound(theType)) // try to assign driver for derived type
0037   {
0038     AddDerivedDriver(theType->Name());
0039   }
0040 
0041   int anId = 0;
0042   if (myMap.IsBound(theType))
0043   {
0044     theDriver = myMap(theType);
0045     if (myMapId.IsBound1(theType))
0046       anId = myMapId.Find1(theType);
0047   }
0048   return anId;
0049 }
0050 
0051 //=======================================================================
0052 // function : GetDriver
0053 // purpose  : Returns a driver according to <theTypeId>.
0054 //           Returns null handle if a driver is not found
0055 //=======================================================================
0056 
0057 inline occ::handle<BinMDF_ADriver> BinMDF_ADriverTable::GetDriver(const int theTypeId)
0058 {
0059   occ::handle<BinMDF_ADriver> aDriver;
0060   if (myMapId.IsBound2(theTypeId))
0061   {
0062     const occ::handle<Standard_Type>& aType = myMapId.Find2(theTypeId);
0063     aDriver                                 = myMap(aType);
0064   }
0065   return aDriver;
0066 }