]> OCCT Git - occt-copy.git/commitdiff
0030169: Application Framework - Document format version management improvement
authorszy <szy@opencascade.com>
Tue, 9 Oct 2018 14:30:10 +0000 (17:30 +0300)
committerapn <apn@opencascade.com>
Thu, 18 Oct 2018 16:09:21 +0000 (19:09 +0300)
58 files changed:
dox/dev_guides/upgrade/upgrade.md
src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx
src/BinDrivers/BinDrivers_DocumentRetrievalDriver.hxx
src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx
src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.hxx
src/BinLDrivers/BinLDrivers_DocumentSection.cxx
src/BinLDrivers/BinLDrivers_DocumentSection.hxx
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx
src/BinMDataStd/BinMDataStd.cxx
src/BinMDataStd/BinMDataStd.hxx
src/BinMDataStd/BinMDataStd_AsciiStringDriver.cxx
src/BinMDataStd/BinMDataStd_BooleanArrayDriver.cxx
src/BinMDataStd/BinMDataStd_BooleanListDriver.cxx
src/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx
src/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx
src/BinMDataStd/BinMDataStd_ExtStringListDriver.cxx
src/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx
src/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx
src/BinMDataStd/BinMDataStd_IntegerDriver.cxx
src/BinMDataStd/BinMDataStd_IntegerListDriver.cxx
src/BinMDataStd/BinMDataStd_NameDriver.cxx
src/BinMDataStd/BinMDataStd_RealArrayDriver.cxx
src/BinMDataStd/BinMDataStd_RealDriver.cxx
src/BinMDataStd/BinMDataStd_RealListDriver.cxx
src/BinMDataStd/BinMDataStd_ReferenceArrayDriver.cxx
src/BinMDataStd/BinMDataStd_ReferenceListDriver.cxx
src/BinMNaming/BinMNaming.cxx
src/BinMNaming/BinMNaming.hxx
src/BinMNaming/BinMNaming_NamingDriver.cxx
src/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx
src/CDM/CDM_Document.cxx
src/CDM/CDM_Document.hxx
src/DDocStd/DDocStd_ApplicationCommands.cxx
src/XmlDrivers/XmlDrivers_DocumentRetrievalDriver.cxx
src/XmlDrivers/XmlDrivers_DocumentRetrievalDriver.hxx
src/XmlLDrivers/XmlLDrivers.cxx
src/XmlLDrivers/XmlLDrivers.hxx
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.hxx
src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx
src/XmlMDataStd/XmlMDataStd.cxx
src/XmlMDataStd/XmlMDataStd.hxx
src/XmlMDataStd/XmlMDataStd_ByteArrayDriver.cxx
src/XmlMDataStd/XmlMDataStd_ExtStringArrayDriver.cxx
src/XmlMDataStd/XmlMDataStd_IntPackedMapDriver.cxx
src/XmlMDataStd/XmlMDataStd_IntegerArrayDriver.cxx
src/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx
src/XmlMDataStd/XmlMDataStd_TreeNodeDriver.cxx
src/XmlMNaming/XmlMNaming.cxx
src/XmlMNaming/XmlMNaming.hxx
src/XmlMNaming/XmlMNaming_NamingDriver.cxx
src/XmlMXCAFDoc/XmlMXCAFDoc_LocationDriver.cxx
src/XmlObjMgt/FILES
src/XmlObjMgt/XmlObjMgt_RRelocationTable.cxx [new file with mode: 0644]
src/XmlObjMgt/XmlObjMgt_RRelocationTable.hxx
src/XmlObjMgt/XmlObjMgt_SRelocationTable.cxx [new file with mode: 0644]
src/XmlObjMgt/XmlObjMgt_SRelocationTable.hxx
tests/bugs/caf/bug28691

index b4bd2b0df2d694c4d482bba715a59b4d99098503..b7a5856a52b1ce808e10c4756c267b1b6c375431 100644 (file)
@@ -1621,3 +1621,9 @@ Now methods *GeomConvert::ConcatG1*, *GeomConvert::ConcatC1*, *Geom2dConvert::Co
 
 *SelectBasics_PickResult* structure has been extended, so that it now defines 3D point on detected entity in addition to Depth value along picking ray.
 *SelectMgr_SelectingVolumeManager::Overlap()* methods have been corrected to fill in *SelectBasics_PickResult* structure (depth and 3D point) instead of only depth value, so that custom *Select3D_SensitiveEntity* implementation should be updated accordingly (including *Select3D_SensitiveSet* subclasses).
+
+@subsection upgrade_740_ocafpersistence Document format version management improvement.
+
+Previously Document format version after restoring by DocumentRetrievalDriver was propagated using static methods of corresponding units (like MDataStd or MNaming) to static variables of these units and after that became accessible to Drivers of these units.
+Now Document format version is available to drivers via RelocationTable. The Relocation table now keeps HeaderData of the document and a format version can be extracted in next way: theRelocTable.GetHeaderData()->StorageVersion().
+Obsolete methods: *static void SetDocumentVersion (const Standard_Integer DocVersion)* and *static Standard_Integer DocumentVersion()* of *BinMDataStd*, *BinMNaming*, *XmlMDataStd* and *XmlMNaming* are removed.
index 45e6a1ac1a9cbfdd453060bed58be74b97242f5a..95263f98e02149672c97303a467c2fcfaded15af 100644 (file)
@@ -106,14 +106,4 @@ void BinDrivers_DocumentRetrievalDriver::Clear()
   BinLDrivers_DocumentRetrievalDriver::Clear();
 }
 
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose  : 
-//=======================================================================
-void BinDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
-                                    const Standard_Integer theDocVersion )
-{
-  BinMDataStd::SetDocumentVersion(theDocVersion);
-  BinMNaming::SetDocumentVersion(theDocVersion);
-}
 
index 2275a838b2916f15f44e17150d8b33b3725bcc27..8d63cd86af3b77f9f1a68cd4b6d4d6570224088f 100644 (file)
@@ -50,10 +50,6 @@ public:
 
   //! Clears the NamedShape driver
   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion) Standard_OVERRIDE;
-
-
 
 
   DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentRetrievalDriver,BinLDrivers_DocumentRetrievalDriver)
index 434a971a7b802bcf1f82967154d6eb98c79b1707..662cf954efdf3dc48760ef02794374336fadac00 100644 (file)
@@ -215,11 +215,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
         myMsgDriver->Send (aTypeNames(i), Message_Warning);
   }
 
-  // propagate the opened document version to data drivers
-  PropagateDocumentVersion(aFileVer);
-
   // 2. Read document contents
-
   // 2a. Retrieve data from the stream:
   myRelocTable.Clear();
   myRelocTable.SetHeaderData(aHeaderData);
@@ -232,7 +228,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
   if (aFileVer >= 3) {
     BinLDrivers_DocumentSection aSection;
     do {
-      BinLDrivers_DocumentSection::ReadTOC (aSection, theIStream);
+      BinLDrivers_DocumentSection::ReadTOC (aSection, theIStream, aFileVer);
       mySections.Append(aSection);
     } while(!aSection.Name().IsEqual((Standard_CString)SHAPESECTION_POS) && !theIStream.eof());
 
@@ -338,7 +334,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
                           const TDF_Label&  theLabel)
 {
   Standard_Integer nbRead = 0;
-  static TCollection_ExtendedString aMethStr
+  TCollection_ExtendedString aMethStr
     ("BinLDrivers_DocumentRetrievalDriver: ");
 
   // Read attributes:
@@ -511,15 +507,6 @@ void BinLDrivers_DocumentRetrievalDriver::Clear()
   myMapUnsupported.Clear();
 }
 
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose  : 
-//=======================================================================
-void BinLDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(const Standard_Integer theDocVersion )
-{
-  BinMDataStd::SetDocumentVersion(theDocVersion);
-}
-
 //=======================================================================
 //function : CheckDocumentVersion
 //purpose  : 
