LocalObject.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file LocalObject.h
00006  *
00007  * $Id: LocalObject.h 78734 2007-07-02 16:16:24Z mitza $
00008  *
00009  * Header file for CORBA's base "LocalObject" type.
00010  *
00011  * A "LocalObject" is an entity that can be the target of a local
00012  * invocation.  See the CORBA Component Model specification for
00013  * details.
00014  *
00015  * @author Nanbor Wang <nanbor@cs.wustl.edu>
00016  */
00017 //=============================================================================
00018 
00019 
00020 #ifndef TAO_CORBA_LOCALOBJECT_H
00021 #define TAO_CORBA_LOCALOBJECT_H
00022 
00023 #include /**/ "ace/pre.h"
00024 
00025 #include "ace/Thread_Mutex.h"
00026 #include "ace/Atomic_Op.h"
00027 
00028 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00029 # pragma once
00030 #endif /* ACE_LACKS_PRAGMA_ONCE */
00031 
00032 #include "tao/Object.h"
00033 
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035 
00036 namespace CORBA
00037 {
00038   class LocalObject;
00039   typedef LocalObject *LocalObject_ptr;
00040   typedef TAO_Pseudo_Var_T<LocalObject> LocalObject_var;
00041   typedef TAO_Pseudo_Out_T<LocalObject> LocalObject_out;
00042 
00043   /**
00044    * @class LocalObject
00045    */
00046   class TAO_Export LocalObject : public virtual CORBA::Object
00047   {
00048   public:
00049 
00050     /// Destructor
00051     virtual ~LocalObject (void);
00052 
00053     /// Increment the ref count
00054     static LocalObject_ptr _duplicate (LocalObject_ptr obj);
00055 
00056     /// Return a NIL object
00057     static LocalObject_ptr _nil (void);
00058 
00059     /**
00060      * @todo Narrowing a LocalObject to a CORBA::Object is broken
00061      * right now.  The solution seems to be making CORBA::Object an
00062      * abstract base class and create a CORBA::RemoteObject for
00063      * regular object.  Or, even easier, add a @c is_local member into
00064      * CORBA::Object.  I'll take the easier route for now.
00065      */
00066     static LocalObject_ptr _narrow (CORBA::Object_ptr obj);
00067 
00068 #if (TAO_HAS_MINIMUM_CORBA == 0)
00069 
00070     /// Always returns false.
00071     virtual CORBA::Boolean _non_existent (void);
00072 
00073     /// Throws CORBA::NO_IMPLEMENT.
00074     virtual CORBA::ImplementationDef_ptr _get_implementation (void);
00075 
00076     /// Gets info about object from the Interface Repository.
00077     virtual CORBA::InterfaceDef_ptr _get_interface (void);
00078 
00079     /// Throws NO_IMPLEMENT.
00080     virtual CORBA::Object_ptr _get_component (void);
00081 
00082     /// Get the repository id.
00083     virtual char * _repository_id (void);
00084 
00085     virtual void _create_request (CORBA::Context_ptr ctx,
00086                                   const char * operation,
00087                                   CORBA::NVList_ptr arg_list,
00088                                   CORBA::NamedValue_ptr result,
00089                                   CORBA::Request_ptr & request,
00090                                   CORBA::Flags req_flags);
00091 
00092     virtual void _create_request (CORBA::Context_ptr ctx,
00093                                   const char * operation,
00094                                   CORBA::NVList_ptr arg_list,
00095                                   CORBA::NamedValue_ptr result,
00096                                   CORBA::ExceptionList_ptr exclist,
00097                                   CORBA::ContextList_ptr ctxtlist,
00098                                   CORBA::Request_ptr & request,
00099                                   CORBA::Flags req_flags);
00100 
00101     /// Throws NO_IMPLEMENT.
00102     virtual CORBA::Request_ptr _request (const char * operation);
00103 
00104 #endif /* TAO_HAS_MINIMUM_CORBA */
00105 
00106 #if (TAO_HAS_CORBA_MESSAGING == 1)
00107 
00108     /// Throws CORBA::NO_IMPLEMENT.
00109     CORBA::Policy_ptr _get_policy (CORBA::PolicyType type);
00110 
00111     /// Throws CORBA::NO_IMPLEMENT.
00112     CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type);
00113 
00114     /// Throws CORBA::NO_IMPLEMENT.
00115     CORBA::Object_ptr _set_policy_overrides (
00116         const CORBA::PolicyList & policies,
00117         CORBA::SetOverrideType set_add);
00118 
00119     /// Throws CORBA::NO_IMPLEMENT.
00120     CORBA::PolicyList * _get_policy_overrides (
00121         const CORBA::PolicyTypeSeq & types);
00122 
00123     /// Throws CORBA::NO_IMPLEMENT.
00124     CORBA::Boolean _validate_connection (
00125         CORBA::PolicyList_out inconsistent_policies);
00126 
00127 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00128 
00129     /**
00130      * Return a hash value for this object.  The hash is based on the
00131      * address of the object.  On non-32 bit platforms, the hash may
00132      * be non-unique.
00133      */
00134     virtual CORBA::ULong _hash (CORBA::ULong maximum);
00135 
00136     /**
00137      * Try to determine if this object is the same as @c other_obj.
00138      * This method relies on the representation of the object
00139      * reference's private state.  Since that changes easily (when
00140      * different ORB protocols are in use) there is no default
00141      * implementation.
00142      */
00143     virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj);
00144 
00145     // = Reference count managment.
00146     /// Increment the reference count.
00147     virtual void _add_ref (void);
00148 
00149     /// Decrement the reference count.
00150     virtual void _remove_ref (void);
00151 
00152     virtual CORBA::ORB_ptr _get_orb (void);
00153 
00154     // = TAO extensions
00155 
00156     /// Throws CORBA::NO_IMPLEMENT.
00157     virtual TAO::ObjectKey * _key (void);
00158 
00159     /// Useful for template programming.
00160     typedef LocalObject_ptr _ptr_type;
00161     typedef LocalObject_var _var_type;
00162     typedef LocalObject_out _out_type;
00163 
00164   protected:
00165 
00166     /// Default constructor.
00167     /**
00168      * Make it protected to prevent instantiation of this class.
00169      */
00170     LocalObject (void);
00171 
00172   private:
00173 
00174     /**
00175      * @name Unimplemented methods
00176      */
00177     //@{
00178     LocalObject (const LocalObject &);
00179     LocalObject & operator = (const LocalObject &);
00180     //@}
00181 
00182   };
00183 }   // End CORBA namespace
00184 
00185 /**
00186  * @class TAO_Local_RefCounted_Object
00187  *
00188  * @brief This class adds default reference counting to local
00189  *        objects.
00190  *
00191  * This is proprietary convenience class that implements reference
00192  * counting in locality constrained objects.
00193  */
00194 class TAO_Export TAO_Local_RefCounted_Object
00195   : public virtual CORBA::LocalObject
00196 {
00197 public:
00198 
00199   /// Increment reference count.
00200   virtual void _add_ref (void);
00201 
00202   /// Decrement reference count.
00203   virtual void _remove_ref (void);
00204 
00205 protected:
00206 
00207   // Default constructor.
00208   /**
00209    * Make it protected to prevent instantiation of this class.
00210    */
00211   TAO_Local_RefCounted_Object (void);
00212 
00213 private:
00214 
00215   /**
00216    * @name Unimplemented methods
00217    */
00218   //@{
00219   TAO_Local_RefCounted_Object (const TAO_Local_RefCounted_Object &);
00220   TAO_Local_RefCounted_Object & operator = (
00221       const TAO_Local_RefCounted_Object &
00222     );
00223   //@}
00224 };
00225 
00226 TAO_END_VERSIONED_NAMESPACE_DECL
00227 
00228 #if defined (__ACE_INLINE__)
00229 # include "tao/LocalObject.inl"
00230 #endif /* __ACE_INLINE__ */
00231 
00232 #include /**/ "ace/post.h"
00233 
00234 #endif /* TAO_CORBA_LOCALOBJECT_H */

Generated on Sun Jan 27 13:07:33 2008 for TAO by doxygen 1.3.6