[Previous] [Contents] [Next] [IONA Technologies]


CORBA.Any


Contents

CORBA.Any.Any()
CORBA.Any.Any()
CORBA.Any.Any()
CORBA.Any.Any()
CORBA.Any.Any()
CORBA.Any.Any()
CORBA.Any.containsType()
CORBA.Any.clone()
CORBA.Any.copy()
CORBA.Any.equals()
CORBA.Any.extract()
CORBA.Any.extractArray()
CORBA.Any.insert()
CORBA.Any.insertArray()
CORBA.Any.reset()
CORBA.Any.resetPosition()
CORBA.Any.setTypeCode()
CORBA.Any.toString()
CORBA.Any.type()
CORBA.Any.value()



Synopsis:

The class Any implements the IDL basic type any, which allows the specification of values that can express an arbitrary IDL type. This allows a program to handle values whose types are not known at compile time. The IDL type any is most often used in code that uses the Interface Repository or the Dynamic Invocation Interface (DII).

Consider the following interface:

A client can construct an any to contain an arbitrary type of value and then pass this in a call to operation op(). A process receiving an any must determine what type of value it stores and then extract the value.

OrbixWeb:

Type any is mapped to a Java class which conceptually contains a TypeCode and a value:

See Also :



CORBA.Any.Any()


Synopsis:

Description:

The default constructor creates an Any with a TypeCode of type tk_null and with a zero value. The easiest and the type-safe way to construct an Any is to use the default constructor and then use the appropriate insertion method to insert a value into the Any. For example,

Notes:

CORBA defined.

See Also:

Other Any constructors.



CORBA.Any.Any()


Synopsis:

Description:

This constructor creates an Any with a TypeCode of type tk_null and with a zero value.

The parameter kind indicates the marshalling protocol associated with the Any object. This parameter can take the value _CORBA.IT_ORBIX_OR_KIND, to indicate native Orbix marshalling, or _CORBA.IT_INTEROPERABLE_OR_KIND, to indicate IIOP marshalling (see Chapter 9, "ORB Interoperability" of the OrbixWeb Programming Guide).

Notes:

CORBA defined.

See Also:

Other Any constructors.



CORBA.Any.Any()


Synopsis:

Description:

This constructor copies the TypeCode and value of a.

Notes:

CORBA defined.

See Also:

Other Any constructors.



CORBA.Any.Any()


Synopsis:

Description:

Copy constructor. The constructor copies the TypeCode and value of a.

The parameter kind indicates the marshalling protocol associated with the Any object. This parameter can take the value _CORBA.IT_ORBIX_OR_KIND, to indicate native Orbix marshalling, or _CORBA.IT_INTEROPERABLE_OR_KIND, to indicate IIOP marshalling (see Chapter 9, "ORB Interoperability" of the OrbixWeb Programming Guide).

Notes:

CORBA defined.

See Also:

Other Any constructors.



CORBA.Any.Any()


Synopsis:

Description:

Constructs an Any with a specific TypeCode and value. This constructor is needed for cases where it is not possible to use the default constructor and Any insertion methods.

Note that this constructor is not type-safe; the programmer is responsible for ensuring consistency between the TypeCode and the actual type of the argument stored in the value buffer.

Parameters:



     type
    
A TypeCode object. The constructor copies this object.

     value
    
The byte array which stores the Any value buffer.

     do_copy
    
A boolean variable which determines whether a copy of or a reference to the value should be taken. If do_copy is set to true, then a copy is made, otherwise a reference is taken.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.Any()


Synopsis:

Description:

Constructs an Any with a specific TypeCode and value. This constructor is needed for cases where it is not possible to use the default constructor and Any insertion methods.

Note that this constructor is not type-safe; the programmer is responsible for ensuring consistency between the TypeCode and the actual type of the argument stored in the value buffer.

The parameter kind indicates the marshalling protocol associated with the Any object. This parameter can take the value _CORBA.IT_ORBIX_OR_KIND, to indicate native Orbix marshalling, or _CORBA.IT_INTEROPERABLE_OR_KIND, to indicate IIOP marshalling (see Chapter 9, "ORB Interoperability" of the OrbixWeb Programming Guide).

Parameters:



     type
    
A TypeCode object. The constructor copies this object.

     value
    
The byte array which stores the Any value buffer.

     do_copy
    
A boolean variable which determines whether a copy of or a reference to the value should be taken. If do_copy is set to true, then a copy is made, otherwise a reference is taken.

     kind
    
