Updated logging to include the class/method so that it is more obvious where these...
[ACE_TAO.git] / TAO / tao / PortableServer / IdUniquenessStrategyFactoryImpl.cpp
blobf215d512ae136593cc734320fb9e1787663630c8
1 #include "tao/PortableServer/IdUniquenessStrategyFactoryImpl.h"
2 #include "tao/PortableServer/IdUniquenessStrategy.h"
3 #include "ace/Dynamic_Service.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 namespace TAO
9 namespace Portable_Server
11 IdUniquenessStrategy*
12 IdUniquenessStrategyFactoryImpl::create (
13 ::PortableServer::IdUniquenessPolicyValue value)
15 IdUniquenessStrategy* strategy = 0;
16 switch (value)
18 case ::PortableServer::MULTIPLE_ID :
20 strategy =
21 ACE_Dynamic_Service<IdUniquenessStrategy>::instance ("IdUniquenessStrategyMultiple");
23 if (strategy == 0)
24 TAOLIB_ERROR ((LM_ERROR,
25 ACE_TEXT ("(%P|%t) %p\n"),
26 ACE_TEXT ("ERROR, Unable to get ")
27 ACE_TEXT ("IdUniquenessStrategyMultiple")));
29 break;
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);
38 else
39 TAOLIB_ERROR ((LM_ERROR,
40 ACE_TEXT ("(%P|%t) %p\n"),
41 ACE_TEXT ("ERROR, Unable to get ")
42 ACE_TEXT ("IdUniquenessStrategyUniqueFactory")));
44 break;
48 return strategy;
51 void
52 IdUniquenessStrategyFactoryImpl::destroy (
53 IdUniquenessStrategy *strategy)
55 switch (strategy->type ())
57 case ::PortableServer::MULTIPLE_ID :
59 // Noop
60 break;
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);
71 break;
79 ACE_STATIC_SVC_DEFINE (
80 IdUniquenessStrategyFactoryImpl,
81 ACE_TEXT ("IdUniquenessStrategyFactory"),
82 ACE_SVC_OBJ_T,
83 &ACE_SVC_NAME (IdUniquenessStrategyFactoryImpl),
84 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
87 ACE_FACTORY_NAMESPACE_DEFINE (
88 ACE_Local_Service,
89 IdUniquenessStrategyFactoryImpl,
90 TAO::Portable_Server::IdUniquenessStrategyFactoryImpl)
92 TAO_END_VERSIONED_NAMESPACE_DECL