summaryrefslogtreecommitdiff
path: root/TAO/tao/Policy_Set.h
diff options
context:
space:
mode:
authorfhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-06-12 18:58:44 +0000
committerfhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-06-12 18:58:44 +0000
commit8d40b91422e328d03a0cda9dc91a9cb92458aa52 (patch)
tree468291519f5de84e2d73520262cff279db26aa67 /TAO/tao/Policy_Set.h
parent0d2e3d69b72f8f9dad3402500a1b77d4a579c43a (diff)
downloadATCD-8d40b91422e328d03a0cda9dc91a9cb92458aa52.tar.gz
Tue Jun 12 13:30:02 2001 Frank Hunleth <fhunleth@cs.wustl.edu>, Angelo Corsaro <corsaro@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Policy_Set.h')
-rw-r--r--TAO/tao/Policy_Set.h133
1 files changed, 133 insertions, 0 deletions
diff --git a/TAO/tao/Policy_Set.h b/TAO/tao/Policy_Set.h
new file mode 100644
index 00000000000..8eab9823f1b
--- /dev/null
+++ b/TAO/tao/Policy_Set.h
@@ -0,0 +1,133 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Set.h
+ *
+ * $Id$
+ *
+ * A Policy Container that provides O(1) time access for policy that support caching
+ * (see orbconf.h).
+ *
+ * @author Angelo Cosaro (corsaro@cs.wustl.edu)
+ * @author Frank Hunleth (fhunleth@cs.wustl.edu)
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_POLICY_SET_H_
+#define TAO_POLICY_SET_H_
+#include "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "tao/PolicyC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+/**
+ * @class TAO_Policy_Set
+ *
+ * @brief The policy manager implementation.
+ *
+ * This class is used to implement both the CORBA::PolicyManager
+ * and the CORBA::PolicyCurrent interfaces.
+ */
+class TAO_Export TAO_Policy_Set
+{
+public:
+
+ /** Creates a TAO_Policy_Set that has a given scope. The
+ * scope is used to determinate whether or not a given policy can
+ * be set for the given Policy Manager Implementation.
+ */
+ TAO_Policy_Set (TAO_Policy_Scope scope);
+
+ TAO_Policy_Set (const TAO_Policy_Set &rhs);
+
+ /// Destructor
+ ~TAO_Policy_Set (void);
+
+ /// Copy the state from <source>, it uses the copy() operator to
+ /// obtain independent copies of all the policies.
+ void copy_from (TAO_Policy_Set* source,
+ CORBA::Environment &ACE_TRY_ENV);
+
+ /**
+ * Modify the list of policies to include <policies>.
+ * If <set_add> is CORBA::SET_OVERRIDE then we replace all the old
+ * policies. If it is CORBA::ADD_OVERRIDE we simply add the policies
+ * in <policies>.
+ * No attempt is made to validate the policies for consistency.
+ */
+ void set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add,
+ CORBA::Environment &ACE_TRY_ENV =
+ TAO_default_environment ()
+ );
+
+ /// Get the values (if any) for the policies in <types>, if <types>
+ /// is an empty list the method returns *all* the current policies.
+ CORBA::PolicyList * get_policy_overrides (const CORBA::PolicyTypeSeq & types,
+ CORBA::Environment &ACE_TRY_ENV =
+ TAO_default_environment ()
+ );
+
+ /// Obtain a single policy.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType policy,
+ CORBA::Environment &ACE_TRY_ENV =
+ TAO_default_environment ()
+ );
+
+ /// Obtain a cached policy for speedy lookups.
+ /// This method just returns a const reference to the policy to
+ /// avoid obtaining a lock to increment the reference count. As such,
+ /// it can only be used for single threaded cases or cases where the
+ /// policies cannot be removed such as at the object and thread level
+ /// scopes. This method is most likely not appropriate for accessing
+ /// policies at the ORB level scope in any situation.
+ const CORBA::Policy_ptr get_cached_const_policy (TAO_Cached_Policy_Type type) const;
+
+ /// Obtain a single cached policy.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type);
+
+ /// Utility method to set a single policy.
+ void set_policy (const CORBA::Policy_ptr policy,
+ CORBA::Environment &ACE_TRY_ENV);
+
+ /// Returns the policy at the specified index.
+ /// CORBA::Policy::_nil () is returned if the policy doesn't exist
+ CORBA::Policy *get_policy_by_index (CORBA::ULong index);
+ CORBA::ULong num_policies (void) const;
+
+private:
+ ACE_UNIMPLEMENTED_FUNC (TAO_Policy_Set operator=(const TAO_Policy_Set&))
+// ACE_UNIMPLEMENTED_FUNC (TAO_Policy_Set(const TAO_Policy_Set&))
+
+ /// Remove and destroy all the policy objects owned by this policy
+ /// manager.
+ void cleanup_i (CORBA::Environment &ACE_TRY_ENV);
+
+ /// Utility method to determine if a policy's scope is compatible with ours.
+ CORBA::Boolean compatible_scope (TAO_Policy_Scope policy_scope) const;
+
+private:
+
+ /// Policies set for this Policy_Manager
+ CORBA::PolicyList policy_list_;
+
+ /// List of caches.
+ CORBA::Policy *cached_policies_[TAO_CACHED_POLICY_MAX_CACHED];
+
+ /// Scope associated to the Policy Manager Impl
+ TAO_Policy_Scope scope_;
+};
+
+#if defined (__ACE_INLINE__)
+# include "tao/Policy_Set.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/post.h"
+#endif /* TAO_POLICY_SET_H_ */
+