index b9705779d901b6bc69e4d8a2cbde7c98f204516b..0bbd0045ee3508541ebef2e3787af105db17716a 100644 (file)
@@ -91,9 +91,6 @@ protected:
 
   //! clears the reading-cash data in drivers if any.
   Standard_EXPORT virtual void Clear();
-
-  //! provides the version of document to all drivers
-  Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion);
   
   //! Check a file version(in which file was written) with a current version.
   //! Redefining this method is a chance for application to read files
index b527ca568aab10d4ea7741df3468c8d68d417f40..e3a7c90dcfca058a4eef335af744f60224f919f4 100644 (file)
@@ -185,7 +185,8 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream&   theStream,
 
 void BinLDrivers_DocumentSection::ReadTOC
                                 (BinLDrivers_DocumentSection& theSection,
-                                 Standard_IStream&            theStream)
+                                 Standard_IStream&            theStream,
+                                 const Standard_Integer theDocFormatVersion)
 {
   char aBuf[512];
   Standard_Integer aNameBufferSize;
@@ -198,7 +199,7 @@ void BinLDrivers_DocumentSection::ReadTOC
     theSection.myName = (Standard_CString)&aBuf[0];
 
     uint64_t aValue[3];
-    if (BinMDataStd::DocumentVersion() <= 9)
+    if (theDocFormatVersion <= 9)
     {
       // Old documents stored file position as 4-bytes values.
       Standard_Integer aValInt[3];
index 0fd63f2b5df8ba816b7280b6bcbc367f1ed0f281..0fa488839ea16bcc06a525424807e41efaccb6ad 100644 (file)
@@ -72,7 +72,8 @@ public:
   
   //! Fill a DocumentSection instance from the data that are read
   //! from TOC.
-  Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS);
+  Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS,
+                                       const Standard_Integer theDocFormatVersion);
 
 
 
index 5249b056de59685b7de916a48bc34edf8d1c037d..4c7d91fdd9b4820ea93e95fc5781f143925e5509 100644 (file)
@@ -187,7 +187,7 @@ void BinLDrivers_DocumentStorageDriver::UnsupportedAttrMsg
                         (const Handle(Standard_Type)& theType)
 {
 #ifdef OCCT_DEBUG
-  static TCollection_ExtendedString aMsg
+  TCollection_ExtendedString aMsg
     ("BinDrivers_DocumentStorageDriver: warning: attribute driver for type ");
 #endif
   if (!myMapUnsupported.Contains(theType)) {
index c0c361157d3ea067a1b9e06c8be9150978871363..a407dd0cf029802646117668a9f6b2684233c231 100644 (file)
@@ -44,7 +44,6 @@
 #include <BinMDF_ADriverTable.hxx>
 #include <Message_Messenger.hxx>
 
-static Standard_Integer myDocumentVersion = -1;
 //=======================================================================
 //function : AddDrivers
 //purpose  : 
@@ -81,20 +80,3 @@ void BinMDataStd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
   theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver   (theMsgDriver) );
   theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver  (theMsgDriver) );
 }
-
-//=======================================================================
-//function : SetDocumentVersion
-//purpose  : Sets current document version
-//=======================================================================
-void BinMDataStd::SetDocumentVersion(const Standard_Integer theVersion)
-{
-  myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose  : Retrieved document version
-//=======================================================================
-Standard_Integer BinMDataStd::DocumentVersion()
-{
-  return myDocumentVersion;
-}
index 659ef2fdda962c1a5edd6086d0975608d7e1d0df..64db29aa4ffc45d81cbc8e9d5edd3bb1f5e8d8de 100644 (file)
 
 class BinMDF_ADriverTable;
 class Message_Messenger;
-class BinMDataStd_NameDriver;
-class BinMDataStd_IntegerDriver;
-class BinMDataStd_RealDriver;
-class BinMDataStd_IntegerArrayDriver;
-class BinMDataStd_RealArrayDriver;
-class BinMDataStd_UAttributeDriver;
-class BinMDataStd_DirectoryDriver;
-class BinMDataStd_CommentDriver;
-class BinMDataStd_VariableDriver;
-class BinMDataStd_ExpressionDriver;
-class BinMDataStd_RelationDriver;
-class BinMDataStd_NoteBookDriver;
-class BinMDataStd_TreeNodeDriver;
-class BinMDataStd_ExtStringArrayDriver;
-class BinMDataStd_TickDriver;
-class BinMDataStd_AsciiStringDriver;
-class BinMDataStd_IntPackedMapDriver;
-class BinMDataStd_IntegerListDriver;
-class BinMDataStd_RealListDriver;
-class BinMDataStd_ExtStringListDriver;
-class BinMDataStd_BooleanListDriver;
-class BinMDataStd_ReferenceListDriver;
-class BinMDataStd_BooleanArrayDriver;
-class BinMDataStd_ReferenceArrayDriver;
-class BinMDataStd_ByteArrayDriver;
-class BinMDataStd_NamedDataDriver;
 
 //! Storage and Retrieval drivers for modelling attributes.
 class BinMDataStd 
@@ -62,16 +36,12 @@ public:
   
   //! Adds the attribute drivers to <theDriverTable>.
   Standard_EXPORT static void AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, const Handle(Message_Messenger)& aMsgDrv);
-  
-  Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-  
-  Standard_EXPORT static Standard_Integer DocumentVersion();
 
 template<class T>
-static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt)
+static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt, const Standard_Integer aDocFormatVersion)
 {
   Standard_Boolean ok = Standard_True;
-  if(BinMDataStd::DocumentVersion() > 9) { // process user defined guid
+  if(aDocFormatVersion > 9) { // process user defined guid
     const Standard_Integer& aPos = theSource.Position();
     Standard_GUID aGuid;
     ok = theSource >> aGuid;
index c4346df6e96a2f39cda0eb27e7f6a11ca1f7b308..cc17b780672a9391a93c53a6e42e30cca0393225 100644 (file)
@@ -55,14 +55,14 @@ Handle(TDF_Attribute) BinMDataStd_AsciiStringDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_AsciiStringDriver::Paste
                          (const BinObjMgt_Persistent&  Source,
                           const Handle(TDF_Attribute)& Target,
-                          BinObjMgt_RRelocationTable&  /*RelocTable*/) const
+                          BinObjMgt_RRelocationTable&  RelocTable) const
 {
   Handle(TDataStd_AsciiString) aStrAtt = Handle(TDataStd_AsciiString)::DownCast(Target);
   TCollection_AsciiString aString;
   Standard_Boolean ok = Source >> aString;
   if (ok)
     aStrAtt->Set( aString );
-  if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+  if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
        const Standard_Integer& aPos = Source.Position();
        Standard_GUID aGuid;
        ok = Source >> aGuid;   
index 347ce54cf1d5f783a3c985532394cf52ca096f98..aa856f6b4b7741a69144063ab4c290b75d531d5a 100644 (file)
@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_BooleanArrayDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                        const Handle(TDF_Attribute)& theTarget,
-                                                       BinObjMgt_RRelocationTable&  ) const
+                                                       BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -71,7 +71,7 @@ Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persisten
     bytes->SetValue(i, aTargetArray.Value(i));
   }
   anAtt->SetInternalArray(bytes);
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index f07a5b36e82fdfad508569350f6be422d7cb3c79..0821b8c738f13fd98c99888b496353b7fc08c704 100644 (file)
@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_BooleanListDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                       const Handle(TDF_Attribute)& theTarget,
-                                                      BinObjMgt_RRelocationTable&  ) const
+                                                      BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aIndex, aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -71,7 +71,7 @@ Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent
     }
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
@@ -101,4 +101,4 @@ void BinMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource
   // process user defined guid
   if(anAtt->ID() != TDataStd_BooleanList::GetID()) 
     theTarget << anAtt->ID();
