![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function All_Named_Components
function All_Named_Components (Type_Definition : in Asis.Type_Definition) return Asis.Entity_Name_Definition_List;Expanded Name Asis.Data_Decomposition.All_Named_Components
Returns a list of all nonimplementation-defined discriminant and component entity name definitions from the specified record type definition.
Description
The string of the name can be obtained with the Expressions-.Name function.
The returned list does not include implementation-defined components (Ada83 LRM 13.4(8), Ada95 LRM 13.5.1). You can obtain those components with the Record_Components function.
Refer to the Appendix F for your compilation system to determine whether your compiler generates implementation-defined components.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition to be queried. The type definition must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Type_Definition A_Derived_Type_Definition1
A_Record_Type_Definition
1 Of a record type definition.
All type-definition model kinds are appropriate.
return Asis.Entity_Name_Definition_List;The returned list contains elements of the following kinds:
Element_Kinds Expression_Kinds
An_Entity_Name_Definition A_Simple_Name
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
- "Obtaining Components and Nested Components"
- Ada83 LRM 13.4, Ada95 LRM
13.5.1
Type Array_Component
type Array_Component is private;Expanded Name Asis.Data_Decomposition.Array_Component
Describes the components of an array-valued field for a record type.
Description
An array type describes composite values that contain 0 or more indexed elements. In ASIS, such types are represented by an element with an Element_Kinds of An_Array_Type_Definition or A_Derived_Type_Definition whose parent type is an array type. For purposes of data decomposition, the Array_Component type (referred to as an array component) describes an array type.
Array-Component Properties
The equality operator (=) is not meaningful between array component values, and should not be used unless one component is equal to Nil_Array_Component. Uninitialized array component variables are equal to Nil_Array_Component. Use the Is_Equal and Is_Identical functions to compare component values.
Array components become invalid, and result in an exception being raised if they are used, when the library containing the type definition they were derived from is closed.
Obtaining an Array's Components
If the array component is a composite, the array component and its associated stream can be further decomposed. If the component is not composite, you can use the methods described below to obtain an element or runtime data about an element.
Two methods are available to decompose composite array components and obtain the constituent record components or array component:
- The type definition of the component, if known, can be used to obtain the constituent components.
- The record component itself can be used to obtain the constituent components.
Both methods return the same value.
Unlike record decomposition, which can return an entire array of constituent components, array-component decomposition returns only a single value.
Using Array Components to Obtain Data
An array component describes an entire array. Given an array component, you can:
- Obtain the subtype indication
- Obtain the 'Size attribute value
- Obtain the total number of elements in the array or the number of elements in any particular dimension
Unlike record components, you cannot decompose an array component to the point where the component represents an individual element in the array. To access an individual element or obtain runtime representation data for an element, you must either:
- Construct an iterator for the array component
- Use the array component in conjunction with a linear index value
- Use the array component in conjunction with a dimensional index value
By specifying an iterator or the array component with either kind of index value, you can:
- Extract the data stream that represents an element
- Obtain attribute data about an element
See "Accessing Array Elements" for more details.
Cross-References
- type Array_Component_List
- function Array_Components
- function Array_Iterator
- function Array_Length
- function Component_Data_Stream
- function Component_Indication
- function Is_Equal
- function Is_Identical
- function Is_Nil
- constant Nil_Array_Component
- function Record_Components
Type Array_Component_Iterator
type Array_Component_Iterator is private;Expanded Name Asis.Data_Decomposition.Array_Component_Iterator
Defines a type that allows iteration over successive components of an array.
Description
Iterators can be copied. The copies contain separate data and operate independently.
Iterators are one way of accessing the individual components of arrays. You can also use dimensional index values or linear index values.
Cross-References
Related subprograms and types:
Type Array_Component_List
type Array_Component_List is array (Asis.List_Index range <>) of Array_Component;Expanded Name Asis.Data_Decomposition.Array_Component_List
Defines a list of array components.
Description
An array component list is nil if the value of its 'Length attribute
is 0.The type is not used by the ASIS interfaces and is provided only for completeness.
Cross-References
Function Array_Components
function Array_Components (Component : in Array_Component) return Array_Component;
function Array_Components (Component : in Record_Component) return Array_Component;
function Array_Components (Type_Definition : in Asis.Type_Definition) return Array_Component;Expanded Name Asis.Data_Decomposition.Array_Components
Returns a component describing all components of the specified array component or type definition.
Description
The returned value contains all information necessary to index to, and extract, any value from a data stream representing a value of the indicated type.
All returned values are valid parameters for all functions.
Parameters
Component : in Array_Component;Component : in Record_Component;Specifies the component to query. All components with an array subtype (Is_Array = True) are appropriate and must be of the following type-definition model kinds:
Type_Model_Kinds
A_Simple_Dynamic_Model
A_Simple_Static_Model
Type_Definition : in Asis.Type_Definition;Specifies the array type definition to be queried. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition1
An_Array_Type_Definition
1 Whose parent type is an array type.
return Array_Component;Returns a component describing all components of the specified array component or type definition.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
Function Array_Index
function Array_Index (Iterator : in Array_Component_Iterator) return Asis.Asis_Natural;Expanded Name Asis.Data_Decomposition.Array_Index
Returns a value that represents the current component in the array referenced by the specified iterator.
Description
The value returned represents the current linear index into the array referenced by the specified iterator.
Parameters
Iterator : in Array_Component_Iterator;Specifies the iterator to query.
return Asis.Asis_Natural;Returns a value that represents the current component in the array referenced by the specified iterator.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Element is raised and Environment.Status is set to Data_Error if a Nil iterator is specified or the iterator has completed (Done is True).
Examples
Cross-References
Function Array_Indexes
function Array_Indexes (Iterator : in Array_Component_Iterator) return Dimension_Indexes;Expanded Name Asis.Data_Decomposition.Array_Indexes
Returns an array containing the current offset for each dimension, and representing the current component, in the array referenced by the specified iterator.
Description
The array returned represents the current dimensional index into the array referenced by the specified iterator.
Each element in the returned value represents a dimension in the array referenced by the specified iterator. Each value in the array has a range of 1 .. 'Length (Dimension).
During iteration, the last dimension index changes quickest. This is usually referred to as row-major ordering.
Parameters
Iterator : in Array_Component_Iterator;Specifies the iterator to query.
return Dimension_Indexes;Returns an array that represents the current component in the array referenced by the specified iterator.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Element is raised and Environment.Status is set to Data_Error if a Nil iterator is specified or the iterator has completed (Done is True).
Examples
Cross-References
Related subprograms and types:
Function Array_Iterator
function Array_Iterator (Component : in Array_Component) return Array_Component_Iterator;Expanded Name Asis.Data_Decomposition.Array_Iterator
Returns an iterator referencing the first component of an array.
Description
The Done function should be used to determine whether the iteration has completed.
If the array component references a nil array, the Done function immediately returns True.
Parameters
Component : in Array_Component;Specifies the array component to be iterated over.
return Array_Component_Iterator;Returns an iterator referencing the first component of an array.
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a parameter references a library that is no longer open.
Examples
Cross-References
Function Array_Length
function Array_Length (Component : in Array_Component) return Asis.Asis_Natural;
function Array_Length (Component : in Record_Component) return Asis.Asis_Natural;
function Array_Length (Component : in Array_Component; Dimension : in Asis.Asis_Natural) return Asis.Asis_Natural;
function Array_Length (Component : in Record_Component; Dimension : in Asis.Asis_Natural) return Asis.Asis_Natural;Expanded Name Asis.Data_Decomposition.Array_Length
For the first two forms, returns the product of the 'Length attribute values for all dimensions of the specified component. For the last two forms, returns the 'Length attribute value for the specified dimension of the specified component.
Description
One way to determine the dimensionality of an array component is to construct an iterator for the component and then to use the Array_Indexes function to return a Dimension_Indexes array. The value of the 'Length attribute on the Dimension_Indexes array is the dimensionality.
Parameters
Component : in Array_Component;Component : in Record_Component;Specifies the component to query. All components with an array subtype (Is_Array = True) are appropriate.
Dimension : in Asis.Asis_Natural;Specifies the array dimension to query. The value must be between 1 and the number of dimensions specified for the array.
return Asis.Asis_Natural;For the first form, returns the product of the 'Length attribute values for all dimensions of the specified component. For the second form, returns the 'Length attribute value for the specified dimension of the specified component.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
Function Component_Data_Stream
function Component_Data_Stream (Component : in Array_Component; Index : in Asis.Asis_Positive; Data_Stream : in Asis.Portable_Transfer.Portable_Data) return Asis.Portable_Transfer.Portable_Data;
function Component_Data_Stream (Component : in Array_Component; Indexes : in Dimension_Indexes; Data_Stream : in Asis.Portable_Transfer.Portable_Data) return Asis.Portable_Transfer.Portable_Data;
function Component_Data_Stream (Iterator : in Array_Component_Iterator; Data_Stream : in Asis.Portable_Transfer.Portable_Data) return Asis.Portable_Transfer.Portable_Data;
function Component_Data_Stream (Component : in Record_Component; Data_Stream : in Asis.Portable_Transfer.Portable_Data) return Asis.Portable_Transfer.Portable_Data;Expanded Name Asis.Data_Decomposition.Component_Data_Stream
Returns a data stream representing the specified component.
Description
The data stream representing the desired component is sliced from the specified data stream and returned.
The data stream could have been obtained from a file, extracted from another data stream, or artificially created with the Construct_Artificial_Data_Stream function. The data stream must represent a value of the appropriate type.
An attempt to extract anything other than constraint values from an artificial data stream causes Asis_Inappropriate_Element to be raised. Only the constraint values are valid in, and can be extracted from, an artificially created data stream.
Parameters
Component : in Array_Component;Component : in Record_Component;Specifies the component to query. All non-nil component values are appropriate.
Index : in Asis.Asis_Positive;Specifies the linear index value for the array component that is being queried. The value must be in the range 1 .. Array_Length (Component).
Indexes : in Dimension_Indexes;Specifies the dimensional index values for the array component that is being queried. There must be one value for each dimension of the array type, and the value must be in the range 1 .. Array_Length (Component, N), where N represents the dimension of interest.
Iterator : in Array_Component_Iterator;Specifies the array component to query.
Data_Stream : in Asis. Portable_Transfer.Portable_Data;Specifies the data stream from which the data should be extracted.
return Asis.Portable_Transfer.Portable_Data;Returns a data stream representing the specified component.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Element is raised and Environment.Status is set to Data_Error if a nil iterator is specified or the iterator has completed (Done is True).
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if an attempt is made to extract anything but constraint values from an artificially created data stream.
Examples
Cross-References
Function Component_Declaration
function Component_Declaration (Component : in Record_Component) return Asis.Declaration;Expanded Name Asis.Data_Decomposition.Component_Declaration
Returns the declaration of the specified component.
Description
The declaration returned can be that of an explicit declaration (one that appears in the source code) or an implicit component declaration of an implementation-defined component (Ada83 LRM 13.4(8), Ada95 LRM 13.5.1).
Once the declaration of the component is obtained, you can use the functions in package Declarations and then Type_Definitions to determine the component's subtype, type, and base type.
Parameters
Component : in Record_Component;Specifies the component for which the declaration is desired. All non-nil components are appropriate.
return Asis.Declaration;The returned element is of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Component_Declaration
A_Discriminant_Specification
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
- function Component_Indication
- function Declarations.Type_Mark
- function Declarations.Object_Declaration_Definition
- "Component Properties"
- package Declarations, "Processing Object and Number Declarations"
- package Type_Definitions, "Processing the Type, Subtype, and Derived-Type Hierarchy"
- Ada83 LRM 13.4, Ada95 LRM
13.5.1
Function Component_Indication
function Component_Indication (Component : in Array_Component) return Asis.Subtype_Indication;Expanded Name Asis.Data_Decomposition.Component_Indication
Returns the subtype indication for the specified component.
Description
You can use the functions in the package Type_Definitions to determine component's the subtype, type, and base type.
Parameters
Component : in Array_Component;Specifies the component for which the declaration is desired. All non-nil components are appropriate.
return Asis.Subtype_Indication;The returned element is of the following kind:
Element_Kinds
A_Subtype_Indication
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |