summaryrefslogtreecommitdiff
path: root/TAO/tao/Messaging_PolicyFactory.cpp
blob: c690dd04ebb4bc70f694bf35353e27e1803ab34f (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// -*- C++ -*-
//
// $Id$

#include "tao/Messaging_PolicyFactory.h"

ACE_RCSID (tao, Messaging_PolicyFactory, "$Id$")

#if TAO_HAS_CORBA_MESSAGING == 1

#include "tao/PolicyC.h"
#include "tao/Messaging_Policy_i.h"
#include "tao/Buffering_Constraint_Policy.h"
#include "tao/Client_Priority_Policy.h"

CORBA::Policy_ptr
TAO_Messaging_PolicyFactory::create_policy (
    CORBA::PolicyType type,
    const CORBA::Any &value
    TAO_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   CORBA::PolicyError))
{
  TAO_ENV_ARG_DEFN;

  switch (type)
    {

#if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)

  case TAO_MESSAGING_RELATIVE_RT_TIMEOUT_POLICY_TYPE:
      return TAO_RelativeRoundtripTimeoutPolicy::create (
               value
               TAO_ENV_ARG_PARAMETER);

#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */

#if (TAO_HAS_CLIENT_PRIORITY_POLICY == 1)

    case TAO_CLIENT_PRIORITY_POLICY_TYPE:
      return TAO_Client_Priority_Policy::create (value
                                                 TAO_ENV_ARG_PARAMETER);

#endif /* TAO_HAS_CLIENT_PRIORITY_POLICY == 1 */

    case TAO_MESSAGING_SYNC_SCOPE_POLICY_TYPE:
      return TAO_Sync_Scope_Policy::create (value
                                            TAO_ENV_ARG_PARAMETER);

#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)

    case TAO_BUFFERING_CONSTRAINT_POLICY_TYPE:
      return TAO_Buffering_Constraint_Policy::create (value
                                                      TAO_ENV_ARG_PARAMETER);

#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */

    case TAO_MESSAGING_REBIND_POLICY_TYPE:
    case TAO_MESSAGING_REQUEST_PRIORITY_POLICY_TYPE:
    case TAO_MESSAGING_REPLY_PRIORITY_POLICY_TYPE:
    case TAO_MESSAGING_REQUEST_START_TIME_POLICY_TYPE:
    case TAO_MESSAGING_REQUEST_END_TIME_POLICY_TYPE:
    case TAO_MESSAGING_REPLY_START_TIME_POLICY_TYPE:
    case TAO_MESSAGING_REPLY_END_TIME_POLICY_TYPE:
    case TAO_MESSAGING_RELATIVE_REQ_TIMEOUT_POLICY_TYPE:
    case TAO_MESSAGING_ROUTING_POLICY_TYPE:
    case TAO_MESSAGING_MAX_HOPS_POLICY_TYPE:
    case TAO_MESSAGING_QUEUE_ORDER_POLICY_TYPE:
      ACE_THROW_RETURN (CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY),
                        CORBA::Policy::_nil ());

    default:
      break;
    }

  ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
                    CORBA::Policy::_nil ());
}

#endif  /* TAO_HAS_CORBA_MESSAGING == 1 */