Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:00

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 #ifndef _BinMDF_ADriverTable_HeaderFile
0017 #define _BinMDF_ADriverTable_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <BinMDF_TypeADriverMap.hxx>
0023 #include <BinMDF_TypeIdMap.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <TColStd_IndexedMapOfTransient.hxx>
0027 #include <TColStd_SequenceOfAsciiString.hxx>
0028 class BinMDF_ADriver;
0029 
0030 
0031 class BinMDF_ADriverTable;
0032 DEFINE_STANDARD_HANDLE(BinMDF_ADriverTable, Standard_Transient)
0033 
0034 //! A driver table is an object building links between
0035 //! object types and object drivers. In the
0036 //! translation process, a driver table is asked to
0037 //! give a translation driver for each current object
0038 //! to be translated.
0039 class BinMDF_ADriverTable : public Standard_Transient
0040 {
0041 
0042 public:
0043 
0044   
0045   //! Constructor
0046   Standard_EXPORT BinMDF_ADriverTable();
0047   
0048   //! Adds a translation driver <theDriver>.
0049   Standard_EXPORT void AddDriver (const Handle(BinMDF_ADriver)& theDriver);
0050 
0051   //! Adds a translation driver for the derived attribute. The base driver must be already added.
0052   //! @param theInstance is newly created attribute, detached from any label
0053   Standard_EXPORT void AddDerivedDriver (const Handle(TDF_Attribute)& theInstance);
0054 
0055   //! Adds a translation driver for the derived attribute. The base driver must be already added.
0056   //! @param theDerivedType is registered attribute type using IMPLEMENT_DERIVED_ATTRIBUTE macro
0057   Standard_EXPORT const Handle(Standard_Type)& AddDerivedDriver (Standard_CString theDerivedType);
0058 
0059   //! Assigns the IDs to the drivers of the given Types.
0060   //! It uses indices in the map as IDs.
0061   //! Useful in storage procedure.
0062   Standard_EXPORT void AssignIds (const TColStd_IndexedMapOfTransient& theTypes);
0063   
0064   //! Assigns the IDs to the drivers of the given Type Names;
0065   //! It uses indices in the sequence as IDs.
0066   //! Useful in retrieval procedure.
0067   Standard_EXPORT void AssignIds (const TColStd_SequenceOfAsciiString& theTypeNames);
0068   
0069   //! Gets a driver <theDriver> according to <theType>.
0070   //! Returns Type ID if the driver was assigned an ID; 0 otherwise.
0071   Standard_Integer GetDriver (const Handle(Standard_Type)& theType, Handle(BinMDF_ADriver)& theDriver);
0072   
0073   //! Returns a driver according to <theTypeId>.
0074   //! Returns null handle if a driver is not found
0075   Handle(BinMDF_ADriver) GetDriver (const Standard_Integer theTypeId);
0076 
0077 
0078 
0079 
0080   DEFINE_STANDARD_RTTIEXT(BinMDF_ADriverTable,Standard_Transient)
0081 
0082 protected:
0083 
0084 
0085 
0086 
0087 private:
0088 
0089   
0090   //! Assigns the ID to the driver of the Type
0091     void AssignId (const Handle(Standard_Type)& theType, const Standard_Integer theId);
0092 
0093   BinMDF_TypeADriverMap myMap;
0094   BinMDF_TypeIdMap myMapId;
0095 
0096 
0097 };
0098 
0099 
0100 #include <BinMDF_ADriverTable.lxx>
0101 
0102 
0103 
0104 
0105 
0106 #endif // _BinMDF_ADriverTable_HeaderFile