Previous Table of Contents Next


4.2.2 Converting Object References to Strings


   4.2.2.1 object_to_string

   string object_to_string (in Object obj);

   4.2.2.2 string_to_object

   Object string_to_object (in string str);

   Because an object reference is opaque and may differ from ORB to ORB, the object reference itself is not a convenient value for storing references to objects in persistent storage or communicating references by means other than invocation. Two problems must be solved: allowing an object reference to be turned into a value that a client can store in some other medium, and ensuring that the value can subsequently be turned into the appropriate object reference.

   An object reference may be translated into a string by the operation object_to_string. The value may be stored or communicated in whatever ways strings may be manipulated. Subsequently, the string_to_object operation will accept a string produced by object_to_string and return the corresponding object reference.

   To guarantee that an ORB will understand the string form of an object reference, that ORB’s object_to_string operation must be used to produce the string. For all conforming ORBs, if obj is a valid reference to an object, then string_to_object(object_to_string(obj)) will return a valid reference to the same object, if the two operations are performed on the same ORB. For all conforming ORB's supporting IOP, this remains true even if the two operations are performed on different ORBs.