Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Policy_Validator.h
blob8b26beb62f35f431789a3c909eba078306976112
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Policy_Validator.h
7 * This file contains the declaration for the POA policy validator
8 * interface.
10 * @author Angelo Corsaro <corsaro@cs.wustl.edu>
11 * @author Frank Hunleth <fhuntleth@cs.wustl.edu>
13 //=============================================================================
15 #ifndef TAO_POLICY_VALIDATOR_H
16 #define TAO_POLICY_VALIDATOR_H
18 #include /**/ "ace/pre.h"
20 #include "tao/Basic_Types.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 # pragma once
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include /**/ "tao/TAO_Export.h"
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
30 // Forward declarations.
31 class TAO_Policy_Set;
32 class TAO_ORB_Core;
34 namespace CORBA
36 typedef ULong PolicyType;
39 /**
40 * @class TAO_Policy_Validator
42 * @brief An abstract class for plugging in different Policy Validator
43 * mechanisms.
45 * This class was moved from the PortableServer library. The Portable
46 * Serever library used this abstraction to add policy validators to
47 * for the policies in the POA. This class seems so much useful for
48 * passing policy information between different loaded libraries.
50 class TAO_Export TAO_Policy_Validator
52 public:
53 /// Constructor.
54 TAO_Policy_Validator (TAO_ORB_Core &orb_core);
56 /// Destructor.
57 virtual ~TAO_Policy_Validator ();
59 /**
60 * Validate that the policies in the specified set
61 * are consistent and legal. Throw an appropriate exception
62 * if that is not the case.
64 void validate (TAO_Policy_Set &policies);
66 /**
67 * Add/merge policies.
68 **/
69 void merge_policies (TAO_Policy_Set &policies);
71 /**
72 * Return whether the specified policy type is legal for the
73 * current configuration. This is needed since the user can
74 * potentially specify policies that are unknown to an
75 * validate () routine, and these need to be caught.
77 CORBA::Boolean legal_policy (CORBA::PolicyType type);
79 /**
80 * Adds a validator to the "chain of validators". The <code>
81 * TAO_POA_Policy_Validator </code> implements something that looks
82 * like a chain of responsability in which different member of the
83 * chain have the responsability of validating a given set of
84 * policies.
86 void add_validator (TAO_Policy_Validator *validator);
88 /**
89 * Accessor for the stored ORB core reference
91 TAO_ORB_Core & orb_core() const;
93 protected:
94 virtual void validate_impl (TAO_Policy_Set &policies) = 0;
96 virtual void merge_policies_impl (TAO_Policy_Set &policies) = 0;
98 virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type) = 0;
100 TAO_ORB_Core &orb_core_;
102 private:
103 void operator= (const TAO_Policy_Validator &);
104 TAO_Policy_Validator (const TAO_Policy_Validator &);
106 private:
107 TAO_Policy_Validator *next_;
110 TAO_END_VERSIONED_NAMESPACE_DECL
112 #include /**/ "ace/post.h"
114 #endif /* TAO_POLICY_VALIDATOR_H */