7ed7467d |
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 | |
ff205346 |
14 | #include <StdLPersistent_TreeNode.hxx> |
7ed7467d |
15 | |
7ed7467d |
16 | |
17 | //======================================================================= |
18 | //function : Read |
19 | //purpose : Read persistent data from a file |
20 | //======================================================================= |
ff205346 |
21 | void StdLPersistent_TreeNode::Read (StdObjMgt_ReadData& theReadData) |
22 | { |
23 | myDynamicData = new dynamic; |
24 | theReadData >> myDynamicData->First >> myNext >> myDynamicData->TreeID; |
25 | } |
26 | |
27 | //======================================================================= |
28 | //function : CreateAttribute |
29 | //purpose : Create an empty transient attribuite |
30 | //======================================================================= |
31 | Handle(TDF_Attribute) StdLPersistent_TreeNode::CreateAttribute() |
7ed7467d |
32 | { |
ff205346 |
33 | Static::CreateAttribute(); |
34 | myTransient->SetTreeID (myDynamicData->TreeID); |
35 | return myTransient; |
7ed7467d |
36 | } |
37 | |
38 | //======================================================================= |
39 | //function : ImportAttribute |
40 | //purpose : Import transient attribuite from the persistent data |
41 | //======================================================================= |
ff205346 |
42 | void StdLPersistent_TreeNode::ImportAttribute() |
7ed7467d |
43 | { |
ff205346 |
44 | if (myDynamicData) |
45 | { |
46 | Handle(StdLPersistent_TreeNode) aChild = myDynamicData->First; |
47 | while (aChild) |
48 | { |
49 | if (aChild->myTransient) |
50 | myTransient->Append(aChild->myTransient); |
51 | StdLPersistent_TreeNode* aCurr = aChild.get(); |
52 | aChild = aChild->myNext; |
53 | aCurr->myNext.Nullify(); // this reference is no longer needed |
54 | } |
7ed7467d |
55 | |
ff205346 |
56 | myDynamicData.Nullify(); |
57 | } |
7ed7467d |
58 | } |