00001 #include "tao/PortableServer/PortableServer_Functions.h"
00002
00003 ACE_RCSID (PortableServer,
00004 PortableServer_Functions,
00005 "$Id: PortableServer_Functions.cpp 71473 2006-03-10 07:19:20Z jtc $")
00006
00007 #include "ace/OS_NS_string.h"
00008
00009 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00010
00011 namespace PortableServer
00012 {
00013 PortableServer::ObjectId *
00014 string_to_ObjectId (const char *string)
00015 {
00016
00017
00018
00019
00020
00021 CORBA::ULong buffer_size = static_cast <CORBA::ULong>
00022 (ACE_OS::strlen (string));
00023
00024
00025 CORBA::Octet *buffer = PortableServer::ObjectId::allocbuf (buffer_size);
00026
00027
00028 ACE_OS::memcpy (buffer, string, buffer_size);
00029
00030
00031 PortableServer::ObjectId *id = 0;
00032 ACE_NEW_RETURN (id,
00033 PortableServer::ObjectId (buffer_size,
00034 buffer_size,
00035 buffer,
00036 1),
00037 0);
00038
00039 return id;
00040 }
00041
00042 char *
00043 ObjectId_to_string (const PortableServer::ObjectId &id)
00044 {
00045
00046 char * string = CORBA::string_alloc (id.length ());
00047
00048
00049 ACE_OS::memcpy (string, id.get_buffer (), id.length ());
00050
00051
00052 string[id.length ()] = '\0';
00053
00054
00055 return string;
00056 }
00057 }
00058
00059
00060 TAO_END_VERSIONED_NAMESPACE_DECL