IdAssignmentStrategyFactoryImpl.cpp

Go to the documentation of this file.
00001 // $Id: IdAssignmentStrategyFactoryImpl.cpp 76616 2007-01-25 23:49:35Z parsons $
00002 
00003 #include "tao/PortableServer/IdAssignmentStrategyFactoryImpl.h"
00004 #include "tao/PortableServer/IdAssignmentStrategy.h"
00005 #include "ace/Dynamic_Service.h"
00006 
00007 ACE_RCSID (PortableServer,
00008            IdAssignmentStrategyFactoryImpl,
00009            "$Id: IdAssignmentStrategyFactoryImpl.cpp 76616 2007-01-25 23:49:35Z parsons $")
00010 
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012 
00013 namespace TAO
00014 {
00015   namespace Portable_Server
00016   {
00017     IdAssignmentStrategy *
00018     IdAssignmentStrategyFactoryImpl::create (
00019       ::PortableServer::IdAssignmentPolicyValue value)
00020     {
00021       IdAssignmentStrategy *strategy = 0;
00022       const char *strategy_name = 0;
00023 
00024       switch (value)
00025       {
00026         case ::PortableServer::SYSTEM_ID :
00027         {
00028           strategy_name = "IdAssignmentStrategySystem";
00029           break;
00030         }
00031         case ::PortableServer::USER_ID :
00032         {
00033           strategy_name = "IdAssignmentStrategyUser";
00034           break;
00035         }
00036       }
00037 
00038       strategy =
00039         ACE_Dynamic_Service <IdAssignmentStrategy>::instance (strategy_name);
00040 
00041       if (strategy == 0)
00042         ACE_ERROR ((LM_ERROR,
00043                    ACE_TEXT ("(%P|%t) ERROR, Unable to get %s\n"),
00044                    strategy_name));
00045 
00046       return strategy;
00047     }
00048 
00049     void
00050     IdAssignmentStrategyFactoryImpl::destroy (IdAssignmentStrategy *)
00051     {
00052       // Noop because both types are singletons
00053     }
00054 
00055   }
00056 }
00057 
00058 TAO_END_VERSIONED_NAMESPACE_DECL
00059 
00060 ACE_STATIC_SVC_DEFINE (
00061   IdAssignmentStrategyFactoryImpl,
00062   ACE_TEXT ("IdAssignmentStrategyFactory"),
00063   ACE_SVC_OBJ_T,
00064   &ACE_SVC_NAME (IdAssignmentStrategyFactoryImpl),
00065   ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00066   0)
00067 
00068 ACE_FACTORY_NAMESPACE_DEFINE (
00069   ACE_Local_Service,
00070   IdAssignmentStrategyFactoryImpl,
00071   TAO::Portable_Server::IdAssignmentStrategyFactoryImpl)

Generated on Tue Feb 2 17:40:54 2010 for TAO_PortableServer by  doxygen 1.4.7