-}
\ No newline at end of file
+}
index 6f0cc7d92d774a538903ce6399c1f594c05953a5..5572d807c81720e702b8ec5a7085d5c056249c0d 100644 (file)
@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_ByteArrayDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                     const Handle(TDF_Attribute)& theTarget,
-                                                    BinObjMgt_RRelocationTable&  ) const
+                                                    BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -71,7 +71,7 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
   anAtt->ChangeArray(bytes);
 
   Standard_Boolean aDelta(Standard_False); 
-  if(BinMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Byte aDeltaValue;
     if (! (theSource >> aDeltaValue))
       return Standard_False;
@@ -80,7 +80,7 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
   }
   anAtt->SetDelta(aDelta);
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index 32140aff6b4fb2b2beef3048019c0a33161996e7..089e2cf1606534acf555342bc20322786108e418 100644 (file)
@@ -54,7 +54,7 @@ Handle(TDF_Attribute) BinMDataStd_ExtStringArrayDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
                                 (const BinObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
+                                 BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -81,7 +81,7 @@ Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
 
   if(ok) {
     Standard_Boolean aDelta(Standard_False);
-    if(BinMDataStd::DocumentVersion() > 2) {
+    if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
       Standard_Byte aDeltaValue;
       if (! (theSource >> aDeltaValue)) {
         return Standard_False;
@@ -92,7 +92,7 @@ Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
     anAtt->SetDelta(aDelta);
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return ok;
 }
 
index 35c3724dad53a442b156254f465f3d443e21de25..87d7beda855c9a0a574103a22b5b603bf5e49e08 100644 (file)
@@ -52,7 +52,7 @@ Handle(TDF_Attribute) BinMDataStd_ExtStringListDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
                                 (const BinObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
+                                 BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -74,7 +74,7 @@ Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
     }
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index ce8004c716dee760ad37ca198bffd8c86a362085..5d2dd63fef2c26632f53bd22e080da19414ded9a 100644 (file)
@@ -59,7 +59,7 @@ Handle(TDF_Attribute) BinMDataStd_IntPackedMapDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
                          (const BinObjMgt_Persistent&  Source,
                           const Handle(TDF_Attribute)& Target,
-                          BinObjMgt_RRelocationTable&  /*RelocTable*/) const
+                          BinObjMgt_RRelocationTable&  RelocTable) const
 {
   Handle(TDataStd_IntPackedMap) aTagAtt = Handle(TDataStd_IntPackedMap)::DownCast(Target);
   if(aTagAtt.IsNull()) {
@@ -87,7 +87,7 @@ Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
   }
 
   Standard_Boolean aDelta(Standard_False);
-  if(BinMDataStd::DocumentVersion() > 2) {
+  if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Byte aDeltaValue;
     if (! (Source >> aDeltaValue))
       return Standard_False;
index 408410c9b2499692c0deff671132e9289e04dcc5..e9c8b28358c78779f637cf617003c1d815a21605 100644 (file)
@@ -53,7 +53,7 @@ Handle(TDF_Attribute) BinMDataStd_IntegerArrayDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
                                 (const BinObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
+                                 BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -69,7 +69,7 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
   if(!theSource.GetIntArray (&aTargetArray(aFirstInd), aLength))
     return Standard_False;
   Standard_Boolean aDelta(Standard_False);
-  if(BinMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Byte aDeltaValue;
     if (! (theSource >> aDeltaValue))
       return Standard_False;
@@ -77,12 +77,11 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
       aDelta = (aDeltaValue != 0);
   }
 #ifdef OCCT_DEBUG
-  else if(BinMDataStd::DocumentVersion() == -1)
-    cout << "Current DocVersion field is not initialized. "  <<endl;
+    //cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
 #endif
   anAtt->SetDelta(aDelta);
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True; 
 }
 
index 5ddca9fd052f07a1db8cad62df8700487dc99668..6ac2571fde686d3f8cfa6efd646d54666992c458 100644 (file)
@@ -52,14 +52,14 @@ Handle(TDF_Attribute) BinMDataStd_IntegerDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_IntegerDriver::Paste
                                 (const BinObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
+                                 BinObjMgt_RRelocationTable&  theRT) const
 {
   Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
   Standard_Integer aValue;
   Standard_Boolean ok = theSource >> aValue;
   if (ok)
     anAtt->Set(aValue);
-  if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+  if(theRT.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
        const Standard_Integer& aPos = theSource.Position();
        Standard_GUID aGuid;
        ok = theSource >> aGuid;        
index cc94ed20202f0594c91a151e9ea3bcc9ff0e49b0..9d3954a9537f54e718ea5dd52f41f1a8a10d4e05 100644 (file)
@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_IntegerListDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                       const Handle(TDF_Attribute)& theTarget,
-                                                      BinObjMgt_RRelocationTable&  ) const
+                                                      BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aIndex, aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -67,7 +67,7 @@ Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent
     }
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index 25531e837bf35d27dbb0ea2d1e66f1952aa5ef0e..fba6fa4da7789a3b665899f7717f1505a3bf347d 100644 (file)
@@ -52,14 +52,14 @@ Handle(TDF_Attribute) BinMDataStd_NameDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_NameDriver::Paste
                          (const BinObjMgt_Persistent&  Source,
                           const Handle(TDF_Attribute)& Target,
-                          BinObjMgt_RRelocationTable&  /*RelocTable*/) const
+                          BinObjMgt_RRelocationTable&  RelocTable) const
 {
   Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Target);
   TCollection_ExtendedString aStr;
   Standard_Boolean ok = Source >> aStr;
   if (ok)
     aName->Set( aStr );
-  if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+  if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
        const Standard_Integer& aPos = Source.Position();
        Standard_GUID aGuid;
        ok = Source >> aGuid;   
index fa43a790329d4274331c42e2015f71519a0267f9..f6d41acba6ad749a59eaa1e64d6dcb854bbff3b4 100644 (file)
@@ -53,7 +53,7 @@ Handle(TDF_Attribute) BinMDataStd_RealArrayDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_RealArrayDriver::Paste
                                 (const BinObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
+                                 BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -70,7 +70,7 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
     return Standard_False;
 
   Standard_Boolean aDelta(Standard_False);
-  if(BinMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Byte aDeltaValue;
     if (! (theSource >> aDeltaValue))
       return Standard_False;
@@ -79,7 +79,7 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
   }
   anAtt->SetDelta(aDelta);
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True; 
 }
 
index e147eec9a8dae27e5ae09ef5544629b5f7176de5..5c0111ef3ddae62218e9e23de41f06967705000a 100644 (file)
@@ -52,14 +52,14 @@ Handle(TDF_Attribute) BinMDataStd_RealDriver::NewEmpty() const
 Standard_Boolean BinMDataStd_RealDriver::Paste
                                 (const BinObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
+                                 BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
   Standard_Real aValue;
   Standard_Boolean ok = theSource >> aValue;
   if (ok)
     anAtt->Set(aValue);
-  if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
        const Standard_Integer& aPos = theSource.Position();
        Standard_GUID aGuid;
        ok = theSource >> aGuid;        
index a1c4a1918de887b3b8f6caf94cc5a895d2e5df62..51eace351f2bd74f4ca251e25fed4eaff8c470a1 100644 (file)
@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_RealListDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                    const Handle(TDF_Attribute)& theTarget,
-                                                   BinObjMgt_RRelocationTable&  ) const
+                                                   BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aIndex, aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -68,7 +68,7 @@ Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent&
     }
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index c1d47a74669b2fd4d6d0d8e26595ad94df860360..a58a17fdc2a26f5e5e3b515e95aa69d8aa79026e 100644 (file)
@@ -51,7 +51,7 @@ Handle(TDF_Attribute) BinMDataStd_ReferenceArrayDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                          const Handle(TDF_Attribute)& theTarget,
-                                                         BinObjMgt_RRelocationTable&  ) const
+                                                         BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -73,7 +73,7 @@ Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persist
       anAtt->SetValue(i, L);
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index 3105ec5f6e868a312fbd5aad150b03d76eba2247..da5cd9c0ccf8c6c65649b69c9f1251dce98fe991 100644 (file)
@@ -52,7 +52,7 @@ Handle(TDF_Attribute) BinMDataStd_ReferenceListDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persistent&  theSource,
                                                         const Handle(TDF_Attribute)& theTarget,
-                                                        BinObjMgt_RRelocationTable&  ) const
+                                                        BinObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd;
   if (! (theSource >> aFirstInd >> aLastInd))
