Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-01 08:32:11

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   DEFINE_STANDARD_ALLOC
0034 
0035   //! Adds the attribute drivers to <theDriverTable>.
0036   Standard_EXPORT static void AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
0037                                          const Handle(Message_Messenger)&   aMsgDrv);
0038 
0039   template <class T>
0040   static void SetAttributeID(const BinObjMgt_Persistent& theSource,
0041                              const Handle(T)&            anAtt,
0042                              const Standard_Integer      aDocFormatVersion)
0043   {
0044     Standard_Boolean ok = Standard_True;
0045     if (aDocFormatVersion >= TDocStd_FormatVersion_VERSION_10)
0046     { // process user defined guid
0047       const Standard_Integer& aPos = theSource.Position();
0048       Standard_GUID           aGuid;
0049       ok = theSource >> aGuid;
0050       if (!ok)
0051       {
0052         theSource.SetPosition(aPos);
0053         anAtt->SetID(T::GetID());
0054         ok = Standard_True;
0055       }
0056       else
0057       {
0058         anAtt->SetID(aGuid);
0059       }
0060     }
0061     else
0062       anAtt->SetID(T::GetID());
0063   }
0064 };
0065 
0066 #endif // _BinMDataStd_HeaderFile