summaryrefslogtreecommitdiff
path: root/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp
blob: 063ec14f9aaa862ad557c5c800870c3e17bea078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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;
}