@@ -76,7 +76,7 @@ Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persiste
     }
   }
 
-  BinMDataStd::SetAttributeID(theSource, anAtt);
+  BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
   return Standard_True;
 }
 
index 530c490138d8fcd23269d04fda37e4e172e4f96a..40f47baf3cf07246e856c84c0e2b2d2859249718 100644 (file)
@@ -20,7 +20,6 @@
 #include <BinMNaming_NamingDriver.hxx>
 #include <Message_Messenger.hxx>
 
-static Standard_Integer myDocumentVersion = -1;
 //=======================================================================
 //function : AddDrivers
 //purpose  : 
@@ -32,19 +31,3 @@ void BinMNaming::AddDrivers (const Handle(BinMDF_ADriverTable)& aDriverTable,
   aDriverTable->AddDriver (new BinMNaming_NamingDriver(aMessageDriver));
 }
 
-//=======================================================================
-//function : SetDocumentVersion
-//purpose  : Sets current document version
-//=======================================================================
-void BinMNaming::SetDocumentVersion(const Standard_Integer theVersion)
-{
-  myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose  : Retrieved document version
-//=======================================================================
-Standard_Integer BinMNaming::DocumentVersion()
-{
-  return myDocumentVersion;
-}
index 27aea44361d76c91e7176476ab0b5d62758b685a..efb2e7cf060f1af7ee251ce2990a3d14ac1e2933 100644 (file)
@@ -37,13 +37,6 @@ public:
   
   //! Adds the attribute drivers to <theDriverTable>.
   Standard_EXPORT static void AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, const Handle(Message_Messenger)& aMsgDrv);
-  
-  Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-  
-  Standard_EXPORT static Standard_Integer DocumentVersion();
-
-
-
 
 protected:
 
index 5fc8aa26b3f51663fbc58b7ebeb7e3324f62cc01..fa085973bd78ce9b10baee00a5be6402d172c6e8 100644 (file)
@@ -237,7 +237,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
        myMessageDriver->Send (aMsg, Message_Warning);
          }
 
-    if(BinMNaming::DocumentVersion() > 3) {
+    if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 3) {
        TCollection_AsciiString entry;
        ok = theSource >> entry;
        if(ok) {
@@ -254,7 +254,8 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
                aName.ContextLabel(tLab);
            }
        }
-    if(BinMNaming::DocumentVersion() > 4 && BinMNaming::DocumentVersion() < 7) {
+    if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 4 && 
+       theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 7) {
           // Orientation processing - converting from old format
       Handle(TNaming_NamedShape) aNShape;
       if(anAtt->Label().FindAttribute(TNaming_NamedShape::GetID(), aNShape)) {
@@ -273,7 +274,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
                }
          }
        }
-    if(BinMNaming::DocumentVersion() > 6) {
+    if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 6) {
       ok = theSource >> anIndx;
       TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
       if(ok) {
@@ -290,10 +291,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
        }
        }
 #ifdef OCCT_DEBUG
-      else if(BinMNaming::DocumentVersion() == -1)
-       cout << "Current DocVersion field is not initialized. "  <<endl;
-      else 
-       cout << "Current DocVersion = " << BinMNaming::DocumentVersion() <<endl;
+             cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;      
 #endif
        }
   }
index 95465ef63618d40920d0a7c36b857f56edd29e19..dbf79b04fac93c6f5fd3994e55d03a633c42c0b1 100644 (file)
@@ -92,7 +92,7 @@ Standard_Boolean BinMXCAFDoc_LocationDriver::Translate(const BinObjMgt_Persisten
     return Standard_True;
   }
   
-  Standard_Integer aFileVer = BinMDataStd::DocumentVersion();
+  Standard_Integer aFileVer = theMap.GetHeaderData()->StorageVersion().IntegerValue();
   if( aFileVer > 5 && myLocations == 0 )
   {
     return Standard_False;
index 1b78a09a4b30505b8ede8fbda35437f4155d554f..e1c496710cd92065815681debfd0a35422711ee8 100644 (file)
@@ -60,7 +60,8 @@ CDM_Document::CDM_Document():
   myRequestedNameIsDefined      (Standard_False),
   myRequestedPreviousVersionIsDefined(Standard_False),
   myFileExtensionWasFound       (Standard_False),
-  myDescriptionWasFound         (Standard_False)
+  myDescriptionWasFound         (Standard_False),
+  myStorageFormatVersion        (0)
 {}
 
 
@@ -1264,3 +1265,22 @@ void CDM_Document::SetReferenceCounter (const Standard_Integer aReferenceCounter
 {
   myActualReferenceIdentifier=aReferenceCounter;
 }
+
+//=======================================================================
+//function : StorageFormatVersion
+//purpose  : 
+//=======================================================================
+Standard_Integer CDM_Document::StorageFormatVersion() const
+{
+  return myStorageFormatVersion;
+}
+
+//! 
+//=======================================================================
+//function : ChangeStorageFormatVersion
+//purpose  : Sets <theVersion> of the format to be used to store the document
+//=======================================================================
+void CDM_Document::ChangeStorageFormatVersion(const Standard_Integer theVersion)
+{
+  myStorageFormatVersion = theVersion;
+}
index 1b2d3d8f136c81f388948077a2d8f0b4126ee184..895c70329f1a2ff34f321ab7e05b4ad5563ae65b 100644 (file)
@@ -343,6 +343,12 @@ Standard_OStream& operator << (Standard_OStream& anOStream);
 
   Standard_EXPORT void SetReferenceCounter (const Standard_Integer aReferenceCounter);
 
+  //! Returns version of the format to be used to store the document
+  Standard_EXPORT Standard_Integer StorageFormatVersion() const;
+
+  //! Sets <theVersion> of the format to be used to store the document
+  Standard_EXPORT void ChangeStorageFormatVersion(const Standard_Integer theVersion);
+
 friend class CDM_Reference;
 friend class CDM_ReferenceIterator;
 friend class CDM_Application;
@@ -359,7 +365,6 @@ protected:
 
   Standard_Boolean myResourcesAreLoaded;
 
-
 private:
 
   
@@ -398,7 +403,7 @@ private:
   Standard_Boolean myFileExtensionWasFound;
   Standard_Boolean myDescriptionWasFound;
   Handle(CDM_Application) myApplication;
-
+  Standard_Integer myStorageFormatVersion;
 
 };
 
index 01653500a9f836764d911b0d6d178cc581a8a83e..33ba7adf18da232670ceae6d7a8a8381cb36fdbf 100644 (file)
@@ -484,10 +484,12 @@ static Standard_Integer DDocStd_SetStorageVersion (Draw_Interpretor& ,
                                                    Standard_Integer nb,
                                                    const char** a)
 {  
-  if (nb == 2)
+  if (nb == 3)
   {
-    const int version = atoi(a[1]);
-    XmlLDrivers::SetStorageVersion(version);
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(a[1], D)) return 1;
+    const int version = atoi(a[2]);
+    D->ChangeStorageFormatVersion(version);
     return 0;
   }
   return 1;
@@ -498,11 +500,16 @@ static Standard_Integer DDocStd_SetStorageVersion (Draw_Interpretor& ,
 //purpose  : 
 //=======================================================================
 static Standard_Integer DDocStd_GetStorageVersion (Draw_Interpretor& di,
-                                                   Standard_Integer ,
-                                                   const char** )
-{  
-  di << XmlLDrivers::StorageVersion() << "\n" ;
-  return 0;
+                                                   Standard_Integer nb,
+                                                   const char** a)
+{ 
+  if (nb == 2) {
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(a[1], D)) return 1;
+    di << D->StorageFormatVersion() << "\n";
+    return 0;
+  }
+  return 1;
 }
 
 //=======================================================================
@@ -565,9 +572,9 @@ void DDocStd::ApplicationCommands(Draw_Interpretor& theCommands)
                  __FILE__, DDocStd_PrintComments, g);
 
   theCommands.Add("GetStorageVersion",
-                 "GetStorageVersion",
+                 "GetStorageVersion Doc",
                  __FILE__, DDocStd_GetStorageVersion, g);
   theCommands.Add("SetStorageVersion",
-                 "SetStorageVersion Version",
+                 "SetStorageVersion Doc Version",
                  __FILE__, DDocStd_SetStorageVersion, g);
 }
