OpenTP1 Version 7 Programming Reference C Language
Pointer attribute
Format
Attribute meaning
The pointer attribute specifies a pointer class: reference pointer (ref) or complete pointer (ptr).
Explanation
- The pointer attribute is used for the parameter, structure member, and type definition. The txidl command may determine the appropriate pointer class based on how the pointer is used. In most cases, however, the pointer class needs to be specified in either of the following methods:
- Use the ref or ptr attribute in the pointer declaration.
- Use the pointer_default attribute for the IDL interface header. The default pointer class is determined based on the pointer_default attribute.
- The pointer attribute is valid only for the top level pointer in the declaration. If multiple pointers are declared in one declaration, the established pointer_default is validated for all pointers other than the top level pointer.
- The ref and ptr attributes cannot be specified at the same time.
Explanations of the reference pointer
A reference pointer is a simple-format pointer. The general use of the pointer is to deliver integers with reference.
The reference pointer has higher efficiency than the complete pointer; however, it has the following restrictions:
- Linkage cannot be terminated since the reference pointer does not support NULL values.
- A list with linkage cannot be created with the reference pointer.
The reference pointer has the following characteristics:
- The reference pointer always points to valid storage. It does not support NULL values. If a NULL value is used for the reference pointer, the operation is undefined.
- A reference pointer value is not changed during a function call. When control returns from a call, the pointer always points to the same area as at the start of the calling.
- No alias can be used. The area used by the same operation parameter and that pointed by another pointer cannot be pointed to.
Explanations of the complete pointer
A complete pointer is a complex-format pointer. The complete pointer can use all pointer-related facilities. For example, complex data structures such as a list with linkage, tree, queue, or arbitrary graph can be created.
- The complete pointer has the following characteristics:
- A complete pointer value can be changed during a function call.
- No alias can be used with IDL-only TxRPC.
- The storage area for another complete pointer used by the same operation parameter can be pointed to. In this case, however, the pointer needs to point to the start of the structure. For example, the pointer to the basic structure or duplicated storage area cannot be used if the next code is incorporated in the interface definition code.
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.