Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / PI / PolicyFactory_Registry.h
blob9ea5fb17330732873405d3aa32e22f2f59f8dac2
1 // -*- C++ -*-
3 // ===================================================================
4 /**
5 * @file PolicyFactory_Registry.h
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
8 * @author Johnny Willemsen <jwillemsen@remedy.nl>
9 */
10 // ===================================================================
12 #ifndef TAO_POLICY_FACTORY_REGISTRY_H
13 #define TAO_POLICY_FACTORY_REGISTRY_H
15 #include /**/ "ace/pre.h"
17 #include "tao/Basic_Types.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "tao/Basic_Types.h"
24 #include "tao/PolicyFactory_Registry_Adapter.h"
25 #include "ace/Map_Manager.h"
26 #include "ace/Null_Mutex.h"
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
30 /**
31 * @class TAO_PolicyFactory_Registry
33 * @brief ORB-specific PortableInterceptor::PolicyFactory registry.
35 * ORB-specific registry that contains all portable interceptor
36 * policy factories.
38 class TAO_PolicyFactory_Registry
39 : public TAO::PolicyFactory_Registry_Adapter
41 public:
42 /**
43 * The type of table that maps policy type to policy factory.
45 * @note
46 * An ACE_Null_Mutex is used for this type since policy factories
47 * are only registered when CORBA::ORB_init() is called, at which a
48 * point a lock has already been acquired. In short, the table is
49 * only modified during ORB bootstrap-time.
51 typedef ACE_Map_Manager<CORBA::PolicyType,
52 PortableInterceptor::PolicyFactory_ptr,
53 ACE_Null_Mutex> TABLE;
55 public:
56 /// Constructor
57 TAO_PolicyFactory_Registry ();
59 /// Destructor. Releases duplicated PolicyFactory references.
60 ~TAO_PolicyFactory_Registry ();
62 /// Register a PolicyFactory with the underlying PolicyFactory
63 /// sequence. This method should only be called during ORB
64 /// initialization.
65 void register_policy_factory (
66 CORBA::PolicyType type,
67 PortableInterceptor::PolicyFactory_ptr policy_factory);
69 /// Construct a policy of the given type with the information
70 /// contained in the CORBA::Any @a value.
71 CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
72 const CORBA::Any &value);
74 /// Create an empty policy, usually to be filled in later by
75 /// demarshaling.
76 CORBA::Policy_ptr _create_policy (CORBA::PolicyType type);
78 /// Check if a @c PolicyFactory corresponding to the given type,
79 /// exists.
80 bool factory_exists (CORBA::PolicyType & type) const;
82 private:
83 /// The table that maps policy type to policy factory.
84 TABLE factories_;
87 TAO_END_VERSIONED_NAMESPACE_DECL
89 #include /**/ "ace/post.h"
91 #endif /* TAO_POLICY_FACTORY_REGISTRY_H */