index 5c5d4ab54a8e5b04f0d2dc66d95fb7b2c21b5762..2b0a1b8fb73fd0df2363db1173fa54f01dcd7b53 100644 (file)
 #include <TNaming_NamedShape.hxx>
 #include <XmlDrivers.hxx>
 #include <XmlDrivers_DocumentRetrievalDriver.hxx>
-#include <XmlMDataStd.hxx>
 #include <XmlMDF_ADriver.hxx>
 #include <XmlMDF_ADriverTable.hxx>
-#include <XmlMNaming.hxx>
 #include <XmlMNaming_NamedShapeDriver.hxx>
 #include <XmlObjMgt_Element.hxx>
 
@@ -46,17 +44,6 @@ Handle(XmlMDF_ADriverTable) XmlDrivers_DocumentRetrievalDriver::AttributeDrivers
   return XmlDrivers::AttributeDrivers (theMessageDriver);
 }
 
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose  : 
-//=======================================================================
-void XmlDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
-                                   const Standard_Integer theDocVersion )
-{
-  XmlMDataStd::SetDocumentVersion(theDocVersion);
-  XmlMNaming::SetDocumentVersion(theDocVersion);
-}
-
 //=======================================================================
 //function : ReadShapeSection
 //purpose  : Implementation of ReadShapeSection
index 2c45e8983798f0c26748d0892de785637e32814d..f73d511c71cc565407a71df3aa806448b546fb90 100644 (file)
@@ -43,10 +43,7 @@ public:
   
   Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection (const XmlObjMgt_Element& thePDoc, const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver) Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theDocVersion) Standard_OVERRIDE;
-
+  Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver) Standard_OVERRIDE;  
 
 
 
index 7f7ca1d1154cafab73dc7af7525abca750f68a54..ab1adbdef73a009d16f1e1569840548b1e9a2ab5 100644 (file)
@@ -132,10 +132,6 @@ int XmlLDrivers::StorageVersion()
 {
   return CURRENT_DOCUMENT_VERSION;
 }
-void XmlLDrivers::SetStorageVersion(const int version)
-{
-  CURRENT_DOCUMENT_VERSION = version;
-}
 
 // Declare entry point PLUGINFACTORY
 PLUGIN(XmlLDrivers)
index 767799a693a0dc42bfa340834a89670f2312c729..171426217354eeb2aedf3c2dc29e4403d3161cb4 100644 (file)
@@ -43,7 +43,6 @@ public:
   Standard_EXPORT static Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
   
   Standard_EXPORT static int StorageVersion();
-  Standard_EXPORT static void SetStorageVersion (const int version);
 };
 
 #endif // _XmlLDrivers_HeaderFile
index 499acd7bba8c08be7e1907b07433dbcf441a1b3d..e4d888def2d98b40e93a3b9d08984f6824e88810 100644 (file)
@@ -34,7 +34,6 @@
 #include <UTL.hxx>
 #include <XmlLDrivers.hxx>
 #include <XmlLDrivers_DocumentRetrievalDriver.hxx>
-#include <XmlMDataStd.hxx>
 #include <XmlMDF.hxx>
 #include <XmlMDF_ADriver.hxx>
 #include <XmlMDF_ADriverTable.hxx>
@@ -280,9 +279,6 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
     }
 
     if( aCurDocVersion < 2) aCurDocVersion = 2;
