00001
00002
00003 #include "tao/PortableServer/LifespanStrategyTransientFactoryImpl.h"
00004 #include "ace/Dynamic_Service.h"
00005 #include "tao/PortableServer/LifespanStrategyTransient.h"
00006
00007 ACE_RCSID (PortableServer,
00008 LifespanStrategyFactoryImpl,
00009 "LifespanStrategyTransientFactoryImpl.cpp,v 1.7 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 LifespanStrategy*
00018 LifespanStrategyTransientFactoryImpl::create (
00019 ::PortableServer::LifespanPolicyValue value)
00020 {
00021 LifespanStrategy* strategy = 0;
00022
00023 switch (value)
00024 {
00025 case ::PortableServer::PERSISTENT :
00026 {
00027 ACE_ERROR ((LM_ERROR, "Incorrect type in LifespanStrategyTransientFactoryImpl"));
00028 break;
00029 }
00030 case ::PortableServer::TRANSIENT :
00031 {
00032 ACE_NEW_RETURN (strategy, LifespanStrategyTransient, 0);
00033 break;
00034 }
00035 }
00036
00037 return strategy;
00038 }
00039
00040 void
00041 LifespanStrategyTransientFactoryImpl::destroy (
00042 LifespanStrategy *strategy
00043 ACE_ENV_ARG_DECL)
00044 {
00045 strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
00046 ACE_CHECK;
00047
00048 delete strategy;
00049 }
00050 }
00051 }
00052
00053 TAO_END_VERSIONED_NAMESPACE_DECL
00054
00055 ACE_STATIC_SVC_DEFINE (
00056 LifespanStrategyTransientFactoryImpl,
00057 ACE_TEXT ("LifespanStrategyTransientFactory"),
00058 ACE_SVC_OBJ_T,
00059 &ACE_SVC_NAME (LifespanStrategyTransientFactoryImpl),
00060 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00061 0)
00062
00063 ACE_FACTORY_NAMESPACE_DEFINE (
00064 ACE_Local_Service,
00065 LifespanStrategyTransientFactoryImpl,
00066 TAO::Portable_Server::LifespanStrategyTransientFactoryImpl)
00067
00068