diff options
author | dai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-10-19 00:27:51 +0000 |
---|---|---|
committer | dai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-10-19 00:27:51 +0000 |
commit | b29e5800752ecefbe4e9317ac908e40d9c6eded0 (patch) | |
tree | 3bdec835860a692ca76bdcd5baa5f069645bf248 /TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp | |
parent | 189f1baf20ea719b1724adef186b8699706eb065 (diff) | |
download | ATCD-b29e5800752ecefbe4e9317ac908e40d9c6eded0.tar.gz |
Tue Oct 18 17:24:26 MST 2005 Yan Dai <dai_y@ociweb.com>
Diffstat (limited to 'TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp')
-rw-r--r-- | TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp new file mode 100644 index 00000000000..063ec14f9aa --- /dev/null +++ b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp @@ -0,0 +1,47 @@ +// $Id$ + +#include "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 "CSD_Strategy_Proxy.inl" +#endif /* ! __ACE_INLINE__ */ + + +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; +} |