-
-    PropagateDocumentVersion(aCurDocVersion);
-
     Standard_Boolean isRef = Standard_False;
     for (LDOM_Node aNode = anInfoElem.getFirstChild();
          aNode != NULL; aNode = aNode.getNextSibling()) {
@@ -438,6 +434,12 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
   if(!aNSDriver.IsNull())
     ::take_time (0, " +++++ Fin reading Shapes :    ", aMsgDriver);
 
+  // 2.1. Keep document format version in RT
+  Handle(Storage_HeaderData) aHeaderData = new Storage_HeaderData();
+  aHeaderData->SetStorageVersion(aCurDocVersion);
+  myRelocTable.Clear();
+  myRelocTable.SetHeaderData(aHeaderData);
+
   // 5. Read document contents
   try
   {
@@ -477,7 +479,6 @@ Standard_Boolean XmlLDrivers_DocumentRetrievalDriver::MakeDocument
 {
   Standard_Boolean aResult = Standard_False;
   Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
-  myRelocTable.Clear();
   if (!TDOC.IsNull()) 
   {
     Handle(TDF_Data) aTDF = new TDF_Data();
@@ -533,16 +534,6 @@ static void take_time (const Standard_Integer isReset, const char * aHeader,
 }
 #endif
 
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose  : 
-//=======================================================================
-void XmlLDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
-                                   const Standard_Integer theDocVersion )
-{
-  XmlMDataStd::SetDocumentVersion(theDocVersion);
-}
-
 //=======================================================================
 //function : ReadShapeSection
 //purpose  : definition of ReadShapeSection
index cbb66a0ffed239cf984d55fc3bbaa47413021680..9262ddadf770da3c992787a6569029c7a42e09d1 100644 (file)
@@ -73,12 +73,10 @@ protected:
   Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection (const XmlObjMgt_Element& thePDoc, const Handle(Message_Messenger)& theMsgDriver);
   
   Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver);
-  
-  Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theDocVersion);
 
   Handle(XmlMDF_ADriverTable) myDrivers;
-  XmlObjMgt_RRelocationTable myRelocTable;
-  TCollection_ExtendedString myFileName;
+  XmlObjMgt_RRelocationTable  myRelocTable;
+  TCollection_ExtendedString  myFileName;
 
 
 private:
index 91274b5a9b90b834a6e458debb06f8e66fabb657..61c86beb1a7c658d0a6fc2e97caa79e7860f9f9a 100644 (file)
@@ -264,7 +264,18 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
 //  anInfoElem.setAttribute("appv", anAppVersion.ToCString());
 
   // Document version
-  anInfoElem.setAttribute("DocVersion", XmlLDrivers::StorageVersion());
+  Standard_Integer aFormatVersion(XmlLDrivers::StorageVersion());// the last version of the format
+  if (theDocument->StorageFormatVersion() > 0) 
+  {
+    if (XmlLDrivers::StorageVersion() < theDocument->StorageFormatVersion())
+    {
+      TCollection_ExtendedString anErrorString("Unacceptable storage format version, the last verson is used");
+      aMessageDriver->Send(anErrorString.ToExtString(), Message_Warning);     
+    }
+    else            
+      aFormatVersion = theDocument->StorageFormatVersion();
+  }
+  anInfoElem.setAttribute("DocVersion", aFormatVersion);
  
   // User info with Copyright
   TColStd_SequenceOfAsciiString aUserInfo;
@@ -282,6 +293,12 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
   for(i = 1; i <= aRefs.Length(); i++)
     aUserInfo.Append(aRefs.Value(i));
 
+  // Keep fomat version in Reloc. table
+  Handle(Storage_HeaderData) aHeaderData = theData->HeaderData();
+  aHeaderData->SetStorageVersion(aFormatVersion);
+  myRelocTable.Clear();
+  myRelocTable.SetHeaderData(aHeaderData);
+
   for (i = 1; i <= aUserInfo.Length(); i++)
   {
     XmlObjMgt_Element aUIItem = aDOMDoc.createElement ("iitem");
@@ -351,7 +368,6 @@ Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
 {  
   TCollection_ExtendedString aMessage;
   Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);  
-  myRelocTable.Clear();
   if (!TDOC.IsNull()) 
   {
 //    myRelocTable.SetDocument (theElement.getOwnerDocument());
index da793d45a953495d360a3ecce75e66b2fdebb1a1..76b1f6bd17119ad3a3d81fb0471671cf6beda2cf 100644 (file)
@@ -45,7 +45,6 @@
 #include <XmlMDataStd_VariableDriver.hxx>
 #include <XmlMDF_ADriverTable.hxx>
 
-static Standard_Integer myDocumentVersion = -1;
 //=======================================================================
 //function : AddDrivers
 //purpose  : 
@@ -81,20 +80,3 @@ void XmlMDataStd::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
   aDriverTable-> AddDriver (new XmlMDataStd_AsciiStringDriver   (anMsgDrv));
   aDriverTable-> AddDriver (new XmlMDataStd_IntPackedMapDriver  (anMsgDrv));
 }
-
-//=======================================================================
-//function : SetDocumentVersion
-//purpose  : Sets current document version
-//=======================================================================
-void XmlMDataStd::SetDocumentVersion(const Standard_Integer theVersion)
-{
-  myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose  : Retrieved document version
-//=======================================================================
-Standard_Integer XmlMDataStd::DocumentVersion()
-{
-  return myDocumentVersion;
-}
index a526ab9d427a4901b4fb99900540f5f62a6bb366..7aaa859c7b1ba0565034c6267a600c6b58fd1061 100644 (file)
@@ -60,12 +60,6 @@ public:
   
   //! Adds the attribute drivers to <aDriverTable>.
   Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, const Handle(Message_Messenger)& anMsgDrv);
-  
-  Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-  
-  Standard_EXPORT static Standard_Integer DocumentVersion();
-
-
 
 
 protected:
index 3423e9afb265b1c3b2e3d94d10002c16243eaa03..b4ae0aec4dc67db83c83ef29b7b5811e0f06370f 100644 (file)
@@ -55,7 +55,7 @@ Handle(TDF_Attribute) XmlMDataStd_ByteArrayDriver::NewEmpty() const
 //=======================================================================
 Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&  theSource,
                                                     const Handle(TDF_Attribute)& theTarget,
-                                                    XmlObjMgt_RRelocationTable&  ) const
+                                                    XmlObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd, aValue;
   const XmlObjMgt_Element& anElement = theSource;
@@ -129,7 +129,7 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
   
   Standard_Boolean aDelta(Standard_False);
   
-  if(XmlMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Integer aDeltaValue;
     if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue)) 
     {
@@ -144,8 +144,7 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
       aDelta = aDeltaValue != 0;
   }
 #ifdef OCCT_DEBUG
-  else if(XmlMDataStd::DocumentVersion() == -1)
-    cout << "Current DocVersion field is not initialized. "  <<endl;
+    cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
 #endif
   aByteArray->SetDelta(aDelta);
 
index e66d1981c24923e7396e19c7586d36ccc75ab234..f60b5c30d6359b20b736249c397f0c1612c3ece1 100644 (file)
@@ -76,7 +76,7 @@ Handle(TDF_Attribute) XmlMDataStd_ExtStringArrayDriver::NewEmpty() const
 Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
                                         (const XmlObjMgt_Persistent&  theSource,
                                          const Handle(TDF_Attribute)& theTarget,
-                                         XmlObjMgt_RRelocationTable& ) const
+                                         XmlObjMgt_RRelocationTable& theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd, ind;
   TCollection_ExtendedString aValue;
@@ -195,7 +195,7 @@ Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
   // Read delta-flag.
   Standard_Boolean aDelta(Standard_False);
   
-  if(XmlMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Integer aDeltaValue;
     if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue)) 
       {
@@ -209,10 +209,7 @@ Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
     else
       aDelta = aDeltaValue != 0;
   }
-#ifdef OCCT_DEBUG
-  else if(XmlMDataStd::DocumentVersion() == -1)
-    cout << "Current DocVersion field is not initialized. "  <<endl;
-#endif
+
   aExtStringArray->SetDelta(aDelta);
 
   return Standard_True;
