Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Policy_Validator.cpp
blobf9e7e6ca05a6166cb899c033372899b594cb56f4
1 #include "tao/Policy_Validator.h"
2 #include "tao/debug.h"
3 #include "ace/Log_Msg.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 TAO_Policy_Validator::TAO_Policy_Validator (TAO_ORB_Core &orb_core)
8 : orb_core_ (orb_core),
9 next_ (nullptr)
13 TAO_Policy_Validator::~TAO_Policy_Validator ()
15 delete this->next_;
18 TAO_ORB_Core &
19 TAO_Policy_Validator::orb_core() const
21 return this->orb_core_;
24 void
25 TAO_Policy_Validator::add_validator (TAO_Policy_Validator *validator)
27 // The validator we're adding can't be part of another list
28 ACE_ASSERT (validator->next_ == nullptr);
30 // Why would we want to add ourself to our list
31 if (this != validator)
33 // Get to the end of the list and make sure that the
34 // new validator isn't already part of our list
35 TAO_Policy_Validator* current = this;
36 while (current->next_ != nullptr)
38 if (current->next_ == validator)
40 if (TAO_debug_level > 3)
42 TAOLIB_DEBUG ((LM_DEBUG,
43 ACE_TEXT ("(%P|%t) Skipping validator [%@] ")
44 ACE_TEXT ("since it would create a circular list\n"),
45 validator));
48 return;
50 current = current->next_;
53 // Add the new validator to the end of the list
54 current->next_ = validator;
58 void
59 TAO_Policy_Validator::validate (TAO_Policy_Set &policies)
61 this->validate_impl (policies);
63 if (this->next_ != nullptr)
65 this->next_->validate (policies);
69 void
70 TAO_Policy_Validator::merge_policies (TAO_Policy_Set &policies)
72 this->merge_policies_impl (policies);
74 if (this->next_)
76 this->next_->merge_policies (policies);
80 CORBA::Boolean
81 TAO_Policy_Validator::legal_policy (CORBA::PolicyType type)
83 return (this->legal_policy_impl (type)
84 || ((this->next_ != nullptr)
85 && this->next_->legal_policy_impl (type)));
88 TAO_END_VERSIONED_NAMESPACE_DECL