Man page - vistaioattribute(3)
Packages contains this manual
Manual
VistaIOattribute
NAMESYNOPSIS
DESCRIPTION
Introduction
Creating, Copying, and Destroying Attribute Lists
Traversing an Attribute List
Accessing Attributes by Position
Accessing Attributes by Name
Inserting and Deleting Attributes
Encoding and Decoding Attribute VistaIOalues
Inputting and Outputting Attribute Lists
Storage Management
Data Structures
EXAMPLES
SEE ALSO
AUTHOR
NAME
VistaIOattribute - representation of a list of name/value pairs
SYNOPSIS
VistaIOAttrList list ;
VistaIOAttrListPosn posn ;
DESCRIPTION
Introduction
An attribute associates a value with a name. Generally, various properties of an object such as an image are described by attributes, each naming one property and specifying that propertyâs associated value. Attributes are collected into lists, and Vista library routines are available for accessing and manipulating these lists. A list is referred to by a pointer of type VistaIOAttrList .
The attribute list representation is closely related to the Vista data file format. Among other things, attribute lists can represent in memory the contents of Vista data files.
An attributeâs name is an alphanumeric string â specifically, a sequence of characters matching the regular expression [a-zA-Z0-9_.+-]+. (Regular expressions are described in grep (1).) Attribute names are represented in memory as null-terminated character strings. They may be 50 character in length.
An attributeâs value may be a character string, a (nested) attribute list, or a pointer to data of a specified type.
|
⢠|
If itâs a character string, the string may optionally be interpreted as an number whenever it is accessed. Library routines exist, for example, that can return a stringâs value as a VistaIOShort , or set it with a VistaIOFloat value. The following representations can be used when accessing character-string attribute values: VistaIOBit , VistaIOUByte , VistaIOSByte , VistaIOShort , VistaIOLong , VistaIOFloat , VistaIODouble , VistaIOBoolean , or VistaIOString . An error will be signalled if an attempt is made to obtain an attributeâs value in a representation to which it cannot be converted. |
A character-string attribute value can also be interpreted as a keyword. Again, conversion between keywords and any desired representation occurs when the attribute value is accessed. The routines you use to access attribute values allow you to specify an optional dictionary that describes a mapping between keywords and values. The form of this dictionary is described by the VistaIOdictionary (3) manual page. Using a dictionary, for example, you can fetch an attributeâs value as a VistaIOBoolean while converting the keywords false and true to the values 0 and 1.
|
⢠|
An attributeâs value may be another attribute list. However, circular references, as when an attribute list is the value of one of its attributes, are not allowed. |
||
|
⢠|
An attributeâs value may be an object with any of the standard object types (e.g., an image or edge set); or it may be an object of a type that has been registered by the programmer using the mechanism described in VistaIOtype (3). Because they are registered, such types are automatically read from data files and written to data files by library routines such as VistaIOReadFile (3) and VistaIOWriteFile (3). |
||
|
⢠|
An attributeâs value may be of type VistaIOBundle , described in VistaIOBundle (3). A VistaIOBundle can represent an object whose type has not been registered with the VistaIOtype (3) mechanism, in a way that allows the object to be copied unchanged from an input data file to an output data file. Itâs used to represent objects of unknown type encountered in input data files. |
||
|
⢠|
An attributeâs value may be a pointer to an opaque data structure. Such a pointer is of type VistaIOPointer . Library routines only allow for getting and setting a VistaIOPointer attribute value; they cannot read VistaIOPointer values from data files, or write them to data files. |
The elements of an attribute list may be accessed by attribute name, in which case each element should have a unique name and the order of attributes within the list is not significant. In this form of access the attribute list is treated as a set. Alternatively, the elements of an attribute list may be accessed by their position within the list, in which case attribute names neednât be unique and the ordering of list elements is significant. In this form of access the attribute list is treated as a sequence. The library provides support for both forms of access.
A position within an attribute list is identified by a structure of type VistaIOAttrListPosn . Its value can denote a particular attribute within a list, or no attribute (analogous to NULL
Creating, Copying, and Destroying Attribute Lists
The following routines will create, copy, and destroy attribute lists.
VistaIOAttrList VistaIOCreateAttrList (void)
VistaIOCreateAttrList creates and returns an empty attribute list.
VistaIOAttrList VistaIOCopyAttrList (VistaIOAttrList list )
VistaIOCopyAttrList generates a complete copy of list using newly-allocated storage for each list element. The new list contains its own copy of each attribute value â except that for a VistaIOPointer value, the pointer is copied but not the (opaque) data structure to which it points.
void VistaIODestroyAttrList (VistaIOAttrList list )
VistaIODestroyAttrList releases the storage occupied by list . Also released is storage occupied by attribute values â except that for a VistaIOPointer value, the pointer is released but not the (opaque) data structure to which it points.
Traversing an Attribute List
The following macros are used to sequence through an attribute list in either direction. They are appropriate when accessing an attribute list representing a sequence (as opposed to a set) of attributes.
void VistaIOFirstAttr (VistaIOAttrList list , VistaIOAttrListPosn * posn )
VistaIOFirstAttr sets posn to point to the first attribute in list . If the list is empty, posn is set to point to nothing (a condition that can be tested using the VistaIOAttrExists macro).
void VistaIOLastAttr (VistaIOAttrList list , VistaIOAttrListPosn * posn )
VistaIOLastAttr sets posn to point to the last attribute in list . If the list is empty, posn is set to point to nothing (a condition that can be tested using the VistaIOAttrExists macro).
void VistaIONextAttr (VistaIOAttrListPosn * posn )
VistaIONextAttr sets posn to point to the next attribute in its list. If posn already points to the listâs last attribute, posn is set to point to nothing (a condition that can be detected by the VistaIOAttrExists macro).
void VistaIOPrevAttr (VistaIOAttrList list , VistaIOAttrListPosn * posn )
VistaIOPrevAttr sets posn to point to the previous attribute in its list. If posn already points to the listâs first attribute, posn is set to point to nothing (a condition that can be detected by the VistaIOAttrExists macro).
VistaIOBoolean VistaIOAttrExists (VistaIOAttrListPosn * posn )
VistaIOAttrExists returns TRUE if posn points to an attribute, and FALSE if it points to nothing. This macro is used, for example, to test for the end of an attribute list while sequencing through it.
VistaIOBoolean VistaIOAttrListEmpty (VistaIOAttrList * list )
VistaIOAttrListEmpty returns TRUE if list is empty.
Accessing Attributes by Position
The following macros and routines access the attribute at a specified position within an attribute list.
VistaIOStringConst VistaIOGetAttrName (VistaIOAttrListPosn * posn )
The VistaIOGetAttrName macro returns the name of the attribute at posn .
VistaIORepnKind VistaIOGetAttrRepn (VistaIOAttrListPosn * posn )
The VistaIOGetAttrRepn macro returns the type of representation of the attribute value at posn .
|
VistaIOBoolean VistaIOGetAttrValue (VistaIOAttrListPosn * posn , |
VistaIODictEntry * dict , VistaIORepnKind repn , VistaIOPointer value )