From 822a175826023a36f75c3d1fde9dffd452513cc8 Mon Sep 17 00:00:00 2001 From: nanbor Date: Sat, 1 Apr 2000 06:57:29 +0000 Subject: *** empty log message *** --- .../be/be_visitor_interface/interface_cs.cpp | 2 +- TAO/tao/LocalObject.cpp | 8 +++- TAO/tao/LocalObject.h | 54 +++++++++++----------- TAO/tao/LocalObject.i | 30 ++++++------ 4 files changed, 51 insertions(+), 43 deletions(-) diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp index fa92bc1a8c4..7fa091f29d8 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -175,7 +175,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "_ptr obj)" << be_nl << "{" << be_idt_nl << "if (!CORBA::is_nil (obj))" << be_idt_nl - << "obj->_incr_refcnt ();" << be_uidt_nl + << "obj->_add_ref ();" << be_uidt_nl << "return obj;" << be_uidt_nl << "}" << be_nl << be_nl; diff --git a/TAO/tao/LocalObject.cpp b/TAO/tao/LocalObject.cpp index b85b36cc743..9c5bb60375d 100644 --- a/TAO/tao/LocalObject.cpp +++ b/TAO/tao/LocalObject.cpp @@ -49,9 +49,13 @@ CORBA::LocalObject::_remove_ref (void) CORBA::Boolean CORBA::LocalObject::_is_a (const CORBA::Char *type_id, - CORBA::Environment &ACE_TRY_ENV) + CORBA::Environment &) { - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + if ((!ACE_OS::strcmp ((char *)type_id, "IDL:omg.org/CORBA/LocalObject:1.0")) || + (!ACE_OS::strcmp ((char *)type_id, "IDL:omg.org/CORBA/Object:1.0"))) + return 1; // success using local knowledge + else + return 0; } const char* diff --git a/TAO/tao/LocalObject.h b/TAO/tao/LocalObject.h index 4384296bc29..de39a827bc7 100644 --- a/TAO/tao/LocalObject.h +++ b/TAO/tao/LocalObject.h @@ -56,11 +56,10 @@ public: virtual CORBA::Boolean _is_a (const CORBA::Char *logical_type_id, CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()); - // throws NO_IMPLEMENT. - - virtual const char* _interface_repository_id (void) const; - // The repository ID for the most derived class, this is an - // implementation method and does no remote invocations! + // Determine if we are of the type specified by the + // "logical_type_id". The CCM spec says this operation _may_ throw + // NO_IMPLEMENT exception. Since we need it in _narrow, I'll keep + // this function around. #if (TAO_HAS_MINIMUM_CORBA == 0) @@ -166,6 +165,19 @@ public: // private state. Since that changes easily (when different ORB // protocols are in use) there is no default implementation. + // = Reference count managment. + virtual void _add_ref (void); + // Increment the reference count. + + virtual void _remove_ref (void); + // Decrement the reference count. + + // = TAO extensions + + virtual const char* _interface_repository_id (void) const; + // The repository ID for the most derived class, this is an + // implementation method and does no remote invocations! + virtual TAO_ObjectKey *_key (CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()); // throws NO_IMPLEMENT. @@ -183,22 +195,10 @@ public: #endif /* __GNUC__ */ // Useful for template programming. - // = Reference count managment. - virtual void _add_ref (void); - // Increment the reference count. - - virtual void _remove_ref (void); - // Decrement the reference count. - - // = TAO extensions - protected: private: // = Unimplemented methods - LocalObject (TAO_Stub *p = 0, - TAO_ServantBase *servant = 0, - CORBA::Boolean collocated = 0); // constructor LocalObject (const CORBA_Object &); @@ -209,12 +209,12 @@ class TAO_Export CORBA::LocalObject_var { public: LocalObject_var (void); // default constructor - LocalObject_var (CORBA::Object_ptr); - LocalObject_var (const CORBA_Object_var &); // copy constructor + LocalObject_var (CORBA::LocalObject_ptr); + LocalObject_var (const CORBA::LocalObject_var &); // copy constructor ~LocalObject_var (void); // destructor - LocalObject_var &operator= (CORBA::Object_ptr); - LocalObject_var &operator= (const CORBA_Object_var &); + LocalObject_var &operator= (CORBA::LocalObject_ptr); + LocalObject_var &operator= (const CORBA::LocalObject_var &); CORBA::LocalObject_ptr operator-> (void) const; operator const CORBA::LocalObject_ptr &() const; @@ -233,12 +233,12 @@ private: class TAO_Export CORBA::LocalObject_out { public: - LocalObject_out (CORBA::Object_ptr &); - LocalObject_out (CORBA_Object_var &); - LocalObject_out (const CORBA_Object_out &); - LocalObject_out &operator= (const CORBA_Object_out &); - LocalObject_out &operator= (const CORBA_Object_var &); - LocalObject_out &operator= (CORBA::Object_ptr); + LocalObject_out (CORBA::LocalObject_ptr &); + LocalObject_out (CORBA::LocalObject_var &); + LocalObject_out (const CORBA::LocalObject_out &); + LocalObject_out &operator= (const CORBA::LocalObject_out &); + LocalObject_out &operator= (const CORBA::LocalObject_var &); + LocalObject_out &operator= (CORBA::LocalObject_ptr); operator CORBA::LocalObject_ptr &(); CORBA::LocalObject_ptr &ptr (void); CORBA::LocalObject_ptr operator-> (void); diff --git a/TAO/tao/LocalObject.i b/TAO/tao/LocalObject.i index f9d77ea0f88..97f6b0e4142 100644 --- a/TAO/tao/LocalObject.i +++ b/TAO/tao/LocalObject.i @@ -19,16 +19,20 @@ CORBA::LocalObject::_nil (void) } ACE_INLINE CORBA::LocalObject_ptr -CORBA::LocalObject::_narrow (CORBA_Object_ptr obj, CORBA::Environment&) +CORBA::LocalObject::_narrow (CORBA::Object_ptr obj, CORBA::Environment& ACE_TRY_ENV) { - (!ACE_OS::strcmp (, "IDL:omg.org/CORBA/LocalObject:1.0")) - return CORBA::LocalObject::_duplicate (obj); + if (obj->_is_a ("IDL:omg.org/CORBA/LocalObject:1.0", ACE_TRY_ENV)) + return CORBA::LocalObject::_unchecked_narrow (obj, ACE_TRY_ENV); + else + return 0; } ACE_INLINE CORBA::LocalObject_ptr -CORBA::LocalObject::_unchecked_narrow (CORBA_Object_ptr obj, CORBA::Environment&) +CORBA::LocalObject::_unchecked_narrow (CORBA::Object_ptr obj, CORBA::Environment&) { - return CORBA::LocalObject::_duplicate (obj); + return CORBA::LocalObject::_duplicate + (ACE_reinterpret_cast (CORBA::LocalObject_ptr, + ACE_reinterpret_cast (void *, obj))); } // ************************************************************* @@ -36,30 +40,30 @@ CORBA::LocalObject::_unchecked_narrow (CORBA_Object_ptr obj, CORBA::Environment& // ************************************************************* ACE_INLINE -CORBA::LocalObject_var::CORBA::LocalObject_var (void) +CORBA::LocalObject_var::LocalObject_var (void) : ptr_ (CORBA::LocalObject::_nil ()) { } ACE_INLINE -CORBA::LocalObject_var::CORBA::LocalObject_var (CORBA::LocalObject_ptr p) +CORBA::LocalObject_var::LocalObject_var (CORBA::LocalObject_ptr p) : ptr_ (p) {} ACE_INLINE -CORBA::LocalObject_var::~CORBA::LocalObject_var (void) +CORBA::LocalObject_var::~LocalObject_var (void) { CORBA::release (this->ptr_); } -ACE_INLINE CORBA_Object_ptr +ACE_INLINE CORBA::LocalObject_ptr CORBA::LocalObject_var::ptr (void) const { return this->ptr_; } ACE_INLINE -CORBA::LocalObject_var::CORBA::LocalObject_var (const CORBA::LocalObject_var &p) // copy constructor +CORBA::LocalObject_var::LocalObject_var (const CORBA::LocalObject_var &p) // copy constructor : ptr_ (CORBA::LocalObject::_duplicate (p.ptr ())) {} @@ -134,14 +138,14 @@ CORBA::LocalObject_var::_retn (void) // ************************************************************* ACE_INLINE -CORBA::LocalObject_out::CORBA::LocalObject_out (CORBA::LocalObject_ptr &p) +CORBA::LocalObject_out::LocalObject_out (CORBA::LocalObject_ptr &p) : ptr_ (p) { this->ptr_ = CORBA::LocalObject::_nil (); } ACE_INLINE -CORBA::LocalObject_out::CORBA::LocalObject_out (CORBA::LocalObject_var &p) // constructor from _var +CORBA::LocalObject_out::LocalObject_out (CORBA::LocalObject_var &p) // constructor from _var : ptr_ (p.out ()) { CORBA::release (this->ptr_); @@ -149,7 +153,7 @@ CORBA::LocalObject_out::CORBA::LocalObject_out (CORBA::LocalObject_var &p) // co } ACE_INLINE -CORBA::LocalObject_out::CORBA::LocalObject_out (const CORBA::LocalObject_out &p) // copy constructor +CORBA::LocalObject_out::LocalObject_out (const CORBA::LocalObject_out &p) // copy constructor : ptr_ (p.ptr_) {} -- cgit v1.2.1