Overview | Converts an object reference to an external form that can be stored outside the ORB or exchanged between processes. |
Original class | CORBA::ORB |
Exceptions | CORBA::SystemException |
Intended Usage
The CORBA::ORB::object_to_string method is intended to be used by client or server applications to convert object references (either proxy objects or local objects) to a string form that has meaning outside the process. The CORBA::ORB::string_to_object can then be used to reconstitute the object reference (either in the same process or a different process). The output string is compliant with the CORBA 2.1 specification for Interoperable Object References.
If the caller is a server (that it, the caller has already invoked CORBA::BOA::impl_is_ready), and the input object reference is a local object, then the resulting string can be passed to CORBA::ORB::string_to_object to construct a proxy in another process, or to obtain the original object pointer in the same process.
If the caller is not a server and the input object reference is a local object (rather than a proxy), then the result of CORBA::ORB::object_to_string is valid only within the calling process for the lifetime of the process and as long as the input object resides in the process.
Syntax
char * object_to_string (CORBA::Object_ptr obj);
Input parameters
Return values
Example
/* convert local object to string representation. Assume that p is a local object pointer already declared and defined of a class, say Foo */ #include "corba.h" #include ... /* assume op initialized */ extern CORBA::ORB_ptr op; CORBA::string str = op->object_to_string(p); CORBA::Object_ptr objPtr = op->string_to_object(str); /* narrow down objPtr by calling Foo::_narrow(objPtr), get back a local obj same as p ... */ CORBA::string_free(str); CORBA::release(objPtr); ...