Go to the documentation of this file.00001
00002
00003 #include "tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h"
00004 #include "ace/Dynamic_Service.h"
00005 #include "tao/PortableServer/LifespanStrategyPersistent.h"
00006
00007 ACE_RCSID (PortableServer,
00008 LifespanStrategyFactoryImpl,
00009 "$Id: LifespanStrategyPersistentFactoryImpl.cpp 84281 2009-01-30 15:01:17Z wotte $")
00010
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012
00013 namespace TAO
00014 {
00015 namespace Portable_Server
00016 {
00017 LifespanStrategy*
00018 LifespanStrategyPersistentFactoryImpl::create (
00019 ::PortableServer::LifespanPolicyValue value)
00020 {
00021 LifespanStrategy* strategy = 0;
00022
00023 switch (value)
00024 {
00025 case ::PortableServer::PERSISTENT :
00026 {
00027 ACE_NEW_RETURN (strategy, LifespanStrategyPersistent, 0);
00028 break;
00029 }
00030 case ::PortableServer::TRANSIENT :
00031 {
00032 ACE_ERROR ((LM_ERROR, "Incorrect type in LifespanStrategyPersistentFactoryImpl"));
00033 break;
00034 }
00035 }
00036
00037 return strategy;
00038 }
00039
00040 void
00041 LifespanStrategyPersistentFactoryImpl::destroy (LifespanStrategy *strategy)
00042 {
00043 strategy->strategy_cleanup ();
00044
00045 delete strategy;
00046 }
00047 }
00048 }
00049
00050
00051 ACE_STATIC_SVC_DEFINE (
00052 LifespanStrategyPersistentFactoryImpl,
00053 ACE_TEXT ("LifespanStrategyPersistentFactory"),
00054 ACE_SVC_OBJ_T,
00055 &ACE_SVC_NAME (LifespanStrategyPersistentFactoryImpl),
00056 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00057 0)
00058
00059 ACE_FACTORY_NAMESPACE_DEFINE (
00060 ACE_Local_Service,
00061 LifespanStrategyPersistentFactoryImpl,
00062 TAO::Portable_Server::LifespanStrategyPersistentFactoryImpl)
00063
00064 TAO_END_VERSIONED_NAMESPACE_DECL