4ff92abe |
1 | puts "================" |
2 | puts "OCC26229" |
3 | puts "================" |
4 | puts "" |
5 | ################################################################################################### |
6 | # Add the possibility in OCAF to open/save a document from/to a stream object (BinOcaf format) |
7 | ################################################################################################### |
8 | |
9 | pload DCAF |
10 | |
11 | NewDocument D BinOcaf |
12 | |
13 | # Add an attribute to a data framework |
14 | set aSetAttr1 100 |
15 | set aLabel 0:2 |
16 | SetInteger D ${aLabel} ${aSetAttr1} |
17 | |
18 | # Close/Open the transaction |
19 | NewCommand D |
20 | |
21 | # Save the document |
22 | set aFile ${imagedir}/${casename}.cbf |
23 | file delete ${aFile} |
24 | SaveAs D ${aFile} -stream |
25 | if { ![file exists ${aFile}] } { |
26 | puts "Error: there is not ${aFile} file; SaveAs command" |
27 | return |
28 | } |
29 | |
30 | |
31 | # Restore the document |
32 | Close D |
33 | Open ${aFile} DD -stream |
34 | |
35 | # Get a value of the attribute |
36 | set IsDone [catch {set aGetAttr3 [GetInteger DD ${aLabel}]} aResult] |
37 | if { ${IsDone} != 0 || |
38 | ${aSetAttr1}!=${aGetAttr3} } { |
39 | puts ${aResult} |
40 | puts "aSetAttr1=${aSetAttr1} aGetAttr3=${aGetAttr3}" |
41 | puts "Error: get a value of TDataStd_Integer attribute from Streamed restoring document" |
42 | } else { |
43 | puts "Get a value of TDataStd_Integer attribute from Streamed restoring document: OK" |
44 | } |