PolicyFactory_Registry.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ===================================================================
00004 /**
00005  *  @file   PolicyFactory_Registry.h
00006  *
00007  *  PolicyFactory_Registry.h,v 1.2 2005/11/04 09:26:55 ossama Exp
00008  *
00009  *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
00010  *  @author Johnny Willemsen <jwillemsen@remedy.nl>
00011  */
00012 // ===================================================================
00013 
00014 #ifndef TAO_POLICY_FACTORY_REGISTRY_H
00015 #define TAO_POLICY_FACTORY_REGISTRY_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "tao/Basic_Types.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "tao/Basic_Types.h"
00026 #include "tao/PolicyFactory_Registry_Adapter.h"
00027 #include "ace/Map_Manager.h"
00028 #include "ace/Null_Mutex.h"
00029 #include "ace/CORBA_macros.h"
00030 
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 /**
00034  * @class TAO_PolicyFactory_Registry
00035  *
00036  * @brief ORB-specific PortableInterceptor::PolicyFactory registry.
00037  *
00038  * ORB-specific registry that contains all portable interceptor
00039  * policy factories.
00040  */
00041 class TAO_PolicyFactory_Registry
00042   : public TAO::PolicyFactory_Registry_Adapter
00043 {
00044 public:
00045 
00046   /**
00047    * The type of table that maps policy type to policy factory.
00048    *
00049    * @note
00050    * An ACE_Null_Mutex is used for this type since policy factories
00051    * are only registered when CORBA::ORB_init() is called, at which a
00052    * point a lock has already been acquired.  In short, the table is
00053    * only modified during ORB bootstrap-time.
00054    */
00055   typedef ACE_Map_Manager<CORBA::PolicyType,
00056                           PortableInterceptor::PolicyFactory_ptr,
00057                           ACE_Null_Mutex>
00058     TABLE;
00059 
00060 public:
00061 
00062   /// Constructor
00063   TAO_PolicyFactory_Registry (void);
00064 
00065   /// Destructor.  Releases duplicated PolicyFactory references.
00066   ~TAO_PolicyFactory_Registry (void);
00067 
00068   /// Register a PolicyFactory with the underlying PolicyFactory
00069   /// sequence.  This method should only be called during ORB
00070   /// initialization.
00071   void register_policy_factory (
00072     CORBA::PolicyType type,
00073     PortableInterceptor::PolicyFactory_ptr policy_factory
00074     ACE_ENV_ARG_DECL);
00075 
00076   /// Construct a policy of the given type with the information
00077   /// contained in the CORBA::Any @a value.
00078   CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
00079                                    const CORBA::Any &value
00080                                    ACE_ENV_ARG_DECL);
00081 
00082   /// Create an empty policy, usually to be filled in later by
00083   /// demarshaling.
00084   CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
00085                                     ACE_ENV_ARG_DECL);
00086 
00087   /// Check if a @c PolicyFactory corresponding to the given type,
00088   /// exists.
00089   bool factory_exists (CORBA::PolicyType & type) const;
00090 
00091 private:
00092 
00093   /// The table that maps policy type to policy factory.
00094   TABLE factories_;
00095 
00096 };
00097 
00098 TAO_END_VERSIONED_NAMESPACE_DECL
00099 
00100 #include /**/ "ace/post.h"
00101 
00102 #endif  /* TAO_POLICY_FACTORY_REGISTRY_H */

Generated on Thu Nov 9 12:51:39 2006 for TAO_PI by doxygen 1.3.6