This section describes the classes that support the Dynamic Invocation Interface used by client applications and the
Dynamic Skeleton Interface used by object servers.
The CORBA::Any class is used to represent an IDL type so that its value may be passed in a type-safe manner. Objects of this class have a pointer to a
TypeCode that defines the object's type and a pointer to the value associated with the object. Methods are provided to construct, copy, and destroy an object as well as to initialize and query the object's type and value. In addition, streaming operators are provided to read and write the object to a stream.
Include the CORBA.h file when you use this structure.
This is a copy constructor; it creates an Any object that is a copy of the specified target.
CORBA::Any(CORBA::TypeCode_ptr tc,
void *value, CORBA::Boolean release = 0);
This constructor creates an Any object initialized with the specified value and
TypeCode.
|
|
|
|
|
|
|
If set to TRUE, the memory associated with this Any object's value is released when this Any object is destroyed.
|
|
|
|
The Any to be duplicated.
|
This static method returns a NULL pointer that can be used for initialization purposes.
void operator<<=(CORBA::Short);
void
operator<<=(CORBA::UShort);
void
operator<<=(CORBA::Long);
void
operator<<=(CORBA::ULong);
void
operator<<=(CORBA::Float);
void
operator<<=(CORBA::Double);
void
operator<<=(const CORBA::Any&);
void
operator<<=(const char *);
void
operator<<=(CORBA::LongLong);
void
operator<<=(CORBA::ULongLong);
void
operator<<=(CORBA::LongDouble);
These operators initialize this object with the specified value, automatically setting the appropriate TypeCode for the value. If this
Any object was constructed with the
release flag set to
TRUE, the value previously stored in this
Any object is released before the new value is assigned.
void operator<<=(CORBA::TypeCode_ptr
tc);
CORBA::Boolean operator>>=(CORBA::Short&) const;
CORBA::Boolean
operator>>=(CORBA::UShort&) const;
CORBA::Boolean
operator>>=(CORBA::Long&) const;
CORBA::Boolean
operator>>=(CORBA::ULong&) const;
CORBA::Boolean
operator>>=(CORBA::Float&) const;
CORBA::Boolean
operator>>=(CORBA::Double&) const;
CORBA::Boolean
operator>>=(CORBA::Any&) const;
CORBA::Boolean
operator>>=(const char *&) const;
CORBA::Boolean
operator>>=(CORBA::LongLong&) const;
CORBA::Boolean
operator>>=(CORBA::ULongLong&) const;
CORBA::Boolean
operator>>=(CORBA::LongDouble&) const;
These operators store the value from this object into the specified target. If the TypeCode of the target does not match the
TypeCode of the stored value,
FALSE is returned and no value is extracted. Otherwise, the stored value is assigned to the target and
TRUE is returned.
CORBA::Boolean operator>>=(char *&) const;
This method extracts the TypeCode of the value stored in this object.
void add(const char *
ctx);
void add_consume(char *
ctx);
This method adds the specified context code to this object's list. ThisContextList becomes the owner of the context specified by the argument. You should not attempt to access or free this
Context after you invoke this method.
This method returns a pointer to the context that is stored in the list at the specified index. If the index is invalid, a NULL pointer is returned. You should not attempt to free the returned context. To remove a context, use the
remove method instead.
void remove(CORBA::ULong
index);
This static method returns a NULL pointer that can be used for initialization purposes.
class PortableServer::DynamicImplementation : public
PortableServer::ServantBase
|
|
|
The ServerRequest object that represents the client's operation request.
|
This method will be invoked as a callback by the POA. The servants that inherit from the DynamicImplementation class must implement it. This method should be called directly or unpredictable behavior will result. Invoking this method under other circumstances may lead to unpredictable results. The
_primary_interface method receives an
ObjectId value and a
POA_ptr as input parameters and returns a valid
RepositoryId representing the most-derived interface for that
oid.
class DynamicAny::DynAny : public
CORBA::LocalObject
A DynAny object is used by a client application or server to create and interpret data types at runtime which were not defined at compile time. A
DynAny may contain a basic type (such as a
boolean,
int, or
float) or a complex type (such as a
struct or
union). The type contained by a
DynAny is defined when it is created and may not be changed during the lifetime of the object.
A DynAny object may represent a data type as one or more components, each with its own value. The
next,
seek,
rewind, and
current_component methods are provided to help you navigate through the components.
A DynAnyFactory is created by calling
ORB::resolve_initial_references("DynAnyFactory"). The factory is then used to create basic or complex types. The
DynAnyFactory belongs to the
DynamicAny module.
DynAny objects for basic types are created using the
DynAnyFactory::create_dyn_any_from_type_code method. A
DynAny object may also be created and initialized from an
Any object using the
DynAnyFactory::
create_dyn_any method.
The following interfaces are derived from DynAny and provide support for constructed types that are managed dynamically.
The dynany.h file should be included when you use this class.
DynAny objects cannot be used as parameters on operation requests or DII requests, nor can they be externalized using the
ORB::object_to_string method. However, you may use the
DynAny::to_any method to convert a
DynAny object into an
Any, which can be used as a parameter.
void assign(DynamicAny::DynAny_ptr
dyn_any);
Initializes the value in this DynAny object from the specified
DynAny.
Compares two DynAny values for equality. Returns
TRUE if they are equal,
FALSE otherwise.
A type mismatch exception is raised if the TypeCode of value contained in the
Any does not match the
TypeCode that was defined for this object when it was created.
If the value parameter passed is not legal, the operation raises an
InvalidValue exception.
|
|
|
An Any object containing the value to set for this object.
|
Advances to the next component, if one exists, and returns TRUE. If there are no more components, this method returns
FALSE.
Converts the DynAny object into an
Any object and returns a pointer to the
Any object.
Returns the TypeCode of the value stored in the
DynAny.
The DynAny extraction methods return the type contained in this DynAny object's current component. The list below shows the name of each of the extraction methods.
A TypeMismatch exception is raised if the value contained in this
DynAny does not match the expected return type for the extraction method used.
virtual CORBA::Any* get_any();
virtual CORBA::Boolean
get_boolean();
virtual CORBA::Char
get_char();
virtual CORBA::Double
get_double();
virtual DynamicAny::DynAny*
get_dyn_any();
virtual CORBA::Float
get_float();
virtual CORBA::Long
get_long();
virtual CORBA::LongLong
get_longlong();
virtual CORBA::Octet
get_octet();
virtual CORBA::Object_ptr
get_reference();
virtual CORBA::Short
get_short();
virtual char*
get_string();
virtual CORBA::TypeCode_ptr
get_typecode();
virtual CORBA::ULong
get_ulong();
virtual CORBA::UlongLong
get_ulonglong();
virtual CORBA::UShort
get_ushort();
virtual CORBA::ValueBase*
get_val();
virtual CORBA::WChar
get_wchar();
virtual CORBA::WChar*
get_wstring();
Solaris, AIX, HP-UX, and Linux 64-bit:
virtual CORBA::LongDouble get_longdouble();
An insertion method copies a value of a particular type to this DynAny object's current component. Following is the list of methods provided for inserting various types.
These methods raise an InvalidValue exception if the inserted object's type does not match the
DynAny object's type.
virtual void insert_any(const CORBA:Any&
value);
virtual void
insert_boolean(CORBA::Boolean
value);
virtual void
insert_char(CORBA::Char
value);
virtual void
insert_double(CORBA::Double
value);
virtual void
insert_dyn_any (const DynamicAny::DynAny_ptr
value);
virtual void
insert_float(CORBA::Float
value);
virtual void
insert_long(CORBA::Long
value);
virtual void
insert_longlong(CORBA::LongLong
value);
virtual void
insert_octet(CORBA::Octet
value);
virtual void
insert_reference(CORBA:Object_ptr
value);
virtual void
insert_short(CORBA::Short
value);
virtual void
insert_string(const char*
value);
virtual void
insert_typecode(CORBA:TypeCode_ptr
value);
virtual void
insert_ulong(CORBA::ULong
value);
virtual void
insert_ulonglong(CORBA::ULongLong
value);
virtual void
insert_ushort(CORBA::UShort
value);
virtual void
insert_val(const CORBA::ValueBase&
value);
virtual void
insert_wchar(CORBA::WChar
value);
virtual void
insert_wstring(const CORBA::WChar*
value);
Solaris, AIX, HP-UX, and Linux 64-bit:
virtual void
insert_longdouble(CORBA::LongDouble
value); Solaris only
class DynamicAny::DynAnyFactory : public CORBA::LocalObject
A DynAnyFactory object is used to create a new
DynAny object. To obtain a reference to the
DynAnyFactory object, call
ORB::resolve_initial_references("DynAnyFactory").
DynAny_ptr create_dyn_any (const CORBA::Any& value);
Creates a DynAny object of the specified value
|
|
|
A new DynAny object of a specified value.
|
DynAny_ptr create_dyn_any_from_type_code (CORBA::TypeCode_ptr type);
Creates a DynAny object of the specified
type.
class DynamicAny::DynArray : public VISDynComplex
Objects of this class are used by a client application or server to create and interpret array data types at runtime which were not defined at compile time. A DynArray may consist of a sequence of basic types (such as a
boolean,
int, or
float) or constructed types (such as
struct or
union). The type contained by a
DynArray is defined when it is created and may not be changed during the lifetime of the object.
The next,
rewind,
seek, and
current_component methods, inherited from
DynAny, may be used to navigate through the components.
The VISDynComplex class is a helper class that allows the VisiBroker ORB to manage complex
DynAny types.
DynArray objects cannot be used as parameters on operation requests or DII requests, nor can they be externalized using the
ORB::object_to_string method. However, you may use the
DynAny::to_any method to convert a
DynArray object to a sequence of
Any objects, which can be used as a parameter.
Returns a sequence of Any objects containing the values stored in this object.
void set_elements(const CORBA::AnySeq&
_value);
Assigns the elements in the DynArray to those in the sequence specified by the
value parameter.
void set_elements_as_dyn_any (const DynamicAny::DynAnySeq& value);
An InvalidValue exception is raised if the number of elements in
value is not equal to the number of elements in this
DynArray. A type mismatch exception is raised if the type of the
Any values do not match the
TypeCode of the
DynAny.
|
|
|
An array of Any objects whose values will be set in this DynArray.
|
class DynamicAny::DynEnum : public DynamicAny::DynAny
Since objects of this type contains a single component, the DynAn::
rewind and
DynAny::
next methods of a
DynEnum object always return
FALSE.
DynEnum objects cannot be used as parameters on operation requests or DII requests, nor can they be externalized using the
ORB::object_to_string method. However, you may use the
to_any method to convert a
DynEnum object to an
Any, which can be used as a parameter.
void from_any(const CORBA::Any&
value);
An Invalid exception is raised if the
TypeCode of value contained in the
Any does not match the
TypeCode defined for this object when it was created.
Returns an Any object containing the value of the current component.
Returns the DynEnum object's value as a string.
void set_as_string(const char*
value_as_string);
Sets the value of this DynEnum to the specified string.
void set_as_ulong(CORBA::ULong
value_as_ulong)
Sets the value of this DynEnum to the specified
CORBA::Ulong.
class DynamicAny::DynSequence : public DynamicAny::DynArray
Objects of this class are used by a client application or server to create and interpret sequence data types at runtime which were not defined at compile time. A DynSequence may contain a sequence of basic types (such as a
boolean,
int, or
float) or constructed types (such as a
struct or
union). The type contained by a
DynSequence is defined when it is created and may not be changed during the lifetime of the object.
The next,
rewind,
seek, and
current_component methods may be used to navigate through the components.
DynSequence objects cannot be used as parameters on operation requests or DII requests nor can they be externalized using the
ORB::object_to_string method. However, you may use the
to_any method to convert a
DynSequence object to a sequence of
Any objects. You can use the sequence of
Any objects as a parameter.
void set_length(CORBA::ULong
length);
Returns a sequence of Any objects containing the value stored in this object.
void set_elements (const AnySeq& _value)
class DynamicAny::DynStruct :public VISDynComplex
The next,
rewind,
seek, and
current_component methods may be used to navigate through the structure members.
You create an DynStruct object by invoking the
DynAnyFactory::create_dyn_any_from_typecode method.
DynStruct objects cannot be used as parameters on operation requests or DII requests, nor can they be externalized using the
ORB::object_to_string method. However, you may use the
to_any method to convert a
DynStruct object to an
Any object, which can be used as a parameter.
Returns the TypeCode associated with the current component.
void set_members(const DynamicAny::NameValuePairSeq&
value);
void set_members_as_dyn_any(const DynamicAny::NameDynAnyPairSeq
value);
An InvalidValue exception is raised if the length of the value sequence is not equal to the number of members of
DynStruct, and a
TypeMismatch exception is raised when any of the element's typecode does not match that of the structure.
class DynamicAny::DynUnion : public VISDynComplex
The next,
rewind,
seek, and
current_component methods may be used to navigate through the components.
You create a DynUnion object by invoking the
DynamicAny::DynAnyFactory::create_dyn_any_from_type_code method and passing a
union type code as an argument.
DynUnion objects cannot be used as parameters on operation requests or DII requests nor can they be externalized using the
ORB::object_to_string method. However, you may use the
DynAny::to_any method to convert a
DynUnion object to an
Any object which can be used as a parameter.
Returns a DynAny object containing the discriminator for the union.
Returns a DynAny object for the current component which represents a union member.
Sets the discriminator of this DynUnion to the specified value.
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).
The Environment class is used for reporting and accessing both system and user exceptions on platforms where C++ language exceptions are not supported. When an interface specifies that user exceptions may be raised by the object's methods, the
Environment class becomes an explicit parameter of that method. If an interface does not raise any exceptions, the
Environment class is an implicit parameter and is only used for reporting system exceptions. If an
Environment object is not passed from the client to a stub, the default of per-object
Environment is used.
Multithreaded applications have a global Environment object for each thread that is created. Applications that are not multithreaded have just one global
Environment object.
You should include the corba.h file when you use this class.
void ORB::create_environment(COBRA::Environment_out
ptr);
This method creates an Environment object. This is equivalent to calling the
ORB::create_environment method.
This static method returns a reference to the global Environment object for the application process. In multithreaded applications, it returns the global
Environment object for this thread.
void exception(COBRA::Exception *
exp);
This method records the Exception object passed as an argument. The
Exception object must be dynamically allocated because the specified object will assume ownership of the
Exception object and will delete it when the
Environment itself is deleted. Passing a
NULL pointer to this method is equivalent to invoking the
clear method on the
Environment.
This method returns a pointer to the Exception currently recorded in this
Environment. You must not invoke
delete on the
Exception pointer returned by this call. If no
Exception has been recorded, a
NULL pointer is returned.
This method deletes any Exception object that it holds. If this object holds no exception, this method has no effect.
class CORBA::ExceptionList
void add(CORBA::TypeCode_ptr
tc);
void add_consume(CORBA::TypeCode_ptr
tc);
This method returns a pointer to the TypeCode stored in the list at the specified index. If the index is invalid, a
NULL pointer is returned. You should not attempt to access or free the argument after invoking this method. To remove a
TypeCode from the list, use the
remove method.
void remove(CORBA::long
index);
This method removes the TypeCode with the specified
index from the list. If the
index is invalid, no removal occurs.
This static method returns a NULL pointer that can be used for initialization purposes.
The NamedValue class is used to represent a name-value pair used as a parameter or return value in a Dynamic Invocation Interface request. Objects of this class are grouped into an
NVList, described in
“NVList” on page 66. The value of the name-value pair is represented by using an
Any object. The
Request class is described in
“Request” on page 69.
You should include the file corba.h when using this class.
|
|
|
|
|
|
|
When combined with the ARG_INOUT flag, this flag indicates that the ORB copies the output parameter. This allows the ORB to release memory associated with this parameter without impacting the client application's memory.
|
This static method returns a NULL pointer that can be used to initialize a
CORBA::NamedValue_ptr.
The NVList class is used to contain a list of
NamedValue objects, described in
“NamedValue” on page 65. It is used to pass parameters associated with a Dynamic Invocation Interface request. The
Request class is described in
“Request” on page 69.
You should include the file corba.h when using this class.
This method adds a NamedValue object to this list, initializing only the flags. Neither the name or value of the added object are initialized. A pointer is returned which can be used to initialize the name and value attributes of the
NamedValue. You should never release the storage associated with the return argument.
This method adds a NamedValue object to this list, initializing the object's
flag and
name attributes. A pointer is returned which can be used to initialize the value attribute of the
NamedValue.
This method is the same as the add_item method, except that the
NVList takes over the management of the storage pointed to by
nm. You will not be able to access
nm after this method is called because the list may have copied and released it. When this item is removed, the storage associated with it is automatically freed.
This method adds a NamedValue object to this list, initializing the name, value, and flag. A pointer to the
NamedValue object is returned.
NamedValue_ptr add_value_consume(char
*nm, CORBA::Any
*value, CORBA::Flags
flag);
This method is the same as the add_value method, except that the
NVList takes over the management of the storage pointed to by
nm and
value. You will not be able to access
nm or
value after this method is called because the list may have copied and released them. When this list element is removed, the storage associated with it is automatically freed.
This method returns the number of NamedValue objects in this list.
This method returns TRUE if the specified
NamedValue pointer is
NULL.
This method returns the NamedValue in the list with the specified
index.
void remove(CORBA::ULong
index);
This method deletes the NamedValue object located at the specified
index from this list. Storage associated with items in the list that were added using the
add_item_consume or
add_value_consume methods is released before the item is removed.
This static method returns a NULL pointer that can be used to initialize an
NV_List pointer. For example, you might do something like this:
CORBA::NV_List_ptr p = CORBA::NVList::_nil();
The Request class is used by client applications to invoke an operation on an ORB object using the Dynamic Invocation Interface. A single ORB object is associated with a given
Request object. The
Request represents an operation that is to be performed on the ORB object. It includes the arguments to be passed, the
Context, and an
Environment object, if any. Methods are provided for invoking the request, receiving the response from the object implementation, and retrieving the result of the operation.
You can create a Request object by using the
Object::_create_request. For more information, go to
“Core interfaces and classes”.
A Request object retains ownership of all return parameters, so you should never attempt to free them.
Include the corba.h file when you use this class.
This method adds an unnamed input argument to this Request and returns a reference to the
Any object so that you can set its name, type, and value.
This method adds a named input argument to this Request and returns a reference to the
Any object so that you can set its type and value.
This method adds an unnamed inout argument to this
Request and returns a reference to the
Any object so that you can set its name, type, and value.
This method adds a named inout argument to this
Request and returns a reference to the
Any object so that you can set its type and value.
This method adds an unnamed output argument to this Request and returns a reference to the
Any object so that you can set its name, type, and value.
This method adds a named output argument to this Request and returns a reference to the
Any object so that you can set its type and value.
This method returns a pointer to an NVList object containing the arguments for this request. The pointer can be used to set or retrieve the argument values. For more information on
NVList, see
“NVList” on page 66.
This method returns a pointer to a list of all the Context objects that are associated with this
Request. For more information on the
Context class, go to
“Core interfaces and classes”.
This method returns a pointer to the Context associated with this request.
void ctx(CORBA::Context_ptr
ctx);
This method sets the Context to be used with this request. For more information on the
Context class, go to
“Core interfaces and classes”.
This method returns a pointer to the Environment associated with this request. For more information on the
Environment class, go to
“Environment” on page 62.
This method is used after the send_deferred method has been invoked to retrieve a response from the object implementation. If there is no response available, this method blocks the client application until a response is received.
This method invokes this Request on the ORB object associated with this request. This method blocks the client until a response is received from the object implementation. This
Request should be initialized with the target object, operation name and arguments before this method is invoked.
This non-blocking method is invoked after the send_deferred method to determine if a response has been received. This method returns
TRUE if a response has been received, otherwise it returns
FALSE.
This method returns a pointer to a NamedValue object where the return value for the operation will be stored. The pointer can be used to retrieve the result value after the request has been processed by the object implementation. For more information on the
NamedValue class, go to
“NamedValue” on page 65.
This method returns a reference to an Any object that represents the return value of this
Request object.
void set_return_type(CORBA::TypeCode_ptr
tc);
This method sets the TypeCode of the return value that is expected. You must set the return value's type before using the
invoke method or one of the
send methods.
Like the invoke method, this method sends this
Request to the object implementation. Unlike the
invoke method, this method does not block waiting for a response. The client application can retrieve the response using the
get_response method.
This method invokes this Request as a
oneway operation. Oneway operations do not block and do not result in a response being sent from the object implementation to the client application.
The ServerRequest class is used to represent an operation request received by an object implementation that is using the Dynamic Skeleton Interface. When the POA receives a client operation request, it invokes the object implementation's
invoke method and passes an object of this type.
The corba.h file should be included when you use this class.
void arguments(CORBA::NVList_ptr
param);
This method returns the Context object associated with the request.
void exception(CORBA::Any_ptr
exception);
void params(CORBA::NVList_ptr
params);
This method accepts an NVList object initialized with the appropriate number of
Any objects. The method fills the
NVList in with the parameters supplied by the client.
void result(CORBA::Any_ptr
result);
|
|
|
An Any object representing the return value.
|
void set_exception(const CORBA::Any&
a);
|
|
|
An Any object representing the exception.
|
void set_result(const CORBA::Any&
a);
|
|
|
An Any object representing the return value.
|
This static method returns a NULL pointer that can be used for initialization purposes.
The TypeCode class represents the various types that can be defined in IDL. Type codes are most often used to define the type of value being stored in an
Any object, described in
“Any” on page 49. Type codes may also be passed as parameters to method invocations.
TypeCode objects can be created using the various
CORBA::ORB.create_<type>_tc methods, whose description begins in
“Core interfaces and classes”. You may also use the constructors listed here.
Include the corba.h file when you use this class.
This method constructs a TypeCode object for types that do not require any additional parameters. A
BAD_PARAM exception is raised if
kind is not a valid type for this constructor.
|
|
|
Describes the type of object being represented. Must be one of the following: CORBA::tk_null, CORBA::tk_void, CORBA::tk_short, CORBA::tk_long, CORBA::tk_ushort, CORBA::tk_ulong, CORBA::tk_float, CORBA::tk_double, CORBA::tk_boolean, CORBA::tk_char, CORBA::tk_octet, CORBA::tk_any, CORBA::tk_TypeCode, CORBA::tk_Principal, CORBA::tk_longlong, CORBA::tk_ulonglong, CORBA::tk_longdouble, or CORBA::tk_wchar, CORBA::tk_fixed, CORBA::tk_value, CORBA::tk_value_box, CORBA::native, CORBA::tk_abstract_interface.
|
|
|
This method returns the TypeCode of the elements in a sequence or array. It also will return the type of an alias. A
BadKind exception is raised if this object's kind is not
CORBA::tk_sequence,
CORBA::tk_array, or
CORBA::tk_alias.
This method returns the default index of a TypeCode representing a union. If this object's kind is not
CORBA::tk_union, a
BadKind exception is raised.
This method returns the discriminator type of a TypeCode representing a union. If this object's kind is not
CORBA::tk_union, a
BadKind exception is raised.
This method compares this object with the specified TypeCode. If they match in every respect,
TRUE is returned. Otherwise,
FALSE is returned.
This method returns the member count of the type being represented by this TypeCode object. If the type being represented does not have members, a
BadKind exception is raised. Types that have members include:
This method returns the label of the member with the specified index from a
TypeCode object for a
union. If this object's kind is not
CORBA::tk_union, a
BadKind exception is raised. If the index is invalid, a
Bounds exception is raised.
This static method returns a NULL TypeCode pointer that can be used for initialization purposes.
The equivalent operation is used by the ORB when determining the type equivalence for values stored in an IDL.
The get_compact_code operation strips out all optional name & member name fields, but it leaves all alias typecodes intact.
This method returns the Visibility of the valuetype member identified by index.
The member_visibility operation can only be invoked on valuetype TypeCodes, not on valueboxes (or boxed values).
The type_modifier operations can only be invoked on non-boxed valuetype TypeCodes. This method returns the
ValueModifier that applies to the valuetype represented by the target TypeCode.
The concrete_base_type operations can only be invoked on non-boxed valuetype TypeCodes. If the value represented by the target
TypeCode has a concrete base valuetype, this method returns a TypeCode for the concrete base, otherwise it returns a
nil TypeCode reference.