Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / ZIOP / ZIOP_Policy_Validator.cpp
blobd2dffe0ecfe1225d598da1fd45ab1660595994a6
1 #include "tao/ZIOP/ZIOP_Policy_Validator.h"
3 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
5 #include "tao/ZIOP/ZIOP_Policy_i.h"
6 #include "tao/Policy_Set.h"
7 #include "tao/ORB_Core.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 TAO_ZIOPPolicy_Validator::TAO_ZIOPPolicy_Validator (TAO_ORB_Core &orb_core)
12 : TAO_Policy_Validator (orb_core)
17 void
18 TAO_ZIOPPolicy_Validator::validate_impl (TAO_Policy_Set & /*policies*/)
22 void
23 TAO_ZIOPPolicy_Validator::merge_policies_impl (TAO_Policy_Set &policies)
25 // Check if the user has specified the compression enabled policy.
26 CORBA::Policy_var compression_enabled =
27 policies.get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY);
29 if (CORBA::is_nil (compression_enabled.in ()))
31 // If not, check if the compression enabled policy has been specified
32 // at the ORB level.
33 compression_enabled =
34 this->orb_core_.get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY);
36 if (!CORBA::is_nil (compression_enabled.in ()))
38 // If so, we'll use that policy.
39 policies.set_policy (compression_enabled.in ());
43 // Check if the user has specified the compression low value policy.
44 CORBA::Policy_var low_value_policy =
45 policies.get_cached_policy (TAO_CACHED_COMPRESSION_LOW_VALUE_POLICY);
47 if (CORBA::is_nil (low_value_policy.in ()))
49 // If not, check if the compression low value policy has been
50 // specified at the ORB level.
51 low_value_policy =
52 this->orb_core_.get_cached_policy (TAO_CACHED_COMPRESSION_LOW_VALUE_POLICY);
54 if (!CORBA::is_nil (low_value_policy.in ()))
56 // If so, we'll use that policy.
57 policies.set_policy (low_value_policy.in ());
61 // Check if the user has specified the minimum compression ratio policy.
62 CORBA::Policy_var min_ratio_policy =
63 policies.get_cached_policy (TAO_CACHED_MIN_COMPRESSION_RATIO_POLICY);
65 if (CORBA::is_nil (min_ratio_policy.in ()))
67 // If not, check if the minimum compression ratio policy has been
68 // specified at the ORB level.
69 min_ratio_policy =
70 this->orb_core_.get_cached_policy (TAO_CACHED_MIN_COMPRESSION_RATIO_POLICY);
72 if (!CORBA::is_nil (min_ratio_policy.in ()))
74 // If so, we'll use that policy.
75 policies.set_policy (min_ratio_policy.in ());
79 // Check if the user has specified the compression list policy.
80 CORBA::Policy_var compressior_list_policy =
81 policies.get_cached_policy (TAO_CACHED_COMPRESSION_ID_LEVEL_LIST_POLICY);
83 if (CORBA::is_nil (compressior_list_policy.in ()))
85 // If not, check if the compression list policy has been
86 // specified at the ORB level.
87 compressior_list_policy =
88 this->orb_core_.get_cached_policy (TAO_CACHED_COMPRESSION_ID_LEVEL_LIST_POLICY);
90 if (!CORBA::is_nil (compressior_list_policy.in ()))
92 // If so, we'll use that policy.
93 policies.set_policy (compressior_list_policy.in ());
98 CORBA::Boolean
99 TAO_ZIOPPolicy_Validator::legal_policy_impl (CORBA::PolicyType type)
101 return (type == ZIOP::COMPRESSION_ENABLING_POLICY_ID ||
102 type == ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID ||
103 type == ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID ||
104 type == ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID);
107 TAO_END_VERSIONED_NAMESPACE_DECL
109 #endif