@@ -224,7 +221,7 @@ Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
 //=======================================================================
 void XmlMDataStd_ExtStringArrayDriver::Paste (const Handle(TDF_Attribute)& theSource,
                                          XmlObjMgt_Persistent&        theTarget,
-                                         XmlObjMgt_SRelocationTable&  ) const
+                                         XmlObjMgt_SRelocationTable&  theRelocTable) const
 {
   Handle(TDataStd_ExtStringArray) aExtStringArray =
     Handle(TDataStd_ExtStringArray)::DownCast(theSource);
@@ -243,7 +240,7 @@ void XmlMDataStd_ExtStringArrayDriver::Paste (const Handle(TDF_Attribute)& theSo
   // So, if the user wants to save the document under the 7th or earlier versions,
   // don't apply this improvement.
   Standard_Character c = '-';
-  if (XmlLDrivers::StorageVersion() > 7)
+  if (theRelocTable.GetHeaderData()->StorageVersion().IntegerValue()  > 7)
   {
     // Preferrable symbols for the separator: - _ . : ^ ~
     // Don't use a space as a separator: XML low-level parser sometimes "eats" it.
index eb814a434942269ed7fb019461d27edc08ed3fdd..576e4bbef384c1fe6380de6be4495752c217a4d5 100644 (file)
@@ -59,7 +59,7 @@ Handle(TDF_Attribute) XmlMDataStd_IntPackedMapDriver::NewEmpty () const
 Standard_Boolean XmlMDataStd_IntPackedMapDriver::Paste
                                (const XmlObjMgt_Persistent&  theSource,
                                 const Handle(TDF_Attribute)& theTarget,
-                                XmlObjMgt_RRelocationTable&  ) const
+                                XmlObjMgt_RRelocationTable&  theRelocTable) const
 {
   Handle(TDataStd_IntPackedMap) aPackedMap =
     Handle(TDataStd_IntPackedMap)::DownCast(theTarget);
@@ -106,7 +106,7 @@ Standard_Boolean XmlMDataStd_IntPackedMapDriver::Paste
     if(Ok) {
       Standard_Boolean aDelta(Standard_False);
 
-      if(XmlMDataStd::DocumentVersion() > 2) {
+      if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
         Standard_Integer aDeltaValue;
         if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue)) 
         {
@@ -120,10 +120,6 @@ Standard_Boolean XmlMDataStd_IntPackedMapDriver::Paste
         else
           aDelta = aDeltaValue != 0;
       }
-#ifdef OCCT_DEBUG
-      else if(XmlMDataStd::DocumentVersion() == -1)
-        cout << "Current DocVersion field is not initialized. "  <<endl;
-#endif
       aPackedMap->SetDelta(aDelta);
       return Standard_True;
     }  
index 9c5cc69d5f14925703929015c4dd308f6deaa363..a82d818092dc8362629a20f4780ab63a73c95f9e 100644 (file)
@@ -57,7 +57,7 @@ Handle(TDF_Attribute) XmlMDataStd_IntegerArrayDriver::NewEmpty() const
 Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
                                 (const XmlObjMgt_Persistent&  theSource,
                                  const Handle(TDF_Attribute)& theTarget,
-                                 XmlObjMgt_RRelocationTable&  ) const
+                                 XmlObjMgt_RRelocationTable&  theRelocTable) const
 {
   Standard_Integer aFirstInd, aLastInd, aValue, ind;
   const XmlObjMgt_Element& anElement = theSource;
@@ -129,7 +129,7 @@ Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
   }
   Standard_Boolean aDelta(Standard_False);
   
-  if(XmlMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Integer aDeltaValue;
     if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue)) 
       {
@@ -143,10 +143,7 @@ Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
     else
       aDelta = aDeltaValue != 0;
   }
-#ifdef OCCT_DEBUG
-  else if(XmlMDataStd::DocumentVersion() == -1)
-    cout << "Current DocVersion field is not initialized. "  <<endl;
-#endif
+
   anIntArray->SetDelta(aDelta);
 
   return Standard_True;
index bcc3c43fc84cf1d25734ec83f5e81a052a0f34f4..e238276e6fea5664b9cbf5648835decd8a800c5c 100644 (file)
@@ -60,7 +60,7 @@ Handle(TDF_Attribute) XmlMDataStd_RealArrayDriver::NewEmpty() const
 Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
                                         (const XmlObjMgt_Persistent&  theSource,
                                          const Handle(TDF_Attribute)& theTarget,
-                                         XmlObjMgt_RRelocationTable&  ) const
+                                         XmlObjMgt_RRelocationTable&  theRelocTable) const
 {
 
   Handle(TDataStd_RealArray) aRealArray = Handle(TDataStd_RealArray)::DownCast(theTarget);
@@ -136,7 +136,7 @@ Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
   }
   Standard_Boolean aDelta(Standard_False);
   
-  if(XmlMDataStd::DocumentVersion() > 2) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
     Standard_Integer aDeltaValue;
     if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue)) 
       {
@@ -150,10 +150,6 @@ Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
     else
       aDelta = aDeltaValue != 0;
   }
-#ifdef OCCT_DEBUG
-  else if(XmlMDataStd::DocumentVersion() == -1)
-    cout << "Current DocVersion field is not initialized. "  <<endl;
-#endif
   aRealArray->SetDelta(aDelta);
 
   return Standard_True;
index d8dcc7972e05944027433279d4d89405285ba9a8..c5004b505769f0c736a665eb39a941725b750789 100644 (file)
@@ -118,7 +118,7 @@ void XmlMDataStd_TreeNodeDriver::Paste
   // tree id
   // A not default ID is skipped for storage version 8 and newer.
   if (aS->ID() != TDataStd_TreeNode::GetDefaultTreeID() ||
-      XmlLDrivers::StorageVersion() < 8)
+      theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 8)
   {
     Standard_Character aGuidStr [40];
     Standard_PCharacter pGuidStr=aGuidStr;
index 1aedabda60c4be84ad1a829d71d3034f92e961f5..c2538e7e8fae71bef2774bf4c82dc2c98ff37136 100644 (file)
@@ -20,7 +20,6 @@
 #include <XmlMNaming_NamedShapeDriver.hxx>
 #include <XmlMNaming_NamingDriver.hxx>
 
-static Standard_Integer myDocumentVersion = -1;
 //=======================================================================
 //function : AddStorageDrivers
 //purpose  : 
@@ -31,20 +30,3 @@ void XmlMNaming::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
   aDriverTable->AddDriver (new XmlMNaming_NamedShapeDriver(aMessageDriver));
   aDriverTable->AddDriver (new XmlMNaming_NamingDriver(aMessageDriver));
 }
-
-//=======================================================================
-//function : SetDocumentVersion
-//purpose  : Sets current document version
-//=======================================================================
-void XmlMNaming::SetDocumentVersion(const Standard_Integer theVersion)
-{
-  myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose  : Retrieved document version
-//=======================================================================
-Standard_Integer XmlMNaming::DocumentVersion()
-{
-  return myDocumentVersion;
-}
index c7971fa148aca2ccb3122fdfe7e2e03e33bd5b1a..2f697ab3900d45b57ec4579e15fc0ae299a84917 100644 (file)
@@ -38,12 +38,6 @@ public:
   
   //! Adds the attribute drivers to <aDriverTable>.
   Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, const Handle(Message_Messenger)& aMessageDriver);
-  
-  Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-  
-  Standard_EXPORT static Standard_Integer DocumentVersion();
-
-
 
 
 protected:
index 6f4710aee95b6e66b2ad67d056d003ab74e21a14..7fde8593dc9133262cb00d308fb7a5d275008ae8 100644 (file)
@@ -23,7 +23,6 @@
 #include <TNaming_Name.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Naming.hxx>
-#include <XmlMNaming.hxx>
 #include <XmlMNaming_NamingDriver.hxx>
 #include <XmlObjMgt.hxx>
 #include <XmlObjMgt_Persistent.hxx>
@@ -175,7 +174,7 @@ Standard_Boolean XmlMNaming_NamingDriver::Paste
   }
   aNgName.Index(aNb);
 //
