Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:59

0001 // Created on: 2002-10-30
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 _BinMDataStd_HeaderFile
0017 #define _BinMDataStd_HeaderFile
0018 
0019 #include <Standard_GUID.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <BinObjMgt_Persistent.hxx>
0024 #include <TDocStd_FormatVersion.hxx>
0025 
0026 class BinMDF_ADriverTable;
0027 class Message_Messenger;
0028 
0029 //! Storage and Retrieval drivers for modelling attributes.
0030 class BinMDataStd 
0031 {
0032 public:
0033 
0034   DEFINE_STANDARD_ALLOC
0035 
0036   
0037   //! Adds the attribute drivers to <theDriverTable>.
0038   Standard_EXPORT static void AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, const Handle(Message_Messenger)& aMsgDrv);
0039 
0040 template<class T>
0041 static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt, const Standard_Integer aDocFormatVersion)
0042 {
0043   Standard_Boolean ok = Standard_True;
0044   if(aDocFormatVersion >= TDocStd_FormatVersion_VERSION_10) { // process user defined guid
0045     const Standard_Integer& aPos = theSource.Position();
0046     Standard_GUID aGuid;
0047     ok = theSource >> aGuid;
0048     if (!ok) {
0049       theSource.SetPosition(aPos);
0050       anAtt->SetID(T::GetID());
0051       ok = Standard_True;
0052     } else {
0053       anAtt->SetID(aGuid);
0054     }
0055   } else
0056     anAtt->SetID(T::GetID());
0057 }
0058 
0059 };
0060 
0061 #endif // _BinMDataStd_HeaderFile