ff205346 |
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 _StdLPersistent_Dependency_HeaderFile |
16 | #define _StdLPersistent_Dependency_HeaderFile |
17 | |
18 | #include <StdObjMgt_Attribute.hxx> |
19 | #include <StdLPersistent_HString.hxx> |
20 | #include <StdLPersistent_HArray1.hxx> |
21 | |
22 | #include <TDataStd_Expression.hxx> |
23 | #include <TDataStd_Relation.hxx> |
24 | |
25 | |
26 | class StdLPersistent_Dependency |
27 | { |
28 | template <class AttribClass> |
29 | class instance : public StdObjMgt_Attribute<AttribClass> |
30 | { |
31 | public: |
32 | //! Read persistent data from a file. |
33 | inline void Read (StdObjMgt_ReadData& theReadData) |
34 | { theReadData >> myName >> myVariables; } |
ec964372 |
35 | //! Write persistent data to a file. |
36 | inline void Write (StdObjMgt_WriteData& theWriteData) const |
37 | { theWriteData << myName << myVariables; } |
38 | //! Gets persistent child objects |
39 | inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const |
40 | { |
41 | theChildren.Append(myName); |
42 | theChildren.Append(myVariables); |
43 | } |
44 | //! Returns persistent type name |
45 | Standard_CString PName() const; |
ff205346 |
46 | |
47 | //! Import transient attribuite from the persistent data. |
48 | void Import (const Handle(AttribClass)& theAttribute) const; |
49 | |
50 | private: |
45d8465e |
51 | Handle(StdLPersistent_HString::Extended) myName; |
52 | Handle(StdLPersistent_HArray1::Persistent) myVariables; |
ff205346 |
53 | }; |
54 | |
55 | public: |
56 | typedef instance<TDataStd_Expression> Expression; |
57 | typedef instance<TDataStd_Relation> Relation; |
58 | }; |
59 | |
ec964372 |
60 | template<> |
61 | inline Standard_CString StdLPersistent_Dependency::instance<TDataStd_Expression>::PName() const |
62 | { return "PDataStd_Expression"; } |
63 | |
64 | template<> |
65 | inline Standard_CString StdLPersistent_Dependency::instance<TDataStd_Relation>::PName() const |
66 | { return "PDataStd_Relation"; } |
67 | |
ff205346 |
68 | #endif |