summaryrefslogtreecommitdiff
path: root/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.cpp
blob: 8dcdeb2b34178e14343d6b3de42fd5f6abfcd467 (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
#include "BiDirPolicy_Validator.h"
#include "BiDir_Policy_i.h"
#include "tao/Policy_Set.h"
#include "tao/ORB_Core.h"

ACE_RCSID (TAO, 
           BiDirPolicy_Validator, 
           "$Id$")

TAO_BiDirPolicy_Validator::TAO_BiDirPolicy_Validator (TAO_ORB_Core &orb_core)
  : TAO_Policy_Validator (orb_core)
{
}


void
TAO_BiDirPolicy_Validator::validate_impl (TAO_Policy_Set &policies
                                          ACE_ENV_ARG_DECL)
{
  CORBA::Policy_var policy =
    policies.get_cached_policy (TAO_CACHED_POLICY_BIDIRECTIONAL_GIOP
                                ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  if (policy.in () == 0)
    return;

  BiDirPolicy::BidirectionalPolicy_var srp =
    BiDirPolicy::BidirectionalPolicy::_narrow (policy.in ()
                                               ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  if (srp.in () == 0)
    return;

  BiDirPolicy::BidirectionalPolicyValue val =
    srp->value (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK;

  // Set the flag in the ORB_Core
  if (val == BiDirPolicy::BOTH)
    orb_core_.bidir_giop_policy (1);
}

void
TAO_BiDirPolicy_Validator::merge_policies_impl (TAO_Policy_Set & /*policies*/
                                                ACE_ENV_ARG_DECL_NOT_USED)
{
  return ;
}

CORBA::Boolean
TAO_BiDirPolicy_Validator::legal_policy_impl (CORBA::PolicyType type)
{
  return (type == BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE);
}