DynAny interface provides the core of CORBA’s facility for the
dynamic introspection of Any values for which the implementation class
is not available. This facility has similar goals as Java’s built-in
introspection facilities, but CORBA provides it as IDL interfaces so
that it can be used no matter what implementation language is
chosen. The CORBA facility allows services and objects to determine
the type and contents of values passed into methods, without having
access to their implementation interface. The service or object can
wrap an incoming Any value with a
DynAny in order to probe its
properties and structure.
DynAny objects should not be exported outside of the processes where
they are created. If you attempt to create a stringified reference to
DynAny object using the
ORB.object_to_string() method, a
exception will be thrown.
DynAny interface provides a series of
methods that can be used to access or modify the contents of the
value if it is an IDL basic type. The
TypeCode for the contents can
also be accessed, using the
type() method. If the
Any value holds a
complex data type, such as a struct, then the
current_component() methods on the
DynAny interface can be used to
iterate through the data members of the contents.
There are various subtypes of
DynAny which provide access to the
components of specific IDL complex types, such as
unions. These and basic ...