2 # Tree construction attributes
4 # Testing attribute: TDataStd_TreeNode
6 # Testing command: ChildNodeIterate
8 # Testing command: NewChild
9 # Testing command: AppendNode
15 # Add an attribute to a data framework
17 set aName_Root Label_1
18 Label D ${aLabel_Root}
19 SetName D ${aLabel_Root} ${aName_Root}
22 ###set aChild1 [NewChild D ${aLabel_Root}]
25 SetName D ${aChild1} ${aName1}
28 ###set aChild2 [NewChild D ${aLabel_Root}]
31 SetName D ${aChild2} ${aName2}
33 set aName3 Label_1_1_1
34 ###set aChild3 [NewChild D ${aLabel_Root}]
37 SetName D ${aChild3} ${aName3}
39 set aName4 Label_1_1_2
40 ###set aChild4 [NewChild D ${aLabel_Root}]
43 SetName D ${aChild4} ${aName4}
45 set aName5 Label_1_1_3
46 ###set aChild5 [NewChild D ${aLabel_Root}]
49 SetName D ${aChild5} ${aName5}
51 set aName6 Label_1_2_1
52 ###set aChild6 [NewChild D ${aLabel_Root}]
55 SetName D ${aChild6} ${aName6}
57 set aName7 Label_1_2_2
58 ###set aChild7 [NewChild D ${aLabel_Root}]
61 SetName D ${aChild7} ${aName7}
63 SetNode D ${aLabel_Root}
64 AppendNode D ${aLabel_Root} ${aChild1}
65 AppendNode D ${aLabel_Root} ${aChild2}
66 AppendNode D ${aChild1} ${aChild3}
67 AppendNode D ${aChild1} ${aChild4}
68 AppendNode D ${aChild1} ${aChild5}
69 AppendNode D ${aChild2} ${aChild6}
70 AppendNode D ${aChild2} ${aChild7}
72 # Close/Open the transaction
75 # Forget the attribute
76 ForgetAll D ${aLabel_Root}
78 # Close/Open the transaction
86 # Get a value of the attribute
87 set IsDone [catch {set aListChildNodes [ChildNodeIterate D ${aLabel_Root} 1]} aResult]
88 if { ${IsDone} != 0 } {
90 puts "ChildNodeIterate Doc TreeNode AllLevels=1 : Error"
93 set aListChildNodesLength [llength ${aListChildNodes}]
94 if { ${aListChildNodesLength}!=[expr 7 + 0]} {
95 puts "aListChildNodes=${aListChildNodes}"
96 puts "aListChildNodesLength=${aListChildNodesLength}"
97 puts "ChildNodeIterate Doc TreeNode AllLevels=1 : Error"
100 set aFirstChildNode [lindex ${aListChildNodes} 0]
101 set aSecondChildNode [lindex ${aListChildNodes} 1]
102 set aThirdChildNode [lindex ${aListChildNodes} 2]
103 set aForthChildNode [lindex ${aListChildNodes} 3]
104 set aFifthChildNode [lindex ${aListChildNodes} 4]
105 set aSixthChildNode [lindex ${aListChildNodes} 5]
106 set aSeventhChildNode [lindex ${aListChildNodes} 6]
107 if { ${aFirstChildNode}!=${aChild1} ||
108 ${aSecondChildNode}!=${aChild3} ||
109 ${aThirdChildNode}!=${aChild4} ||
110 ${aForthChildNode}!=${aChild5} ||
111 ${aFifthChildNode}!=${aChild2} ||
112 ${aSixthChildNode}!=${aChild6} ||
113 ${aSeventhChildNode}!=${aChild7}} {
114 puts "aFirstChildNode=${aFirstChildNode} aChild1=${aChild1}"
115 puts "aSecondChildNode=${aSecondChildNode} aChild3=${aChild3}"
116 puts "aThirdChildNode=${aThirdChildNode} aChild4=${aChild4}"
117 puts "aForthChildNode=${aForthChildNode} aChild5=${aChild5}"
118 puts "aFifthChildNode=${aFifthChildNode} aChild2=${aChild2}"
119 puts "aSixthChildNode=${aSixthChildNode} aChild6=${aChild6}"
120 puts "aSeventhChildNode=${aSeventhChildNode} aChild=${aChild}"
121 puts "ChildNodeIterate Doc TreeNode AllLevels=1 : Error"
125 puts "ChildNodeIterate Doc TreeNode AllLevels=1 : OK"