VisiBroker for Java

org.omg.DynamicAny
Interface DynUnionOperations

All Superinterfaces:
DynAnyOperations
All Known Subinterfaces:
DynUnion
All Known Implementing Classes:
_DynUnionStub

public interface DynUnionOperations
extends DynAnyOperations

DynUnion objects are associated with unions. The DynUnion interface allows for the insertion/extraction of an OMG IDL union type into/from a DynUnion object. A union can have only two valid current positions: zero, which denotes the discriminator, and one, which denotes the active member. The component_count value for a union depends on the current discriminator: it is 2 for a union whose discriminator indicates a named member, and 1 otherwise.


Method Summary
 TCKind discriminator_kind()
          The discriminator_kind operation returns the TCKind value of the discriminator?s TypeCode.
 DynAny get_discriminator()
          The get_discriminator operation returns the current discriminator value of the DynUnion.
 boolean has_no_active_member()
          The has_no_active_member operation returns true if the union has no active member (that is, the union's value consists solely of its discriminator because the discriminator has a value that is not listed as an explicit case label).
 TCKind member_kind()
          The member_kind operation returns the TCKind value of the TypeCode of the currently active member.
 java.lang.String member_name()
          The member_name operation returns the name of the currently active member.
 DynAny member()
          The member operation returns the currently active member.
 void set_discriminator(DynAny d)
          The set_discriminator operation sets the discriminator of the DynUnion to the specified value.
 void set_to_default_member()
          The set_to_default_member operation sets the discriminator to a value that is consistent with the value of the default case of a union; it sets the current position to zero and causes component_count to return 2.
 void set_to_no_active_member()
          The set_to_no_active_member operation sets the discriminator to a value that does not correspond to any of the union?s case labels; it sets the current position to zero and causes component_count to return 1.
 
Methods inherited from interface org.omg.DynamicAny.DynAnyOperations
assign, component_count, copy, current_component, destroy, equal, from_any, get_any, get_boolean, get_char, get_double, get_dyn_any, get_float, get_long, get_longlong, get_octet, get_reference, get_short, get_string, get_typecode, get_ulong, get_ulonglong, get_ushort, get_val, get_wchar, get_wstring, insert_any, insert_boolean, insert_char, insert_double, insert_dyn_any, insert_float, insert_long, insert_longlong, insert_octet, insert_reference, insert_short, insert_string, insert_typecode, insert_ulong, insert_ulonglong, insert_ushort, insert_val, insert_wchar, insert_wstring, next, rewind, seek, to_any, type
 

Method Detail

member_kind

TCKind member_kind()
                   throws InvalidValue
The member_kind operation returns the TCKind value of the TypeCode of the currently active member. If the union has no active member, the operation raises InvalidValue.

Throws:
InvalidValue

member_name

java.lang.String member_name()
                             throws InvalidValue
The member_name operation returns the name of the currently active member. If the union's TypeCode does not contain a member name for the currently active member, the operation returns an empty string. Calling member_name on a union without an active member raises InvalidValue.

Throws:
InvalidValue

member

DynAny member()
              throws InvalidValue
The member operation returns the currently active member. If the union has no active member, the operation raises InvalidValue. Note that the returned reference remains valid only for as long as the currently active member does not change. Using the returned reference beyond the life time of the currently active member raises OBJECT_NOT_EXIST.

Throws:
InvalidValue

discriminator_kind

TCKind discriminator_kind()
The discriminator_kind operation returns the TCKind value of the discriminator?s TypeCode.


has_no_active_member

boolean has_no_active_member()
The has_no_active_member operation returns true if the union has no active member (that is, the union's value consists solely of its discriminator because the discriminator has a value that is not listed as an explicit case label). Calling this operation on a union that has a default case returns false. Calling this operation on a union that uses the entire range of discriminator values for explicit case labels returns false.


set_to_no_active_member

void set_to_no_active_member()
                             throws TypeMismatch
The set_to_no_active_member operation sets the discriminator to a value that does not correspond to any of the union?s case labels; it sets the current position to zero and causes component_count to return 1. Calling set_to_no_active_member on a union that has an explicit default case or on a union that uses the entire range of discriminator values for explicit case labels raises TypeMismatch.

Throws:
TypeMismatch

set_to_default_member

void set_to_default_member()
                           throws TypeMismatch
The set_to_default_member operation sets the discriminator to a value that is consistent with the value of the default case of a union; it sets the current position to zero and causes component_count to return 2. Calling set_to_default_member on a union that does not have an explicit default case raises TypeMismatch.

Throws:
TypeMismatch

set_discriminator

void set_discriminator(DynAny d)
                       throws TypeMismatch
The set_discriminator operation sets the discriminator of the DynUnion to the specified value. If the TypeCode of the d parameter is not equivalent to the TypeCode of the union's discriminator, the operation raises TypeMismatch. Setting the discriminator to a value that is consistent with the currently active union member does not affect the currently active member. Setting the discriminator to a value that is inconsistent with the currently active member deactivates the member and activates the member that is consistent with the new discriminator value (if there is a member for that value) by initializing the member to its default value. Setting the discriminator of a union sets the current position to 0 if the discriminator value indicates a non-existent union member (has_no_active_member returns true in this case). Otherwise, if the discriminator value indicates a named union member, the current position is set to 1 (has_no_active_member returns false and component_count returns 2 in this case).

Throws:
TypeMismatch

get_discriminator

DynAny get_discriminator()
The get_discriminator operation returns the current discriminator value of the DynUnion.


Borland Software Corporation
http://www.borland.com
100 Enterprise Way
Scotts Valley, CA 95066
Voice: (831) 431-1000
pubsweb@borland.com

Read the latest documentation online