Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / CSD_Framework / CSD_Strategy_Proxy.cpp
blob0fb2c3b456e275d396cb193434fa88ae98c6157f
1 // -*- C++ -*-
2 #include "tao/CSD_Framework/CSD_Strategy_Proxy.h"
3 #include "tao/TAO_Server_Request.h"
4 #include "tao/debug.h"
6 #if !defined (__ACE_INLINE__)
7 # include "tao/CSD_Framework/CSD_Strategy_Proxy.inl"
8 #endif /* ! __ACE_INLINE__ */
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 bool
13 TAO::CSD::Strategy_Proxy::custom_strategy
14 (CSD_Framework::Strategy_ptr strategy)
16 if (this->strategy_impl_)
18 if (TAO_debug_level > 0)
19 TAOLIB_ERROR((LM_ERROR,
20 ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ")
21 ACE_TEXT("object already has a custom strategy.\n")));
23 return false;
26 if (CORBA::is_nil(strategy))
28 if (TAO_debug_level > 0)
29 TAOLIB_ERROR((LM_ERROR,
30 ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ")
31 ACE_TEXT("supplied with a NIL custom strategy.\n")));
33 return false;
36 // We need to bump up the reference count of the strategy before saving
37 // it off into our handle (smart pointer) data member.
38 this->strategy_ = CSD_Framework::Strategy::_duplicate(strategy);
39 this->strategy_impl_ = dynamic_cast <TAO::CSD::Strategy_Base*> (strategy);
41 return true;
44 TAO_END_VERSIONED_NAMESPACE_DECL