LifespanStrategyPersistentFactoryImpl.cpp

Go to the documentation of this file.
00001 // LifespanStrategyPersistentFactoryImpl.cpp,v 1.7 2006/03/10 07:19:13 jtc Exp
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            "LifespanStrategyPersistentFactoryImpl.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     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 (
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   LifespanStrategyPersistentFactoryImpl,
00057   ACE_TEXT ("LifespanStrategyPersistentFactory"),
00058   ACE_SVC_OBJ_T,
00059   &ACE_SVC_NAME (LifespanStrategyPersistentFactoryImpl),
00060   ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00061   0)
00062 
00063 ACE_FACTORY_NAMESPACE_DEFINE (
00064   ACE_Local_Service,
00065   LifespanStrategyPersistentFactoryImpl,
00066   TAO::Portable_Server::LifespanStrategyPersistentFactoryImpl)
00067 

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