1 #include "tao/PortableServer/IdUniquenessStrategyFactoryImpl.h"
2 #include "tao/PortableServer/IdUniquenessStrategy.h"
3 #include "ace/Dynamic_Service.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
9 namespace Portable_Server
12 IdUniquenessStrategyFactoryImpl::create (
13 ::PortableServer::IdUniquenessPolicyValue value
)
15 IdUniquenessStrategy
* strategy
= 0;
18 case ::PortableServer::MULTIPLE_ID
:
21 ACE_Dynamic_Service
<IdUniquenessStrategy
>::instance ("IdUniquenessStrategyMultiple");
24 TAOLIB_ERROR ((LM_ERROR
,
25 ACE_TEXT ("(%P|%t) %p\n"),
26 ACE_TEXT ("ERROR, Unable to get ")
27 ACE_TEXT ("IdUniquenessStrategyMultiple")));
31 case ::PortableServer::UNIQUE_ID
:
33 IdUniquenessStrategyFactory
*strategy_factory
=
34 ACE_Dynamic_Service
<IdUniquenessStrategyFactory
>::instance ("IdUniquenessStrategyUniqueFactory");
36 if (strategy_factory
!= 0)
37 strategy
= strategy_factory
->create (value
);
39 TAOLIB_ERROR ((LM_ERROR
,
40 ACE_TEXT ("(%P|%t) %p\n"),
41 ACE_TEXT ("ERROR, Unable to get ")
42 ACE_TEXT ("IdUniquenessStrategyUniqueFactory")));
52 IdUniquenessStrategyFactoryImpl::destroy (
53 IdUniquenessStrategy
*strategy
)
55 switch (strategy
->type ())
57 case ::PortableServer::MULTIPLE_ID
:
62 case ::PortableServer::UNIQUE_ID
:
64 IdUniquenessStrategyFactory
*strategy_factory
=
65 ACE_Dynamic_Service
<IdUniquenessStrategyFactory
>::instance ("IdUniquenessStrategyUniqueFactory");
67 if (strategy_factory
!= 0)
69 strategy_factory
->destroy (strategy
);
79 ACE_STATIC_SVC_DEFINE (
80 IdUniquenessStrategyFactoryImpl
,
81 ACE_TEXT ("IdUniquenessStrategyFactory"),
83 &ACE_SVC_NAME (IdUniquenessStrategyFactoryImpl
),
84 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
87 ACE_FACTORY_NAMESPACE_DEFINE (
89 IdUniquenessStrategyFactoryImpl
,
90 TAO::Portable_Server::IdUniquenessStrategyFactoryImpl
)
92 TAO_END_VERSIONED_NAMESPACE_DECL