Structure operations
Contents: Description, Procedure
Description Structures in davinci are polymorphus containers that can have any number of elements of any data type including other structures. A good way to think about a structure is to imagine it as an empty box that swells to whatever size needed to hold the things you put in it. The box itself has no real properties other than that is contains things within it. You can put any davinci object into a structure; strings, numeric arrays, numbers, or even other structures all may be put in a structure for organizational purposes and are called 'elements' of that structure. To accomplish work with data in a structure you must do something to the element corresponding to the data you want. Following the analogy, if you wanted to paste some pictures into a scrapbook that is in a cedar-chest you must reach into the cedar-chest to get at the scrapbook, you can't simply paste the pictures onto the outside of the cedar-chest. The cedar-chest has nothing directly to do with the pictures, it simply is a convenient storage device for the damn scrapbook. Below are some procedures (both common and uncommon) and uses of structures.
Procedure Create an empty structure, two exquivalent examples: dv> struc = {} struct, 0 elements dv> struc = struct() struct, 0 elements Adding an element to the structure when you know it's name and data type: dv> my_array 10x10x10 array of float, bsq format [4,000 bytes] dv> struc.data = my_array 10x10x10 array of float, bsq format [4,000 bytes] dv> struc struct, 1 elements data: 10x10x10 array of float, bsq format [4,000 bytes] dv> my_text = "this is text describing my structure" "this is text describing my structure" dv> struc.label = my_text "this is text describing my structure" dv> struc struct, 2 elements data: 10x10x10 array of float, bsq format [4,000 bytes] label: "this is text describing my structure"
|
DavinciWiki Mini-Nav Bar Contents
Contact Developers
All other topics
|