#include <ORB.h>
ORB pseudo-object.
The "ORB" pseudo-object is used in bootstrapping, such as to create object references from strings. This class is intended to be inherited by others, which will provide some more of the CORBA support. Implementations of this "CORBA::ORB" class must know how to create stringify/destringify their objrefs, as well as how to marshal and unmarshal them.
Definition at line 162 of file ORB.h.
typedef ORB_out CORBA::ORB::_out_type |
typedef ORB_ptr CORBA::ORB::_ptr_type |
typedef ORB_var CORBA::ORB::_var_type |
typedef char* CORBA::ORB::ObjectId |
typedef CORBA::ORB_ObjectIdList CORBA::ORB::ObjectIdList |
typedef CORBA::ORB_ObjectIdList* CORBA::ORB::ObjectIdList_ptr |
CORBA::ORB::ORB | ( | TAO_ORB_Core * | orb_core | ) | [protected] |
CORBA::ORB::~ORB | ( | void | ) | [protected] |
CORBA::ORB::ORB | ( | const ORB & | ) | [private] |
CORBA::Policy_ptr CORBA::ORB::_create_policy | ( | CORBA::PolicyType | type | ) |
Create an empty policy, usually to be filled in later by demarshaling.
Definition at line 1599 of file ORB.cpp.
{ this->check_shutdown (); TAO::PolicyFactory_Registry_Adapter *adapter = this->orb_core_->policy_factory_registry (); if (adapter == 0) { throw ::CORBA::INTERNAL (); } // Attempt to obtain the policy from the policy factory registry. return adapter->_create_policy (type); }
unsigned long CORBA::ORB::_decr_refcnt | ( | void | ) |
CORBA::ORB_ptr CORBA::ORB::_duplicate | ( | CORBA::ORB_ptr | orb | ) | [static] |
Return a duplicate of orb
.
When work with this duplicate is complete, it should be freed up using CORBA::release().
Definition at line 50 of file ORB.inl.
{ if (obj) { obj->_incr_refcnt (); } return obj; }
unsigned long CORBA::ORB::_incr_refcnt | ( | void | ) |
CORBA::ORB_ptr CORBA::ORB::_nil | ( | void | ) | [static] |
unsigned long CORBA::ORB::_refcnt | ( | void | ) | const |
CORBA::ORB_ptr CORBA::ORB::_tao_make_ORB | ( | TAO_ORB_Core * | orb_core | ) | [static] |
Factory method that creates an ORB.
Definition at line 1069 of file ORB.cpp.
{ CORBA::ORB_ptr orb = CORBA::ORB_ptr (); ACE_NEW_RETURN (orb, CORBA::ORB (orb_core), CORBA::ORB::_nil ()); return orb; }
CORBA::Boolean CORBA::ORB::_use_omg_ior_format | ( | void | ) |
void CORBA::ORB::_use_omg_ior_format | ( | CORBA::Boolean | ior | ) |
void CORBA::ORB::check_shutdown | ( | void | ) | [private] |
Check if ORB has shutdown. If it has, throw the appropriate exception.
Definition at line 1048 of file ORB.cpp.
{ if (this->orb_core () != 0) { this->orb_core ()->check_shutdown (); } else { // If the ORB_Core pointer is zero, assume that the ORB_Core has // been destroyed. // As defined by the CORBA 2.3 specification, throw a // CORBA::OBJECT_NOT_EXIST exception if the ORB has been // destroyed by the time an ORB function is called. throw ::CORBA::OBJECT_NOT_EXIST (0, CORBA::COMPLETED_NO); } }
CORBA::TypeCode_ptr CORBA::ORB::create_abstract_interface_tc | ( | const char * | id, | |
const char * | name | |||
) |
Definition at line 671 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_abstract_interface_tc (id, name); }
CORBA::TypeCode_ptr CORBA::ORB::create_alias_tc | ( | const char * | id, | |
const char * | name, | |||
CORBA::TypeCode_ptr | original_type | |||
) |
Definition at line 464 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_alias_tc (id, name, original_type); }
CORBA::TypeCode_ptr CORBA::ORB::create_array_tc | ( | CORBA::ULong | length, | |
CORBA::TypeCode_ptr | element_type | |||
) |
Definition at line 583 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_array_tc (length, element_type); }
CORBA::TypeCode_ptr CORBA::ORB::create_component_tc | ( | const char * | id, | |
const char * | name | |||
) |
Definition at line 701 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_component_tc (id, name); }
void CORBA::ORB::create_context_list | ( | CORBA::ContextList_ptr & | ctxtlist | ) |
Definition at line 344 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
CORBA::TypeCode_ptr CORBA::ORB::create_enum_tc | ( | const char * | id, | |
const char * | name, | |||
const CORBA::EnumMemberSeq & | members | |||
) |
Definition at line 446 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_enum_tc (id, name, members); }
void CORBA::ORB::create_environment | ( | CORBA::Environment_ptr & | new_env | ) |
Definition at line 297 of file ORB.cpp.
{ ACE_NEW_THROW_EX (environment, CORBA::Environment (), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( 0, ENOMEM), CORBA::COMPLETED_NO)); }
CORBA::TypeCode_ptr CORBA::ORB::create_event_tc | ( | const char * | id, | |
const char * | name, | |||
CORBA::ValueModifier | type_modifier, | |||
CORBA::TypeCode_ptr | concrete_base, | |||
const CORBA::ValueMemberSeq & | members | |||
) |
Definition at line 731 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_event_tc (id, name, type_modifier, concrete_base, members); }
void CORBA::ORB::create_exception_list | ( | CORBA::ExceptionList_ptr & | exclist | ) |
Definition at line 270 of file ORB.cpp.
{ TAO_Dynamic_Adapter *dynamic_adapter = ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance ( TAO_ORB_Core::dynamic_adapter_name ()); dynamic_adapter->create_exception_list (list); }
CORBA::TypeCode_ptr CORBA::ORB::create_exception_tc | ( | const char * | id, | |
const char * | name, | |||
const CORBA::StructMemberSeq & | members | |||
) |
Definition at line 482 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_exception_tc (id, name, members); }
CORBA::TypeCode_ptr CORBA::ORB::create_fixed_tc | ( | CORBA::UShort | digits, | |
CORBA::UShort | scale | |||
) |
Definition at line 549 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_fixed_tc (digits, scale); }
CORBA::TypeCode_ptr CORBA::ORB::create_home_tc | ( | const char * | id, | |
const char * | name | |||
) |
Definition at line 716 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_home_tc (id, name); }
CORBA::TypeCode_ptr CORBA::ORB::create_interface_tc | ( | const char * | id, | |
const char * | name | |||
) |
Definition at line 500 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_interface_tc (id, name); }
void CORBA::ORB::create_list | ( | CORBA::Long | count, | |
CORBA::NVList_ptr & | new_list | |||
) |
Definition at line 252 of file ORB.cpp.
{ TAO_NVList_Adapter *adapter = ACE_Dynamic_Service<TAO_NVList_Adapter>::instance ("TAO_NVList_Adapter"); if (adapter == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("ORB unable to find the ") ACE_TEXT ("NVList Adapter instance"))); throw ::CORBA::INTERNAL (); } adapter->create_list (count, new_list); }
CORBA::TypeCode_ptr CORBA::ORB::create_local_interface_tc | ( | const char * | id, | |
const char * | name | |||
) |
Definition at line 686 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_local_interface_tc (id, name); }
void CORBA::ORB::create_named_value | ( | CORBA::NamedValue_ptr & | nmval | ) |
Definition at line 309 of file ORB.cpp.
{ TAO_NVList_Adapter *adapter = ACE_Dynamic_Service<TAO_NVList_Adapter>::instance ( "TAO_NVList_Adapter"); if (adapter == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("ORB unable to find the ") ACE_TEXT ("NVList Adapter instance"))); throw ::CORBA::INTERNAL (); } adapter->create_named_value (nv); }
CORBA::TypeCode_ptr CORBA::ORB::create_native_tc | ( | const char * | id, | |
const char * | name | |||
) |
Definition at line 641 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_native_tc (id, name); }
void CORBA::ORB::create_operation_list | ( | CORBA::OperationDef_ptr | opDef, | |
CORBA::NVList_ptr & | result | |||
) |
Definition at line 280 of file ORB.cpp.
{ TAO_IFR_Client_Adapter *adapter = ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance ( TAO_ORB_Core::ifr_client_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTF_REPOS (); } adapter->create_operation_list (this, opDef, result); }
CORBA::Policy_ptr CORBA::ORB::create_policy | ( | CORBA::PolicyType | type, | |
const CORBA::Any & | val | |||
) |
Definition at line 1580 of file ORB.cpp.
{ this->check_shutdown (); TAO::PolicyFactory_Registry_Adapter *adapter = this->orb_core_->policy_factory_registry (); if (adapter == 0) { throw ::CORBA::INTERNAL (); } // Attempt to obtain the policy from the policy factory registry. return adapter->create_policy (type, val); }
CORBA::TypeCode_ptr CORBA::ORB::create_recursive_tc | ( | const char * | id | ) |
Definition at line 656 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_recursive_tc (id); }
CORBA::TypeCode_ptr CORBA::ORB::create_sequence_tc | ( | CORBA::ULong | bound, | |
CORBA::TypeCode_ptr | element_type | |||
) |
Definition at line 566 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_sequence_tc (bound, element_type); }
CORBA::TypeCode_ptr CORBA::ORB::create_string_tc | ( | CORBA::ULong | bound | ) |
Definition at line 517 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_string_tc (bound); }
CORBA::TypeCode_ptr CORBA::ORB::create_struct_tc | ( | const char * | id, | |
const char * | name, | |||
const CORBA::StructMemberSeq & | members | |||
) |
The ORB TypeCode creation functions.
Definition at line 406 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_struct_tc (id, name, members); }
CORBA::TypeCode_ptr CORBA::ORB::create_union_tc | ( | const char * | id, | |
const char * | name, | |||
CORBA::TypeCode_ptr | discriminator_type, | |||
const CORBA::UnionMemberSeq & | members | |||
) |
Definition at line 424 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_union_tc (id, name, discriminator_type, members); }
CORBA::TypeCode_ptr CORBA::ORB::create_value_box_tc | ( | const char * | id, | |
const char * | name, | |||
CORBA::TypeCode_ptr | boxed_type | |||
) |
Definition at line 623 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_value_box_tc (id, name, boxed_type); }
CORBA::TypeCode_ptr CORBA::ORB::create_value_tc | ( | const char * | id, | |
const char * | name, | |||
CORBA::ValueModifier | type_modifier, | |||
CORBA::TypeCode_ptr | concrete_base, | |||
const CORBA::ValueMemberSeq & | members | |||
) |
Definition at line 600 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_value_tc (id, name, type_modifier, concrete_base, members); }
CORBA::TypeCode_ptr CORBA::ORB::create_wstring_tc | ( | CORBA::ULong | bound | ) |
Definition at line 533 of file ORB.cpp.
{ TAO_TypeCodeFactory_Adapter *adapter = ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( TAO_ORB_Core::typecodefactory_adapter_name ()); if (adapter == 0) { throw ::CORBA::INTERNAL (); } return adapter->create_wstring_tc (bound); }
void CORBA::ORB::destroy | ( | void | ) |
Explicitly destroy the ORB, releasing any resources. Note that TAO *cannot* implicitly release the resources even if you have destroyed all the references to a particular ORB since CORBA::ORB_init() is required to return the same pointer if called with the same ORBid, only after ORB::destroy() is called it may return a new one.
The results of multi-threaded applications, trying to destroy () the ORB in one thread and trying to service a request in another thread are not well defined. TAO does not support such cases.
Definition at line 148 of file ORB.cpp.
{ if (this->orb_core () == 0) { // If the ORB_Core pointer is zero, assume that the ORB_Core has // been destroyed. // As defined by the CORBA 2.3 specification, throw a // CORBA::OBJECT_NOT_EXIST exception if the ORB has been // destroyed by the time an ORB function is called. throw ::CORBA::OBJECT_NOT_EXIST (0, CORBA::COMPLETED_NO); } if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("CORBA::ORB::destroy() called on ORB <%C>.\n"), this->orb_core ()->orbid ())); } this->orb_core ()->destroy (); // Now invalidate the pointer to the ORB_Core that created this // ORB. this->orb_core_ = 0; }
void CORBA::ORB::get_default_context | ( | CORBA::Context_ptr & | ctx | ) |
Definition at line 354 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
void CORBA::ORB::get_next_response | ( | CORBA::Request_ptr & | req | ) |
Definition at line 384 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
CORBA::Boolean CORBA::ORB::get_service_information | ( | CORBA::ServiceType | service_type, | |
CORBA::ServiceInformation_out | service_information | |||
) |
Definition at line 332 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
ACE_Time_Value * CORBA::ORB::get_timeout | ( | void | ) |
char * CORBA::ORB::id | ( | void | ) |
Return this ORB's ORBid.
Definition at line 1571 of file ORB.cpp.
{ return CORBA::string_dup (this->orb_core_->orbid ()); }
CORBA::Object_ptr CORBA::ORB::ior_string_to_object | ( | const char * | ior | ) | [private] |
Convert an OMG IOR into an object reference.
Definition at line 1622 of file ORB.cpp.
{ // Unhex the bytes, and make a CDR deencapsulation stream from the // resulting data. ACE_Message_Block mb (ACE_OS::strlen (str) / 2 + 1 + ACE_CDR::MAX_ALIGNMENT + 1); ACE_CDR::mb_align (&mb); char *buffer = mb.rd_ptr (); const char *tmp = str; size_t len = 0; while (tmp [0] && tmp [1]) { // Some platforms define 'byte' as a macro, solve the problem // here. #undef byte unsigned char byte; if (!(ACE_OS::ace_isxdigit (tmp [0]) && ACE_OS::ace_isxdigit (tmp [1]))) break; byte = (u_char) (ACE::hex2byte (tmp [0]) << 4); byte |= ACE::hex2byte (tmp [1]); buffer [len++] = byte; tmp += 2; } if (tmp [0] && !ACE_OS::ace_isspace (tmp [0])) { throw ::CORBA::BAD_PARAM (); } // Create deencapsulation stream ... then unmarshal objref from that // stream. int const byte_order = *(mb.rd_ptr ()); mb.rd_ptr (1); mb.wr_ptr (len); TAO_InputCDR stream (&mb, byte_order, TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR, this->orb_core_); CORBA::Object_ptr objref = CORBA::Object::_nil (); stream >> objref; return objref; }
CORBA::ORB::ObjectIdList_ptr CORBA::ORB::list_initial_services | ( | void | ) |
Returns a sequence of ObjectIds that lists which objects have references available via the initial references mechanism.
Definition at line 1040 of file ORB.cpp.
{ this->check_shutdown (); return this->orb_core ()->list_initial_references (); }
CORBA::ValueFactory CORBA::ORB::lookup_value_factory | ( | const char * | repository_id | ) |
Definition at line 1743 of file ORB.cpp.
{ this->check_shutdown (); return this->orb_core_->lookup_value_factory (repository_id); }
char * CORBA::ORB::object_to_string | ( | CORBA::Object_ptr | obj | ) |
Turn an object reference into a string. Each type of ORB, e.g. an IIOP ORB, must implement this. This can be used by servers to publish their whereabouts to clients. The output of this is typically eventually given to string_to_object()
as an argument.
Definition at line 1392 of file ORB.cpp.
{ // This method should not be called if the ORB has been shutdown. this->check_shutdown (); if (!CORBA::is_nil (obj)) { if (!obj->can_convert_to_ior ()) throw ::CORBA::MARSHAL (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); // Allow a user to provide custom object stringification char* user_string = obj->convert_to_ior (this->use_omg_ior_format_, ior_prefix); if (user_string != 0) return user_string; } // Application writer controls what kind of objref strings they get, // maybe along with other things, by how they initialize the ORB. if (use_omg_ior_format_) { // By default, orbs use IOR strings; these are ugly (and error // prone) but specified by CORBA. // // XXX there should be a simple way to reuse this code in other // ORB implementations ... #if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE) char buf [ACE_CDR::DEFAULT_BUFSIZE] = { 0 }; #else // Avoid the initialization overhead if not compiling with // support for a memory profiler. There is no need to actually perform // initialization otherwise. char buf [ACE_CDR::DEFAULT_BUFSIZE]; #endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */ TAO_OutputCDR cdr (buf, sizeof buf, TAO_ENCAP_BYTE_ORDER, this->orb_core_->output_cdr_buffer_allocator (), this->orb_core_->output_cdr_dblock_allocator (), this->orb_core_->output_cdr_msgblock_allocator (), this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR); // There is no translator currently available for stringifying an object // reference, since there is no transport with which to choose an NCS/TCS // pair. // support limited oref ACE_OS::strcmp. (void) ACE_OS::memset (buf, 0, sizeof (buf)); // Marshal the objref into an encapsulation bytestream. (void) cdr.write_octet (TAO_ENCAP_BYTE_ORDER); if (!(cdr << obj)) throw ::CORBA::MARSHAL (); // Now hexify the encapsulated CDR data into a string, and // return that string. size_t const total_len = cdr.total_length (); char *cp = 0; ACE_ALLOCATOR_RETURN (cp, CORBA::string_alloc ( sizeof ior_prefix + 2 * static_cast<CORBA::ULong> (total_len)), 0); CORBA::String_var string = cp; ACE_OS::strcpy (cp, ior_prefix); cp += sizeof (ior_prefix) - 1; for (const ACE_Message_Block *i = cdr.begin (); i != 0; i = i->cont ()) { const char *bytes = i->rd_ptr (); size_t len = i->length (); while (len--) { *cp++ = static_cast<char> (ACE::nibble2hex ((*bytes) >> 4)); *cp++ = static_cast<char> (ACE::nibble2hex (*bytes)); ++bytes; } } // Null terminate the string.. *cp = 0; return string._retn (); } else { // It is perfectly valid to marshal a nil object reference. // However, it is not possible to convert a nil object reference // to a URL IOR, so throw an exception. if (CORBA::is_nil (obj) || obj->_stubobj () == 0) { if (TAO_debug_level > 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Nil object reference or TAO_Stub ") ACE_TEXT ("pointer is zero when converting\n") ACE_TEXT ("object reference to URL IOR.\n"))); throw ::CORBA::MARSHAL ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL), CORBA::COMPLETED_NO); } TAO_MProfile &mp = obj->_stubobj ()->base_profiles (); // Try the profiles until one returns a string for (CORBA::ULong index = 0; index < mp.profile_count(); ++index) { char * result = mp.get_profile (index)->to_string(); if (result) return result; } if (TAO_debug_level > 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - Cannot stringify given ") ACE_TEXT ("object. No or only unknown profiles.\n"))); throw ::CORBA::MARSHAL ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL), CORBA::COMPLETED_NO); } }
TAO_ORB_Core * CORBA::ORB::orb_core | ( | void | ) | const |
void CORBA::ORB::perform_work | ( | ACE_Time_Value & | tv | ) |
Definition at line 203 of file ORB.cpp.
{ this->perform_work (&tv); }
void CORBA::ORB::perform_work | ( | void | ) |
This operation performs an implementation-defined unit of work. Note that the default behavior is to block if the unit of work is not present; this behavior can be modified by passing an appropriate ACE_Time_Value
as described in run().
Definition at line 197 of file ORB.cpp.
{ this->perform_work (0); }
void CORBA::ORB::perform_work | ( | ACE_Time_Value * | tv | ) |
Definition at line 209 of file ORB.cpp.
{ // This method should not be called if the ORB has been shutdown. this->check_shutdown (); this->orb_core ()->run (tv, 1); }
CORBA::Boolean CORBA::ORB::poll_next_response | ( | void | ) |
Definition at line 394 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
void CORBA::ORB::register_initial_reference | ( | const char * | id, | |
CORBA::Object_ptr | obj | |||
) |
Register an object reference with the ORB.
Definition at line 1009 of file ORB.cpp.
{ if (id == 0 || ACE_OS::strlen (id) == 0) throw ::CORBA::ORB::InvalidName (); if (CORBA::is_nil (obj)) throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 27, CORBA::COMPLETED_NO); TAO_Object_Ref_Table &table = this->orb_core_->object_ref_table (); if (table.register_initial_reference (id, obj) == -1) throw ::CORBA::ORB::InvalidName (); }
CORBA::ValueFactory CORBA::ORB::register_value_factory | ( | const char * | repository_id, | |
CORBA::ValueFactory | factory | |||
) |
Definition at line 1722 of file ORB.cpp.
{ this->check_shutdown (); return this->orb_core_->register_value_factory (repository_id, factory); }
CORBA::Object_ptr CORBA::ORB::resolve_initial_references | ( | const char * | name, | |
ACE_Time_Value * | timeout = 0 | |||
) |
This method acts as a mini-bootstrapping Naming Service, which is provided by the ORB for certain well-known object references. TAO supports the "NameService", "TradingService", "RootPOA", "ImplRepo", and "POACurrent" via this method. The timeout
value bounds the amount of time the ORB blocks waiting to resolve the service. This is most useful for bootstrapping remote services, such as the "NameService" or "TradingService", that are commonly resolved via multicast. By default, the value is 0, which means "use the @c
TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT timeout period".
timeout
parameter, TAO will remains compliant with the CORBA resolve_initial_references() specification. Definition at line 863 of file ORB.cpp.
{ // This method should not be called if the ORB has been shutdown. this->check_shutdown (); CORBA::Object_var result; if (ACE_OS::strcmp (name, TAO_OBJID_ROOTPOA) == 0) { result = this->orb_core ()->root_poa (); } else if (ACE_OS::strcmp (name, TAO_OBJID_POACURRENT) == 0) { result = this->orb_core ()->resolve_poa_current (); } else if (ACE_OS::strcmp (name, TAO_OBJID_POLICYMANAGER) == 0) { result = this->resolve_policy_manager (); } else if (ACE_OS::strcmp (name, TAO_OBJID_POLICYCURRENT) == 0) { result = this->resolve_policy_current (); } else if (ACE_OS::strcmp (name, TAO_OBJID_IORMANIPULATION) == 0) { result = this->orb_core ()->resolve_ior_manipulation (); } else if (ACE_OS::strcmp (name, TAO_OBJID_IORTABLE) == 0) { result = this->orb_core ()->resolve_ior_table (); } else if (ACE_OS::strcmp (name, TAO_OBJID_DYNANYFACTORY) == 0) { result = this->orb_core ()->resolve_dynanyfactory (); } else if (ACE_OS::strcmp (name, TAO_OBJID_TYPECODEFACTORY) == 0) { result = this->orb_core ()->resolve_typecodefactory (); } else if (ACE_OS::strcmp (name, TAO_OBJID_CODECFACTORY) == 0) { result = this->orb_core ()->resolve_codecfactory (); } else if (ACE_OS::strcmp (name, TAO_OBJID_COMPRESSIONMANAGER) == 0) { result = this->orb_core ()->resolve_compression_manager (); } else if (ACE_OS::strcmp (name, TAO_OBJID_MONITOR) == 0) { result = this->orb_core ()->resolve_monitor (); } #if TAO_HAS_INTERCEPTORS == 1 else if (ACE_OS::strcmp (name, TAO_OBJID_PICurrent) == 0) { result = this->orb_core ()->resolve_picurrent (); } #endif // ----------------------------------------------------------------- if (CORBA::is_nil (result.in ())) { // Search the object reference table. This search must occur before // the InitRef table search, since it may contain local objects. result = this->orb_core ()->object_ref_table ().resolve_initial_reference (name); } if (!CORBA::is_nil (result.in ())) return result._retn (); // ----------------------------------------------------------------- // Check ORBInitRef options. // @@ There appears to be long standing (i.e. back when the map was // an ACE_Hash_Map_Manager) race condition here since the map // access is not synchronized. // Is the service name in the IOR Table. TAO_ORB_Core::InitRefMap::iterator ior = this->orb_core_->init_ref_map ()->find (ACE_CString (name)); if (ior != this->orb_core_->init_ref_map ()->end ()) return this->string_to_object ((*ior).second.c_str ()); // Look for an environment variable called "<name>IOR". // static const char ior_string[] = "IOR"; CORBA::String_var ior_env_var_name = CORBA::string_alloc ( static_cast<CORBA::ULong> (ACE_OS::strlen (name) + sizeof (ior_string))); ACE_OS::strcpy (ior_env_var_name.inout (), name); ACE_OS::strcat (ior_env_var_name.inout (), ior_string); ACE_CString service_ior = ACE_OS::getenv (ior_env_var_name.in ()); if (ACE_OS::strcmp (service_ior.c_str (), "") != 0) { result = this->string_to_object (service_ior.c_str()); return result._retn (); } // May be trying the explicitly specified services and the well // known services should be tried first before falling on to default // services. // Set the timeout value. this->set_timeout (timeout); if (ACE_OS::strcmp (name, TAO_OBJID_NAMESERVICE) == 0) { this->resolve_service (TAO::MCAST_NAMESERVICE); } else if (ACE_OS::strcmp (name, TAO_OBJID_TRADINGSERVICE) == 0) { this->resolve_service (TAO::MCAST_TRADINGSERVICE); } else if (ACE_OS::strcmp (name, TAO_OBJID_IMPLREPOSERVICE) == 0) { this->resolve_service (TAO::MCAST_IMPLREPOSERVICE); } else if (ACE_OS::strcmp (name, TAO_OBJID_INTERFACEREP) == 0) { this->resolve_service (TAO::MCAST_INTERFACEREPOSERVICE); } // Is not one of the well known services, try to find it in the // InitRef table....check the defaultinitref values also. result = this->orb_core ()->resolve_rir (name); if (!CORBA::is_nil (result.in ())) return result._retn (); // ----------------------------------------------------------------- throw ::CORBA::ORB::InvalidName (); }
CORBA::Object_ptr CORBA::ORB::resolve_policy_current | ( | void | ) | [protected] |
Resolve the Policy Current for this thread.
Definition at line 780 of file ORB.cpp.
{ #if (TAO_HAS_CORBA_MESSAGING == 1) TAO_Policy_Current &policy_current = this->orb_core_->policy_current (); return CORBA::Object::_duplicate (&policy_current); #else return CORBA::Object::_nil (); #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ }
CORBA::Object_ptr CORBA::ORB::resolve_policy_manager | ( | void | ) | [protected] |
Resolve the Policy Manager for this ORB.
Definition at line 759 of file ORB.cpp.
{ #if (TAO_HAS_CORBA_MESSAGING == 1) TAO_Policy_Manager *policy_manager = this->orb_core_->policy_manager (); if (policy_manager == 0) { return CORBA::Object::_nil (); } return CORBA::Object::_duplicate (policy_manager); #else return CORBA::Object::_nil (); #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ }
void CORBA::ORB::resolve_service | ( | TAO::MCAST_SERVICEID | service_id | ) | [private] |
Resolve the given service based on the service ID.
"@c resolve_service" is a legacy name. This method now simply sets up a default initial reference that will be subsequently used in resolve_initial_references().
Definition at line 795 of file ORB.cpp.
{ #if defined ACE_HAS_IP_MULTICAST static char const * const env_service_port[] = { "NameServicePort", "TradingServicePort", "ImplRepoServicePort", "InterfaceRepoServicePort" }; static unsigned short const default_service_port[] = { TAO_DEFAULT_NAME_SERVER_REQUEST_PORT, TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT, TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT, TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT }; // By now, the table filled in with -ORBInitRef arguments has been // checked. We only get here if the table didn't contain an initial // reference for the requested Service. CORBA::String_var default_init_ref = this->orb_core_->orb_params ()->default_init_ref (); static char const mcast_prefix[] = "mcast://:::"; if ((ACE_OS::strncmp (default_init_ref.in (), mcast_prefix, sizeof (mcast_prefix) - 1) == 0)) { // First, determine if the port was supplied on the command line unsigned short port = this->orb_core_->orb_params ()->service_port (mcast_service_id); if (port == 0) { // Look for the port among our environment variables. char const * const port_number = ACE_OS::getenv (env_service_port[mcast_service_id]); if (port_number != 0) port = static_cast<unsigned short> (ACE_OS::atoi (port_number)); else port = default_service_port[mcast_service_id]; } // Set the port value in ORB_Params: modify the default mcast // value. static char const mcast_fmt[] = "mcast://:%d::"; static size_t const PORT_BUF_SIZE = 256; char def_init_ref[PORT_BUF_SIZE] = { 0 }; ACE_OS::snprintf (def_init_ref, PORT_BUF_SIZE, mcast_fmt, port); this->orb_core_->orb_params ()->default_init_ref (def_init_ref); } #else ACE_UNUSED_ARG (mcast_service_id); #endif /* ACE_HAS_IP_MULTICAST */ }
void CORBA::ORB::run | ( | ACE_Time_Value * | tv | ) |
Instructs the ORB to initialize itself and run its event loop in the current thread, not returning until the ORB has shut down or the time value specified through tv has expired. If an error occurs during initialization or at runtime, a CORBA system exception will be thrown. tv is reduced by the amount of time spent in this call. If tv is 0, it means that the timeout is infinite. If tv is ACE_Time_Value::zero
, it specifies to poll and does not block.
If this function is called with tv value, client threads making invocations will continue their operations. When the operation times out and returns, any invocations showing up on the server will be buffered by TCP.
Definition at line 189 of file ORB.cpp.
{ this->check_shutdown (); this->orb_core ()->run (tv, 0); }
void CORBA::ORB::run | ( | void | ) |
void CORBA::ORB::run | ( | ACE_Time_Value & | tv | ) |
Instructs the ORB to initialize itself and run its event loop in the current thread, not returning until the ORB has shut down or the time value specified through tv has expired. If an error occurs during initialization or at runtime, a CORBA system exception will be thrown. tv is reduced by the amount of time spent in this call.
If this function is called with a @ tv value, client threads making invocations will continue their operations. When the operation timesout and returns, any invocations showing up on the server will be buffered by TCP.
Definition at line 183 of file ORB.cpp.
{ this->run (&tv); }
void CORBA::ORB::send_multiple_requests_deferred | ( | const CORBA::RequestSeq & | req | ) |
Definition at line 374 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
void CORBA::ORB::send_multiple_requests_oneway | ( | const CORBA::RequestSeq & | req | ) |
Definition at line 364 of file ORB.cpp.
{ throw ::CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( 0, ENOTSUP), CORBA::COMPLETED_NO); }
void CORBA::ORB::set_timeout | ( | ACE_Time_Value * | timeout | ) | [private] |
void CORBA::ORB::shutdown | ( | CORBA::Boolean | wait_for_completion = false |
) |
This operation instructs the ORB to shut down. Shutting down the ORB causes all Object Adapters to be shut down. If wait_for_completion
parameter is TRUE, this operation blocks until all ORB processing (including request processing and object deactivation or other operations associated with object adapters) has completed.
Definition at line 137 of file ORB.cpp.
{ // We cannot lock the exceptions here. We need to propogate // BAD_INV_ORDER exceptions if needed to the caller. Locking // exceptions down would render us non-compliant with the spec. this->check_shutdown (); this->orb_core ()->shutdown (wait_for_completion); }
CORBA::Object_ptr CORBA::ORB::string_to_object | ( | const char * | str | ) |
Turn a string-ified object reference back into an object pointer. Typically these strings are created using object_to_string(), but not necessarily locally.
Definition at line 1533 of file ORB.cpp.
{ // This method should not be called if the ORB has been shutdown. this->check_shutdown (); // Check for NULL pointer if (str == 0) throw ::CORBA::INV_OBJREF ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL), CORBA::COMPLETED_NO); TAO_IOR_Parser *ior_parser = this->orb_core_->parser_registry ()->match_parser (str); if (ior_parser != 0) { return ior_parser->parse_string (str, this); } if (ACE_OS::strncmp (str, ior_prefix, sizeof ior_prefix - 1) == 0) return this->ior_string_to_object (str + sizeof ior_prefix - 1); else return this->url_ior_string_to_object (str); }
CORBA::Object_ptr CORBA::ORB::unregister_initial_reference | ( | const char * | id | ) |
Unregister an object reference with the ORB.
Definition at line 1024 of file ORB.cpp.
{ if (id == 0 || ACE_OS::strlen (id) == 0) throw ::CORBA::ORB::InvalidName (); TAO_Object_Ref_Table &table = this->orb_core_->object_ref_table (); CORBA::Object_ptr obj = table.unregister_initial_reference (id); if (CORBA::is_nil (obj)) throw ::CORBA::ORB::InvalidName (); return obj; }
void CORBA::ORB::unregister_value_factory | ( | const char * | repository_id | ) |
Definition at line 1733 of file ORB.cpp.
{ this->check_shutdown (); this->orb_core_->unregister_value_factory (repository_id); }
CORBA::Object_ptr CORBA::ORB::url_ior_string_to_object | ( | const char * | ior | ) | [private] |
Convert an URL style IOR into an object reference.
Definition at line 1679 of file ORB.cpp.
{ TAO_MProfile mprofile; // It is safe to declare this on the stack since the contents of // mprofile get copied. No memory is allocated for profile storage // here. The Connector Registry will determine the exact number // of profiles and tell the MProfile object to allocate enough memory // to hold them all. TAO_Connector_Registry *conn_reg = this->orb_core_->connector_registry (); if (conn_reg->make_mprofile (str, mprofile) != 0) { throw ::CORBA::INV_OBJREF ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL), CORBA::COMPLETED_NO); } // Now make the TAO_Stub. TAO_Stub *data = this->orb_core_->create_stub ((char *) 0, mprofile); TAO_Stub_Auto_Ptr safe_objdata (data); // Figure out if the servant is collocated. CORBA::Object_ptr obj = this->orb_core_->create_object (safe_objdata.get ()); if (!CORBA::is_nil (obj)) { // Transfer ownership to the CORBA::Object (void) safe_objdata.release (); } return obj; }
CORBA::Boolean CORBA::ORB::work_pending | ( | ACE_Time_Value & | tv | ) |
Returns an indication of whether the ORB needs to perform some work but will look for work pending for no more than the specified time.
Definition at line 218 of file ORB.cpp.
{ // This method should not be called if the ORB has been shutdown. this->check_shutdown (); int const result = this->orb_core_->reactor ()->work_pending (tv); if (result == 0 || (result == -1 && errno == ETIME)) return false; if (result == -1) throw ::CORBA::INTERNAL (); return true; }
CORBA::Boolean CORBA::ORB::work_pending | ( | void | ) |
Returns an indication of whether the ORB needs to perform some work.
Definition at line 234 of file ORB.cpp.
{ // This method should not be called if the ORB has been shutdown. this->check_shutdown (); const int result = this->orb_core_->reactor ()->work_pending (); if (result == 0) return false; if (result == -1) throw ::CORBA::INTERNAL (); return true; }
CORBA::TypeCode_ptr const CORBA::ORB::_tc_ObjectId [static] |
CORBA::TypeCode_ptr const CORBA::ORB::_tc_ObjectIdList [static] |
TAO_ORB_Core* CORBA::ORB::orb_core_ [private] |
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> CORBA::ORB::refcount_ [private] |
ACE_Time_Value* CORBA::ORB::timeout_ [private] |