diff options
Diffstat (limited to 'trunk/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp')
-rw-r--r-- | trunk/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/trunk/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp b/trunk/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp new file mode 100644 index 00000000000..b163134be56 --- /dev/null +++ b/trunk/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp @@ -0,0 +1,50 @@ +// $Id$ + +#include "tao/CSD_Framework/CSD_Strategy_Proxy.h" +#include "tao/TAO_Server_Request.h" +#include "tao/debug.h" + +ACE_RCSID (CSD_Framework, + CSD_Strategy_Base, + "$Id$") + + +#if !defined (__ACE_INLINE__) +# include "tao/CSD_Framework/CSD_Strategy_Proxy.inl" +#endif /* ! __ACE_INLINE__ */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +bool +TAO::CSD::Strategy_Proxy::custom_strategy + (CSD_Framework::Strategy_ptr strategy) +{ + if (this->strategy_impl_) + { + if (TAO_debug_level > 0) + ACE_ERROR((LM_ERROR, + ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ") + ACE_TEXT("object already has a custom strategy.\n"))); + + return false; + } + + if (CORBA::is_nil(strategy)) + { + if (TAO_debug_level > 0) + ACE_ERROR((LM_ERROR, + ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ") + ACE_TEXT("supplied with a NIL custom strategy.\n"))); + + return false; + } + + // We need to bump up the reference count of the strategy before saving + // it off into our handle (smart pointer) data member. + this->strategy_ = CSD_Framework::Strategy::_duplicate(strategy); + this->strategy_impl_ = dynamic_cast <TAO::CSD::Strategy_Base*> (strategy); + + return true; +} + +TAO_END_VERSIONED_NAMESPACE_DECL |