1 // Copyright (c) 2015 OPEN CASCADE SAS 2 // 3 // This file is part of Open CASCADE Technology software library. 4 // 5 // This library is free software; you can redistribute it and/or modify it under 6 // the terms of the GNU Lesser General Public License version 2.1 as published 7 // by the Free Software Foundation, with special exception defined in the file 8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 9 // distribution for complete text of the license and disclaimer of any warranty. 10 // 11 // Alternatively, this file may be used under the terms of Open CASCADE 12 // commercial license or contractual agreement. 13 14 15 #ifndef _StdPersistent_TopLoc_HeaderFile 16 #define _StdPersistent_TopLoc_HeaderFile 17 18 #include <StdObjMgt_SharedObject.hxx> 19 #include <StdObjMgt_Persistent.hxx> 20 #include <StdObject_Location.hxx> 21 #include <StdObjMgt_TransientPersistentMap.hxx> 22 23 #include <TopLoc_Datum3D.hxx> 24 #include <TopLoc_Location.hxx> 25 26 27 class StdPersistent_TopLoc 28 { 29 public: 30 class Datum3D : public StdObjMgt_SharedObject::SharedBase<TopLoc_Datum3D> 31 { 32 public: 33 //! Read persistent data from a file. 34 void Read (StdObjMgt_ReadData& theReadData); 35 //! Write persistent data to a file. 36 void Write (StdObjMgt_WriteData& theWriteData) const; 37 //! Gets persistent child objects PChildren(SequenceOfPersistent &) const38 virtual void PChildren(SequenceOfPersistent&) const { } 39 //! Returns persistent type name PName() const40 virtual Standard_CString PName () const 41 { return "PTopLoc_Datum3D"; } 42 }; 43 44 class ItemLocation : public StdObjMgt_Persistent 45 { 46 friend class StdPersistent_TopLoc; 47 48 public: 49 //! Read persistent data from a file. 50 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData); 51 //! Write persistent data to a file. 52 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const; 53 //! Gets persistent child objects 54 Standard_EXPORT virtual void PChildren(SequenceOfPersistent& theChildren) const; 55 //! Returns persistent type name PName() const56 virtual Standard_CString PName () const 57 { return "PTopLoc_ItemLocation"; } 58 59 //! Import transient object from the persistent data. 60 Standard_EXPORT TopLoc_Location Import() const; 61 62 private: 63 Handle(Datum3D) myDatum; 64 Standard_Integer myPower; 65 StdObject_Location myNext; 66 }; 67 68 public: 69 Standard_EXPORT static Handle(ItemLocation) Translate (const TopLoc_Location& theLoc, 70 StdObjMgt_TransientPersistentMap& theMap); 71 Standard_EXPORT static Handle(Datum3D) Translate (const Handle(TopLoc_Datum3D)& theDatum, 72 StdObjMgt_TransientPersistentMap& theMap); 73 }; 74 75 #endif 76