TAO::details Namespace Reference


Classes

struct  array_traits
struct  bounded_array_allocation_traits
struct  bounded_reference_allocation_traits
struct  bounded_value_allocation_traits
class  generic_sequence
class  object_reference_const_sequence_element
class  object_reference_sequence_element
struct  object_reference_traits_base
struct  object_reference_traits_decorator
struct  object_reference_traits
struct  range_checking
 Configurable traits to tradeoff safety vs. performance in the implementation of TAO sequences. More...
class  string_const_sequence_element
class  string_sequence_element
struct  string_traits_base
struct  string_traits_base< char >
struct  string_traits_decorator
struct  string_traits
struct  unbounded_array_allocation_traits
struct  unbounded_reference_allocation_traits
struct  unbounded_value_allocation_traits
struct  value_traits
struct  string_traits_base< CORBA::WChar >

Functions

template<typename T>
int load_protocol_factory (TAO_ProtocolFactorySet &protocol_set, const char *name)


Function Documentation

template<typename T>
int TAO::details::load_protocol_factory ( TAO_ProtocolFactorySet protocol_set,
const char *  name 
)

Definition at line 32 of file Load_Protocol_Factory_T.h.

References ACE_AUTO_PTR_RESET, ACE_DEBUG, ACE_ERROR, ACE_NEW_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_String_Base< CHAR >::c_str(), TAO_Protocol_Item::factory(), ACE_Unbounded_Set_Ex< T, C >::insert(), ACE_Dynamic_Service< TYPE >::instance(), LM_DEBUG, LM_ERROR, LM_WARNING, TAO_Protocol_Item::protocol_name(), ACE_Auto_Basic_Ptr< X >::release(), and TAO_debug_level.

00034     {
00035       TAO_Protocol_Factory *protocol_factory = 0;
00036       auto_ptr<TAO_Protocol_Factory> safe_protocol_factory;
00037 
00038       TAO_Protocol_Item *item = 0;
00039 
00040       // If a protocol factory is obtained from the Service
00041       // Configurator then do not transfer ownership to the
00042       // TAO_Protocol_Item.
00043       bool transfer_ownership = false;
00044 
00045       protocol_factory =
00046         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (
00047           ACE_TEXT_CHAR_TO_TCHAR (name));
00048 
00049       if (protocol_factory == 0)
00050         {
00051           if (TAO_debug_level > 0)
00052             ACE_ERROR ((LM_WARNING,
00053                         ACE_TEXT("(%P|%t) WARNING - No <%C> found in Service")
00054                         ACE_TEXT(" Repository. Using default instance.\n"),
00055                         name));
00056 
00057           ACE_NEW_RETURN (protocol_factory,
00058                           T,
00059                           -1);
00060 
00061           ACE_AUTO_PTR_RESET (safe_protocol_factory,
00062                               protocol_factory,
00063                               TAO_Protocol_Factory);
00064 
00065           transfer_ownership = true;
00066         }
00067       else
00068         {
00069           transfer_ownership = false;
00070         }
00071 
00072       ACE_NEW_RETURN (item, TAO_Protocol_Item (name), -1);
00073       // If the TAO_Protocol_Item retains ownership of the
00074       // TAO_Protocol_Factory then we used an auto_ptr<> above, so
00075       // release the TAO_Protocol_Factory from it.  Otherwise, we
00076       // obtained the TAO_Protocol_Factory from the Service
00077       // Configurator so an auto_ptr<> wasn't used since the Service
00078       // Configurator retains ownership, hence there was no need to
00079       // use an auto_ptr<> in this method.
00080       item->factory ((transfer_ownership ?
00081                       safe_protocol_factory.release () :
00082                       protocol_factory),
00083                       transfer_ownership);
00084 
00085       if (protocol_set.insert (item) == -1)
00086         {
00087           ACE_ERROR ((LM_ERROR,
00088                       ACE_TEXT("TAO (%P|%t) Unable to add ")
00089                       ACE_TEXT("<%C> to protocol factory set.\n"),
00090                       item->protocol_name ().c_str ()));
00091 
00092           delete item;
00093 
00094           if (transfer_ownership == false)
00095             delete protocol_factory;
00096 
00097           return -1;
00098         }
00099 
00100       if (TAO_debug_level > 0)
00101         {
00102           ACE_DEBUG ((LM_DEBUG,
00103                       ACE_TEXT("TAO (%P|%t) Loaded default ")
00104                       ACE_TEXT("protocol <%C>\n"),
00105                       name));
00106         }
00107 
00108       return 0;
00109     }


Generated on Tue Feb 2 17:39:58 2010 for TAO by  doxygen 1.4.7