PICurrent_Impl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ===================================================================
00004 /**
00005  *  @file   PICurrent_Impl.h
00006  *
00007  *  PICurrent_Impl.h,v 1.9 2006/06/26 09:24:20 sma Exp
00008  *
00009  *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
00010  */
00011 // ===================================================================
00012 
00013 #ifndef TAO_PI_CURRENT_IMPL_H
00014 #define TAO_PI_CURRENT_IMPL_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/PI/pi_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "tao/orbconf.h"
00025 
00026 #if TAO_HAS_INTERCEPTORS == 1
00027 
00028 #include "tao/PI/PICurrentC.h"
00029 #include "tao/AnyTypeCode/Any.h"
00030 #include "ace/Array_Base.h"
00031 
00032 
00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00034 
00035 /// Forward declarations.
00036 class TAO_ORB_Core;
00037 
00038 namespace TAO
00039 {
00040   /**
00041    * @class PICurrent_Impl
00042    *
00043    * @brief Implementation of the PortableInterceptor::Current
00044    *        interface.
00045    *
00046    * This class implements both the "request scope current" and the
00047    * "thread scope current" objects as required by Portable
00048    * Interceptors.
00049    */
00050   class TAO_PI_Export PICurrent_Impl
00051   {
00052   public:
00053     /// Constructor.
00054     PICurrent_Impl (void);
00055 
00056     /// Destructor.
00057     ~PICurrent_Impl (void);
00058 
00059     /// Retrieve information stored in the slot table at the given
00060     /// SlotId.
00061     CORBA::Any *get_slot (PortableInterceptor::SlotId identifier
00062                           ACE_ENV_ARG_DECL)
00063       ACE_THROW_SPEC ((CORBA::SystemException,
00064                        PortableInterceptor::InvalidSlot));
00065 
00066     /// Set information in the slot table at the given SlotId.
00067     void set_slot (PortableInterceptor::SlotId identifier,
00068                    const CORBA::Any & data
00069                    ACE_ENV_ARG_DECL)
00070       ACE_THROW_SPEC ((CORBA::SystemException,
00071                        PortableInterceptor::InvalidSlot));
00072 
00073     /// Logically/Lazy (shallow) copy the given object's slot table.
00074     void take_lazy_copy (PICurrent_Impl *p);
00075 
00076   private:
00077     /// Force this object to convert from a logical (referenced)
00078     /// copy, to a physical (or deep, actual) copy.
00079     void convert_from_lazy_to_real_copy ();
00080 
00081     /// Set the callback PICurrent_Impl object that will be notified
00082     /// of this object's impending destruction or change.
00083     /// Set to 0 to clear. (NOTE Only handles a SINGLE object at
00084     /// at time, does NOT warn previous callback that this has
00085     /// been changed.)
00086     void set_callback_for_impending_change (PICurrent_Impl *p);
00087 
00088     /// Typedef for the underyling "slot table."
00089     typedef ACE_Array_Base<CORBA::Any> Table;
00090 
00091     /// Return a reference to the slot table currently associated
00092     /// with this PICurrent_Impl object.
00093     /**
00094      * @return Logically copied slot table if available, otherwise
00095      *         underlying slot table.
00096      */
00097     Table & current_slot_table ();
00098 
00099     /// Prevent copying through the copy constructor and the assignment
00100     /// operator.
00101     //@{
00102     PICurrent_Impl (const PICurrent_Impl &);
00103     void operator= (const PICurrent_Impl &);
00104     //@}
00105 
00106   private:
00107     /// Array of CORBA::Anys that is the underlying "slot table."
00108     Table slot_table_;
00109 
00110     /// Access to logical copy from a PICurrent_Impl in another
00111     /// scope, i.e. either the request scope or the thread scope.
00112     PICurrent_Impl *lazy_copy_;
00113 
00114     /// PICurrent_Impl object that will be notified of this object's
00115     /// impending destruction or change to its slot_table_. This is
00116     /// the PICurrent_Impl that has access to our slot_table_ via its
00117     /// lazy_copy_ pointer. As necessary this allows that object's
00118     /// convert_from_lazy_to_real_copy() to be called.
00119     PICurrent_Impl *impending_change_callback_;
00120   };
00121 }
00122 
00123 TAO_END_VERSIONED_NAMESPACE_DECL
00124 
00125 #if defined (__ACE_INLINE__)
00126 # include "tao/PI/PICurrent_Impl.inl"
00127 #endif /* __ACE_INLINE__ */
00128 
00129 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00130 
00131 #include /**/ "ace/post.h"
00132 
00133 #endif /* TAO_PI_CURRENT_IMPL_H */

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