The marshalling protocol associated with the Any.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.containsType()


Synopsis:

Description:

Verifies if the TypeCode associated with the Any matches a specified type.

Return Value:

Returns true if TypeCode parameter matches Any.type(), otherwise returns false.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.clone()


Synopsis:

Description:

Creates a new Any object, copies the existing Any to the new object and returns the new object.

Notes:

OrbixWeb specific.

See Also:

Copy constructor.



CORBA.Any.copy()


Synopsis:

Description:

Copies the Any type and value into an existing Any object.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.equals()


Synopsis:

Description:

Compares the type and value of the Any to those of an Any referenced by parameter _obj.

Return Value:

Returns true if the Any matches the parameter object, otherwise returns false.

Notes:

OrbixWeb specific.



CORBA.Any.extract()


Synopsis:

Description:

Extracts a value of the indicated type from an Any. The type of an Any can be determined via the accessor method CORBA.Any.type(), and the value can then be extracted using the appropriate extraction method.

To extract a user-defined type from an Any, the IDL source file must be compiled with the -A switch. The generic extraction method extract() should then be used to extract values of this type. For example, take the definition:

Compilation with the -A switch allows struct Details to be extracted as follows:

If the extraction is successful, the value of the Any will be copied to the target object.

Note that IDL enumerated types should be extracted from an Any using the method extractLong().

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.extractArray()


Synopsis:

Description:

Extracts an array of the indicated type from an Any. The type of an Any can be determined via the accessor method CORBA.Any.type(), and the value can then be extracted using the appropriate extraction method.

To extract an array of a user-defined type from an Any, the IDL source file must be compiled with the -A switch. The generic extraction method extractArray() should then be used to extract arrays of this type.

For example, take an IDL long array containing ten elements: such an array can be extracted as follows:

If the extraction is successful, the value of the Any will be copied to the target array.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.insert()


Synopsis:

Description:

Inserts a value of the indicated type into an Any.

Any previous value held by the Any will be discarded. Each insertion method takes a copy of the value being inserted.

To insert a user-defined type into an Any, the IDL source file must be compiled with the -A switch. The generic insertion method insert() can then be used to insert the type into an Any. For example, for the definition:

the insert() method can be used as follows:

Note that enumerated IDL types represent a special case for insertion into an Any. The IDL compiler maps an IDL enum to a Java int. Therefore, enum values should not be inserted into an Any using the generic insert() method.

Instead, an int value should be inserted into the Any using the insertLong() method and the type of the Any should be set explicitly to the TypeCode value for the required enum. The TypeCode can be set using the method setTypeCode(), while the TypeCode value for the enumerated type is generated by the IDL compiler (with the -A switch).

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.insertArray()


Synopsis:

Description:

Inserts an array of the indicated type into an Any. Each insertion method takes two parameters: the array value to be inserted and the length of the array.

Any previous value held by the Any will be discarded. Each insertion method takes a copy of the array being inserted.

To insert an array of a user-defined type into an Any, the IDL source file for that type must be compiled with the -A switch.The generic insertion method insertArray() can then be used to insert the type into an Any. For example, consider the definition:

The insertArray() method can be used to insert an array of this type as follows:

As for single element insertion, arrays of IDL enumerated types (which map to Java int) should be inserted using insertLongArray(). The type of the Any should then be set to the TypeCode value for the enumerated type using the method setTypeCode().

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.reset()


Synopsis:

Description:

Assigns tk_null to the type of the Any and null to the value.

Notes:

OrbixWeb specific.



CORBA.Any.resetPosition()


Synopsis:

Description:

Sets the position for extraction from an Any to the beginning of the value buffer. This is required when extracting a value from an Any more than once.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.setTypeCode()


Synopsis:

Description:

Sets the type of the Any. Required when inserting IDL enumerated types; these are inserted as type long and the type is then set explicitly.

Notes:

OrbixWeb specific.

See Also:



CORBA.Any.toString()


Synopsis:

Description:

Displays the type of the Any in a string of the following format:

Notes:

OrbixWeb specific.



CORBA.Any.type()


Synopsis:

Description:

Returns the TypeCode associated with the Any.

Notes:

CORBA defined.

See Also:



CORBA.Any.value()


Synopsis:

Description:

Returns a buffer which contains the actual value stored in the Any.

Notes:

CORBA defined.

See Also:



[Roadmap] [Utilities] [Compiling] [Configuration]
[Class Reference] [IR Reference] [Daemon Reference] [IDL Grammar] [System Exceptions]
[Index]