-  if(XmlMNaming::DocumentVersion() > 3) {
+  if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 3) {
     XmlObjMgt_DOMString aDomEntry = anElem.getAttribute(::ContextLabelString());
     if (aDomEntry != NULL)
     {  
@@ -204,7 +203,8 @@ Standard_Boolean XmlMNaming_NamingDriver::Paste
       cout << "Retrieving Context Label is NULL" <<endl;
 #endif
 
-    if(XmlMNaming::DocumentVersion() > 4 && XmlMNaming::DocumentVersion() < 7) {
+    if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 4 && 
+      theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 7) {
           // Orientation processing - converting from old format
           Handle(TNaming_NamedShape) aNS;
           if (aNg->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
@@ -223,7 +223,7 @@ Standard_Boolean XmlMNaming_NamingDriver::Paste
             }
           }         
         }
-    if(XmlMNaming::DocumentVersion() > 6) {
+    if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 6) {
        aDOMStr = anElem.getAttribute(::OrientString());
        if (!aDOMStr.GetInteger(aNb))
        {
@@ -238,10 +238,8 @@ Standard_Boolean XmlMNaming_NamingDriver::Paste
     // or. end
   }
 #ifdef OCCT_DEBUG
-  else if(XmlMNaming::DocumentVersion() == -1)
-    cout << "Current DocVersion field is not initialized. "  <<endl;
   else 
-    cout << "Current DocVersion = "  << XmlMNaming::DocumentVersion() <<endl;
+    cout << "Current Document Format Version = "  << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
 #endif
   return Standard_True;
 }
index 6f92de126e67aef5bb93fe1e270bd7cb0d5ee4d8..4ab9967fb855de3e36253ff126fd8e8c062f12f7 100644 (file)
@@ -148,7 +148,7 @@ Standard_Boolean XmlMXCAFDoc_LocationDriver::Translate
   if (aLocElem == NULL)
     return Standard_False;
   
-  Standard_Integer aFileVer = XmlMNaming::DocumentVersion();
+  Standard_Integer aFileVer = theMap.GetHeaderData()->StorageVersion().IntegerValue();
   if( aFileVer > 5 && myLocations == 0 )
   {
     return Standard_False;
index 875c6c8639349d16f956f5459e497315174e6c58..5c942adf8a7041eaa8499ab81e4e0629d3235cf3 100755 (executable)
@@ -11,5 +11,7 @@ XmlObjMgt_GP.hxx
 XmlObjMgt_Persistent.cxx
 XmlObjMgt_Persistent.hxx
 XmlObjMgt_Persistent.lxx
+XmlObjMgt_RRelocationTable.cxx
 XmlObjMgt_RRelocationTable.hxx
+XmlObjMgt_SRelocationTable.cxx
 XmlObjMgt_SRelocationTable.hxx
diff --git a/src/XmlObjMgt/XmlObjMgt_RRelocationTable.cxx b/src/XmlObjMgt/XmlObjMgt_RRelocationTable.cxx
new file mode 100644 (file)
index 0000000..0b53b50
--- /dev/null
@@ -0,0 +1,49 @@
+// Created on: 2018-10-02
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2018 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XmlObjMgt_RRelocationTable.hxx>
+
+//=======================================================================
+//function : GetHeaderData
+//purpose  : getter for the file header data
+//=======================================================================
+
+const Handle(Storage_HeaderData)& XmlObjMgt_RRelocationTable::GetHeaderData() const
+{
+  return myHeaderData;
+}
+
+//=======================================================================
+//function : SetHeaderData
+//purpose  : setter for the file header data
+//=======================================================================
+
+void XmlObjMgt_RRelocationTable::SetHeaderData(
+  const Handle(Storage_HeaderData)& theHeaderData)
+{
+  myHeaderData = theHeaderData;
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : The relocation table is cleared before/after reading in a document.
+//         : In this case the reference to the file header data should also be
+//         : cleared, because it is specific to the document.
+//=======================================================================
+void XmlObjMgt_RRelocationTable::Clear(const Standard_Boolean doReleaseMemory)
+{
+  myHeaderData.Nullify();
+  TColStd_DataMapOfIntegerTransient::Clear(doReleaseMemory);
+}
\ No newline at end of file
index 3d7012f82c6554c70bf95db421523ed9dc285918..d7fe75fcb931e3b7f27d6217b2fb20ebcd6f773b 100644 (file)
 
 #include <TColStd_DataMapOfIntegerTransient.hxx>
 
-typedef TColStd_DataMapOfIntegerTransient XmlObjMgt_RRelocationTable;
+#include <Storage_HeaderData.hxx>
 
+//! Retrieval relocation table is modeled as a child class of
+//! TColStd_DataMapOfIntegerTransient that stores a handle to the file
+//! header section. With that attribute drivers have access to the file header
+//! section.
+class XmlObjMgt_RRelocationTable : public TColStd_DataMapOfIntegerTransient
+{
+public:
+
+  //! Returns a handle to the header data of the file that is begin read
+  Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const;
+
+  //! Sets the storage header data.
+  //!
+  //! @param theHeaderData header data of the file that is begin read
+  Standard_EXPORT void SetHeaderData(
+      const Handle(Storage_HeaderData)& theHeaderData);
+
+  Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True);
+
+
+
+protected:
+
+
+
+private:
+
+  Handle(Storage_HeaderData) myHeaderData;
+};
 
 #endif // _XmlObjMgt_RRelocationTable_HeaderFile
diff --git a/src/XmlObjMgt/XmlObjMgt_SRelocationTable.cxx b/src/XmlObjMgt/XmlObjMgt_SRelocationTable.cxx
new file mode 100644 (file)
index 0000000..0576dec
--- /dev/null
@@ -0,0 +1,49 @@
+// Created on: 2018-10-04
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2018 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XmlObjMgt_SRelocationTable.hxx>
+
+//=======================================================================
+//function : GetHeaderData
+//purpose  : getter for the file header data
+//=======================================================================
+
+const Handle(Storage_HeaderData)& XmlObjMgt_SRelocationTable::GetHeaderData() const
+{
+  return myHeaderData;
+}
+
+//=======================================================================
+//function : SetHeaderData
+//purpose  : setter for the file header data
+//=======================================================================
+
+void XmlObjMgt_SRelocationTable::SetHeaderData(
+  const Handle(Storage_HeaderData)& theHeaderData)
+{
+  myHeaderData = theHeaderData;
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : The relocation table is cleared before/after reading in a document.
+//         : In this case the reference to the file header data should also be
+//         : cleared, because it is specific to the document.
+//=======================================================================
+void XmlObjMgt_SRelocationTable::Clear(const Standard_Boolean doReleaseMemory)
+{
+  myHeaderData.Nullify();
+  TColStd_IndexedMapOfTransient::Clear(doReleaseMemory);
+}
\ No newline at end of file
index 0acc1ca134e46ab6a10e6961f9b5fed44b02e55c..378de4e20246ffb28276736856e81a967b903120 100644 (file)
 
 #ifndef _XmlObjMgt_SRelocationTable_HeaderFile
 #define _XmlObjMgt_SRelocationTable_HeaderFile
-
+#include <Standard_Handle.hxx>
 #include <TColStd_IndexedMapOfTransient.hxx>
+#include <Storage_HeaderData.hxx>
+
+//! Stored relocation table is modeled as a child class of
+//! TColStd_DataMapOfIntegerTransient that stores a handle to the file
+//! header section. With that attribute drivers have access to the file header
+//! section.
+class XmlObjMgt_SRelocationTable : public TColStd_IndexedMapOfTransient
+{
+public:
+
+  //! Returns a handle to the header data of the file that is begin read
+  Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const;
+
+  //! Sets the storage header data.
+  //!
+  //! @param theHeaderData header data of the file that is begin read
+  Standard_EXPORT void SetHeaderData(
+      const Handle(Storage_HeaderData)& theHeaderData);
+
+  Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True);
+
+
+protected:
+
+
 
-typedef TColStd_IndexedMapOfTransient XmlObjMgt_SRelocationTable;
+private:
 
+  Handle(Storage_HeaderData) myHeaderData;
+};
 
 #endif // _XmlObjMgt_SRelocationTable_HeaderFile
index d054d4f4f0d5b85c3efa9a52b13a994684df6293..979a0796cf80ca1f92df623bd0261d90ac395eef 100644 (file)
@@ -15,13 +15,13 @@ AISSet D 0:1 NS
 
 SaveAs D ${FileV9}
 
-SetStorageVersion 7
+SetStorageVersion 7
 SaveAs D ${FileV7}
 
 Close D
 
 puts "Testing for XML file format in new version document"
-SetStorageVersion 9
+
 Open ${FileV9} D9
 
 set info [Attributes D9 0:1]