IdAssignmentStrategyFactoryImpl.cpp

Go to the documentation of this file.
00001 // IdAssignmentStrategyFactoryImpl.cpp,v 1.9 2006/03/10 07:19:13 jtc Exp
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            "IdAssignmentStrategyFactoryImpl.cpp,v 1.9 2006/03/10 07:19:13 jtc Exp")
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 (
00051       IdAssignmentStrategy * /*strategy*/
00052       ACE_ENV_ARG_DECL_NOT_USED)
00053     {
00054       // Noop because both types are singletons
00055     }
00056 
00057   }
00058 }
00059 
00060 TAO_END_VERSIONED_NAMESPACE_DECL
00061 
00062 ACE_STATIC_SVC_DEFINE (
00063   IdAssignmentStrategyFactoryImpl,
00064   ACE_TEXT ("IdAssignmentStrategyFactory"),
00065   ACE_SVC_OBJ_T,
00066   &ACE_SVC_NAME (IdAssignmentStrategyFactoryImpl),
00067   ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00068   0)
00069 
00070 ACE_FACTORY_NAMESPACE_DEFINE (
00071   ACE_Local_Service,
00072   IdAssignmentStrategyFactoryImpl,
00073   TAO::Portable_Server::IdAssignmentStrategyFactoryImpl)

Generated on Thu Nov 9 12:40:38 2006 for TAO_PortableServer by doxygen 1.3.6