| 1 | // Created on: 2001-07-09 |
| 2 | // Created by: Julia DOROVSKIKH |
| 3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 7 | // This library is free software; you can redistribute it and/or modify it under |
| 8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 9 | // by the Free Software Foundation, with special exception defined in the file |
| 10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 11 | // distribution for complete text of the license and disclaimer of any warranty. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | #ifndef _XmlMDF_HeaderFile |
| 17 | #define _XmlMDF_HeaderFile |
| 18 | |
| 19 | #include <Standard.hxx> |
| 20 | #include <Standard_DefineAlloc.hxx> |
| 21 | #include <Standard_Handle.hxx> |
| 22 | |
| 23 | #include <XmlObjMgt_Element.hxx> |
| 24 | #include <XmlObjMgt_SRelocationTable.hxx> |
| 25 | #include <Standard_Integer.hxx> |
| 26 | #include <Standard_Boolean.hxx> |
| 27 | #include <XmlObjMgt_RRelocationTable.hxx> |
| 28 | #include <XmlMDF_MapOfDriver.hxx> |
| 29 | |
| 30 | #include <Message_ProgressIndicator.hxx> |
| 31 | |
| 32 | class TDF_Data; |
| 33 | class XmlMDF_ADriverTable; |
| 34 | class TDF_Label; |
| 35 | class Message_Messenger; |
| 36 | class XmlMDF_ADriver; |
| 37 | class XmlMDF_TagSourceDriver; |
| 38 | class XmlMDF_ReferenceDriver; |
| 39 | class XmlMDF_ADriverTable; |
| 40 | |
| 41 | |
| 42 | //! This package provides classes and methods to |
| 43 | //! translate a transient DF into a persistent one and |
| 44 | //! vice versa. |
| 45 | //! |
| 46 | //! Driver |
| 47 | //! |
| 48 | //! A driver is a tool used to translate a transient |
| 49 | //! attribute into a persistent one and vice versa. |
| 50 | //! |
| 51 | //! Driver Table |
| 52 | //! |
| 53 | //! A driver table is an object building links between |
| 54 | //! object types and object drivers. In the |
| 55 | //! translation process, a driver table is asked to |
| 56 | //! give a translation driver for each current object |
| 57 | //! to be translated. |
| 58 | class XmlMDF |
| 59 | { |
| 60 | public: |
| 61 | |
| 62 | DEFINE_STANDARD_ALLOC |
| 63 | |
| 64 | //! Translates a transient <aSource> into a persistent |
| 65 | //! <aTarget>. |
| 66 | Standard_EXPORT static void FromTo (const Handle(TDF_Data)& aSource, |
| 67 | XmlObjMgt_Element& aTarget, |
| 68 | XmlObjMgt_SRelocationTable& aReloc, |
| 69 | const Handle(XmlMDF_ADriverTable)& aDrivers, |
| 70 | const Handle(Message_ProgressIndicator)& theProgress = NULL); |
| 71 | |
| 72 | //! Translates a persistent <aSource> into a transient |
| 73 | //! <aTarget>. |
| 74 | //! Returns True if completed successfully (False on error) |
| 75 | Standard_EXPORT static Standard_Boolean FromTo |
| 76 | (const XmlObjMgt_Element& aSource, |
| 77 | Handle(TDF_Data)& aTarget, XmlObjMgt_RRelocationTable& aReloc, |
| 78 | const Handle(XmlMDF_ADriverTable)& aDrivers, |
| 79 | const Handle(Message_ProgressIndicator)& theProgress = NULL); |
| 80 | |
| 81 | //! Adds the attribute storage drivers to <aDriverSeq>. |
| 82 | Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, |
| 83 | const Handle(Message_Messenger)& theMessageDriver); |
| 84 | |
| 85 | private: |
| 86 | |
| 87 | Standard_EXPORT static Standard_Integer WriteSubTree |
| 88 | (const TDF_Label& theLabel, |
| 89 | XmlObjMgt_Element& theElement, |
| 90 | XmlObjMgt_SRelocationTable& aReloc, |
| 91 | const Handle(XmlMDF_ADriverTable)& aDrivers, |
| 92 | const Handle(Message_ProgressIndicator)& theProgress = NULL); |
| 93 | |
| 94 | Standard_EXPORT static Standard_Integer ReadSubTree |
| 95 | (const XmlObjMgt_Element& theElement, |
| 96 | const TDF_Label& theLabel, |
| 97 | XmlObjMgt_RRelocationTable& aReloc, |
| 98 | const XmlMDF_MapOfDriver& aDrivers, |
| 99 | const Handle(Message_ProgressIndicator)& theProgress = NULL); |
| 100 | |
| 101 | Standard_EXPORT static void CreateDrvMap (const Handle(XmlMDF_ADriverTable)& aDriverTable, |
| 102 | XmlMDF_MapOfDriver& anAsciiDriverMap); |
| 103 | |
| 104 | friend class XmlMDF_ADriver; |
| 105 | friend class XmlMDF_TagSourceDriver; |
| 106 | friend class XmlMDF_ReferenceDriver; |
| 107 | friend class XmlMDF_ADriverTable; |
| 108 | |
| 109 | }; |
| 110 | |
| 111 | #endif // _XmlMDF_HeaderFile |