Policy_Validator.cpp

Go to the documentation of this file.
00001 // $Id: Policy_Validator.cpp 76687 2007-01-29 19:18:13Z johnnyw $
00002 
00003 #include "tao/Policy_Validator.h"
00004 #include "tao/debug.h"
00005 
00006 #include "ace/Log_Msg.h"
00007 
00008 ACE_RCSID (tao,
00009            Policy_Validator,
00010            "$Id: Policy_Validator.cpp 76687 2007-01-29 19:18:13Z johnnyw $")
00011 
00012 
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014 
00015 TAO_Policy_Validator::TAO_Policy_Validator (TAO_ORB_Core &orb_core)
00016   : orb_core_ (orb_core),
00017     next_ (0)
00018 {
00019 }
00020 
00021 TAO_Policy_Validator::~TAO_Policy_Validator (void)
00022 {
00023   delete this->next_;
00024 }
00025 
00026 TAO_ORB_Core &
00027 TAO_Policy_Validator::orb_core() const
00028 {
00029   return this->orb_core_;
00030 }
00031 
00032 void
00033 TAO_Policy_Validator::add_validator (TAO_Policy_Validator *validator)
00034 {
00035   // The validator we're adding can't be part of another list
00036   ACE_ASSERT (validator->next_ == 0);
00037 
00038   // Why would we want to add ourself to our list
00039   if (this != validator)
00040     {
00041       // Get to the end of the list and make sure that the
00042       // new validator isn't already part of our list
00043       TAO_Policy_Validator* current = this;
00044       while (current->next_ != 0)
00045         {
00046           if (current->next_ == validator)
00047             {
00048               if (TAO_debug_level > 3)
00049                 {
00050                   ACE_DEBUG ((LM_DEBUG,
00051                               ACE_TEXT ("(%P|%t) Skipping validator [0x%x] ")
00052                               ACE_TEXT ("since it would create a circular list\n"),
00053                               validator));
00054                 }
00055 
00056               return;
00057             }
00058           current = current->next_;
00059         }
00060 
00061       // Add the new validator to the end of the list
00062       current->next_ = validator;
00063     }
00064 }
00065 
00066 
00067 void
00068 TAO_Policy_Validator::validate (TAO_Policy_Set &policies)
00069 {
00070   this->validate_impl (policies);
00071 
00072   if (this->next_ != 0)
00073     {
00074       this->next_->validate (policies);
00075     }
00076 }
00077 
00078 void
00079 TAO_Policy_Validator::merge_policies (TAO_Policy_Set &policies)
00080 {
00081   this->merge_policies_impl (policies);
00082 
00083   if (this->next_)
00084     {
00085       this->next_->merge_policies (policies);
00086     }
00087 }
00088 
00089 CORBA::Boolean
00090 TAO_Policy_Validator::legal_policy (CORBA::PolicyType type)
00091 {
00092   return (this->legal_policy_impl (type)
00093           || ((this->next_ != 0)
00094               && this->next_->legal_policy_impl (type)));
00095 }
00096 
00097 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7