From 572eafb31c0f8833df639bb7cf4cf5eb6d4689db Mon Sep 17 00:00:00 2001 From: parsons Date: Tue, 31 Oct 2000 18:14:53 +0000 Subject: ChangeLogTag: Tue Oct 31 12:01:10 2000 Jeff Parsons --- TAO/tao/DynamicInterface/Context.cpp | 213 ++++++++++ TAO/tao/DynamicInterface/Context.h | 305 +++++++++++++++ TAO/tao/DynamicInterface/Context.inl | 373 ++++++++++++++++++ TAO/tao/DynamicInterface/DII_Invocation.cpp | 77 ++++ TAO/tao/DynamicInterface/DII_Invocation.h | 78 ++++ TAO/tao/DynamicInterface/DII_Invocation.inl | 24 ++ TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp | 130 +++++++ TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h | 94 +++++ TAO/tao/DynamicInterface/DII_Reply_Dispatcher.inl | 26 ++ TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp | 198 ++++++++++ TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h | 122 ++++++ .../DynamicInterface/Dynamic_Implementation.cpp | 137 +++++++ TAO/tao/DynamicInterface/Dynamic_Implementation.h | 85 ++++ TAO/tao/DynamicInterface/ExceptionList.cpp | 119 ++++++ TAO/tao/DynamicInterface/ExceptionList.h | 152 ++++++++ TAO/tao/DynamicInterface/ExceptionList.inl | 137 +++++++ TAO/tao/DynamicInterface/Makefile | 59 +++ TAO/tao/DynamicInterface/Makefile.bor | 31 ++ TAO/tao/DynamicInterface/Request.cpp | 428 +++++++++++++++++++++ TAO/tao/DynamicInterface/Request.h | 375 ++++++++++++++++++ TAO/tao/DynamicInterface/Request.inl | 304 +++++++++++++++ TAO/tao/DynamicInterface/Server_Request.cpp | 206 ++++++++++ TAO/tao/DynamicInterface/Server_Request.h | 145 +++++++ TAO/tao/DynamicInterface/Server_Request.inl | 44 +++ TAO/tao/DynamicInterface/TAO_DynamicInterface.dsp | 259 +++++++++++++ TAO/tao/DynamicInterface/dynamicinterface_export.h | 40 ++ 26 files changed, 4161 insertions(+) create mode 100644 TAO/tao/DynamicInterface/Context.cpp create mode 100644 TAO/tao/DynamicInterface/Context.h create mode 100644 TAO/tao/DynamicInterface/Context.inl create mode 100644 TAO/tao/DynamicInterface/DII_Invocation.cpp create mode 100644 TAO/tao/DynamicInterface/DII_Invocation.h create mode 100644 TAO/tao/DynamicInterface/DII_Invocation.inl create mode 100644 TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp create mode 100644 TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h create mode 100644 TAO/tao/DynamicInterface/DII_Reply_Dispatcher.inl create mode 100644 TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp create mode 100644 TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h create mode 100644 TAO/tao/DynamicInterface/Dynamic_Implementation.cpp create mode 100644 TAO/tao/DynamicInterface/Dynamic_Implementation.h create mode 100644 TAO/tao/DynamicInterface/ExceptionList.cpp create mode 100644 TAO/tao/DynamicInterface/ExceptionList.h create mode 100644 TAO/tao/DynamicInterface/ExceptionList.inl create mode 100644 TAO/tao/DynamicInterface/Makefile create mode 100644 TAO/tao/DynamicInterface/Makefile.bor create mode 100644 TAO/tao/DynamicInterface/Request.cpp create mode 100644 TAO/tao/DynamicInterface/Request.h create mode 100644 TAO/tao/DynamicInterface/Request.inl create mode 100644 TAO/tao/DynamicInterface/Server_Request.cpp create mode 100644 TAO/tao/DynamicInterface/Server_Request.h create mode 100644 TAO/tao/DynamicInterface/Server_Request.inl create mode 100644 TAO/tao/DynamicInterface/TAO_DynamicInterface.dsp create mode 100644 TAO/tao/DynamicInterface/dynamicinterface_export.h (limited to 'TAO/tao/DynamicInterface') diff --git a/TAO/tao/DynamicInterface/Context.cpp b/TAO/tao/DynamicInterface/Context.cpp new file mode 100644 index 00000000000..342208772dd --- /dev/null +++ b/TAO/tao/DynamicInterface/Context.cpp @@ -0,0 +1,213 @@ +// $Id$ + +#include "Context.h" + +ACE_RCSID(DynamicInterface, Context, "$Id$") + +#include "tao/Typecode.h" +#include "tao/Environment.h" +#include "tao/NVList.h" +#include "tao/ORB.h" + +#if !defined (__ACE_INLINE__) +# include "Context.inl" +#endif /* ! __ACE_INLINE__ */ + +CORBA_Context::CORBA_Context (void) + : refcount_ (1) +{ +} + +CORBA_Context::~CORBA_Context (void) +{ +} + +CORBA::ULong +CORBA_Context::_incr_refcnt (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->refcount_lock_, + 0); + + return refcount_++; +} + +CORBA::ULong +CORBA_Context::_decr_refcnt (void) +{ + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->refcount_lock_, + 0); + + this->refcount_--; + + if (this->refcount_ != 0) + { + return this->refcount_; + } + } + + delete this; + return 0; +} + +const char * +CORBA_Context::context_name (CORBA::Environment &ACE_TRY_ENV) const +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO), + 0); +} + +CORBA_Context_ptr +CORBA_Context::parent (CORBA::Environment &ACE_TRY_ENV) const +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO), + 0); +} + +void +CORBA_Context::create_child (const char * /* child_ctx_name */, + CORBA_Context_out /* child_ctx */, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); +} + +void +CORBA_Context::set_one_value (const char * /* propname */, + const CORBA_Any & /* propvalue */, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); +} + +void +CORBA_Context::set_values (CORBA::NVList_ptr, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); +} + +void +CORBA_Context::delete_values (const char * /* propname */, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); +} + +void +CORBA_Context::get_values (const char * /* start_scope */, + CORBA::Flags /* op_flags */, + const char * /* pattern */, + CORBA::NVList_ptr & /* values */, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); +} + +CORBA_ContextList::CORBA_ContextList (CORBA::ULong len, + char* *ctx_list) + : ref_count_ (1) +{ + for (CORBA::ULong i=0; i < len; i++) + { + this->add (ctx_list [i]); + } +} + +CORBA_ContextList::~CORBA_ContextList (void) +{ + for (CORBA::ULong i = 0; i < this->count (); ++i) + { + char **ctx; + + if (this->ctx_list_.get (ctx, i) == -1) + { + return; + } + + CORBA::string_free (*ctx); + } +} + +void +CORBA_ContextList::add (char *ctx) +{ + this->ctx_list_.enqueue_tail (CORBA::string_dup (ctx)); +} + +void +CORBA_ContextList::add_consume (char *ctx) +{ + this->ctx_list_.enqueue_tail (ctx); +} + +char * +CORBA_ContextList::item (CORBA::ULong slot, + CORBA::Environment &ACE_TRY_ENV) +{ + char **ctx = 0; + + if (this->ctx_list_.get (ctx, slot) == -1) + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + 0); + } + else + { + return CORBA::string_dup (*ctx); + } +} + +void +CORBA_ContextList::remove (CORBA::ULong, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA_ContextList_ptr +CORBA_ContextList::_duplicate (void) +{ + ++this->ref_count_; + return this; +} + +void +CORBA_ContextList::_destroy (void) +{ + CORBA::ULong current = --this->ref_count_; + + if (current == 0) + { + delete this; + } +} + +void +CORBA_ContextList::_incr_refcnt (void) +{ + this->ref_count_++; +} + +void +CORBA_ContextList::_decr_refcnt (void) +{ + this->ref_count_--; + + if (this->ref_count_ != 0) + { + delete this; + } +} + diff --git a/TAO/tao/DynamicInterface/Context.h b/TAO/tao/DynamicInterface/Context.h new file mode 100644 index 00000000000..8459eb29b4d --- /dev/null +++ b/TAO/tao/DynamicInterface/Context.h @@ -0,0 +1,305 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// Context.h +// +// = DESCRIPTION +// Header file for CORBA Context class. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_CONTEXT_H +#define TAO_CONTEXT_H +#include "ace/pre.h" + +#include "tao/corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "dynamicinterface_export.h" + +class TAO_DynamicInterface_Export CORBA_Context +{ + // = TITLE + // CORBA_Context + // + // = DESCRIPTION + // TAO's minimal implementation of the Context interface. Since + // Contexts are inherently un-typesafe, there use is deprecated + // and the feature may eventaully disappear from CORBA. It is + // implemented only to make the arg list of + // CORBA_Object::_create_request() compliant. The only (pointer) + // value that should be passed is 0. + // +public: + // = Initialization and termination methods. + + CORBA_Context (void); + // Constructor. + + ~CORBA_Context (void); + // Destructor. + + // = Pseudo-object methods + static CORBA_Context *_duplicate (CORBA_Context*); + static CORBA_Context *_nil (void); + + // = Reference counting. + CORBA::ULong _incr_refcnt (void); + CORBA::ULong _decr_refcnt (void); + + // = All the spec-required functions below will just throw a + // CORBA::NO_IMPLEMENT exception and do nothing else. + + const char *context_name (CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()) const; + + CORBA_Context_ptr parent (CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()) const; + + void create_child (const char *child_ctx_name, + CORBA_Context_out child_ctx, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + void set_one_value (const char *propname, + const CORBA_Any &propvalue, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + void set_values (CORBA::NVList_ptr values, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + void delete_values (const char *propname, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + void get_values (const char *start_scope, + CORBA::Flags op_flags, + const char *pattern, + CORBA::NVList_ptr &values, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA_Context_ptr _ptr_type; + typedef CORBA_Context_var _var_type; +#endif /* __GNUC__ */ + // Useful for template programming. + +private: + CORBA::ULong refcount_; + // Reference counting. + + ACE_SYNCH_MUTEX refcount_lock_; + // Protect the reference count. +}; + +typedef CORBA_Context* CORBA_Context_ptr; + +class TAO_DynamicInterface_Export CORBA_Context_var +{ + // = TITLE + // The T_var class for Context. + // + // = DESCRIPTION + // As any other pseudo object Context must have a T_var class, + // the interface an semantics are specified in the CORBA spec. + // + // We use as the _ptr type instead of + // in an attempt to reduced the cyclic + // dependencies in TAO. +public: + CORBA_Context_var (void); + CORBA_Context_var (CORBA_Context_ptr); + CORBA_Context_var (const CORBA_Context_var &); + ~CORBA_Context_var (void); + + CORBA_Context_var &operator= (CORBA_Context_ptr); + CORBA_Context_var &operator= (const CORBA_Context_var &); + CORBA_Context_ptr operator-> (void) const; + + operator const CORBA_Context_ptr &() const; + operator CORBA_Context_ptr &(); + // in, inout, out, _retn + CORBA_Context_ptr in (void) const; + CORBA_Context_ptr &inout (void); + CORBA_Context_ptr &out (void); + CORBA_Context_ptr _retn (void); + CORBA_Context_ptr ptr (void) const; + +private: + CORBA_Context_ptr ptr_; +}; + +class TAO_DynamicInterface_Export CORBA_Context_out +{ + // = TITLE + // The T_out class for Context + // + // = DESCRIPTION + // As any other pseudo object Context must have a T_out class, + // the interface an semantics are specified in the CORBA spec. + // + // We use as the _ptr type instead of + // in an attempt to reduced the cyclic + // dependencies in TAO. +public: + CORBA_Context_out (CORBA_Context_ptr &); + CORBA_Context_out (CORBA_Context_var &); + CORBA_Context_out (CORBA_Context_out &); + CORBA_Context_out &operator= (CORBA_Context_out &); + CORBA_Context_out &operator= (const CORBA_Context_var &); + CORBA_Context_out &operator= (CORBA_Context_ptr); + operator CORBA_Context_ptr &(); + CORBA_Context_ptr &ptr (void); + CORBA_Context_ptr operator-> (void); + +private: + CORBA_Context_ptr &ptr_; +}; + +class TAO_DynamicInterface_Export CORBA_ContextList +{ + // = TITLE + // ContextList definition taken from CORBA v2.3a Dec 1998 + // + // = DESCRIPTION + // Maintains a list of strings for Contexts. +public: + CORBA_ContextList (void); + // Constructor. + + CORBA_ContextList (CORBA::ULong len, + char **ctx_list); + // Constructor - initialize given a length and an array of + // strings. + + ~CORBA_ContextList (void); + // Destructor. + + CORBA::ULong count (void); + // Return the number of elements. + + CORBA_ContextList_ptr _duplicate (void); + // Increment the reference count. + + static CORBA_ContextList_ptr _duplicate (CORBA_ContextList *); + // Increment the reference count. + + void _destroy (void); + // Decrement the reference count and delete if it is 0. + + static CORBA_ContextList_ptr _nil (); + // Return null pointer of this type. + + void add (char *ctx); + // Add a string to the list. + + void add_consume (char *ctx); + // Add and consume a string to the list. + + char *item (CORBA::ULong slot, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Return the typecode at slot i. Raises the "Bounds" exception. + + void remove (CORBA::ULong slot, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Remove the typecode at slot i. Raises the "Bounds" exception. + + void _incr_refcnt (void); + void _decr_refcnt (void); + // Increment and decrement ref counts. + +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA::ContextList_ptr _ptr_type; + typedef CORBA::ContextList_var _var_type; +#endif /* __GNUC__ */ + // Useful for template programming. + +private: + // Not allowed. + CORBA_ContextList (const CORBA_ContextList &); + CORBA_ContextList &operator= (const CORBA_ContextList &); + + ACE_Atomic_Op ref_count_; + // Reference counter. + + ACE_Unbounded_Queue ctx_list_; + // Internal list of typecodes. +}; + +class TAO_DynamicInterface_Export CORBA_ContextList_var +{ +public: + CORBA_ContextList_var (void); // default constructor + CORBA_ContextList_var (CORBA_ContextList_ptr); + CORBA_ContextList_var (const CORBA_ContextList_var &); // copy constructor + ~CORBA_ContextList_var (void); // destructor + + CORBA_ContextList_var &operator= (CORBA_ContextList_ptr); + CORBA_ContextList_var &operator= (const CORBA_ContextList_var &); + CORBA_ContextList_ptr operator-> (void) const; + + operator const CORBA_ContextList_ptr &() const; + operator CORBA_ContextList_ptr &(); + // in, inout, out, _retn + CORBA_ContextList_ptr in (void) const; + CORBA_ContextList_ptr &inout (void); + CORBA_ContextList_ptr &out (void); + CORBA_ContextList_ptr _retn (void); + CORBA_ContextList_ptr ptr (void) const; + +private: + CORBA_ContextList_ptr ptr_; +}; + +class TAO_DynamicInterface_Export CORBA_ContextList_out +{ + // = TITLE + // The T_out class for ContextList + // + // = DESCRIPTION + // As any other pseudo object ContextList must have a T_out class, + // the interface an semantics are specified in the CORBA spec. + // + // = NOTE + // We use CORBA_ContextList_ptr as the _ptr type instead of + // CORBA::ContextList_ptr, this is an attempt to reduced the cyclic + // dependencies in TAO. + // +public: + CORBA_ContextList_out (CORBA_ContextList_ptr &); + CORBA_ContextList_out (CORBA_ContextList_var &); + CORBA_ContextList_out (CORBA_ContextList_out &); + CORBA_ContextList_out &operator= (CORBA_ContextList_out &); + CORBA_ContextList_out &operator= (const CORBA_ContextList_var &); + CORBA_ContextList_out &operator= (CORBA_ContextList_ptr); + operator CORBA_ContextList_ptr &(); + CORBA_ContextList_ptr &ptr (void); + CORBA_ContextList_ptr operator-> (void); + +private: + CORBA_ContextList_ptr &ptr_; +}; + +#if defined (__ACE_INLINE__) +# include "Context.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_CONTEXT_H */ diff --git a/TAO/tao/DynamicInterface/Context.inl b/TAO/tao/DynamicInterface/Context.inl new file mode 100644 index 00000000000..da06529d929 --- /dev/null +++ b/TAO/tao/DynamicInterface/Context.inl @@ -0,0 +1,373 @@ +// $Id$ + +// This may look like C, but it's really -*- C++ -*- + +ACE_INLINE CORBA_Context_ptr +CORBA_Context::_duplicate (CORBA_Context_ptr x) +{ + if (x != 0) + { + x->_incr_refcnt (); + } + + return x; +} + +ACE_INLINE CORBA_Context_ptr +CORBA_Context::_nil (void) +{ + return (CORBA_Context_ptr)0; +} + +// ************************************************************* +// Inline operations for class CORBA_Context_var +// ************************************************************* + +ACE_INLINE +CORBA_Context_var::CORBA_Context_var (void) + : ptr_ (CORBA_Context::_nil ()) +{ +} + +ACE_INLINE +CORBA_Context_var::CORBA_Context_var (CORBA_Context_ptr p) + : ptr_ (p) +{} + +ACE_INLINE +CORBA_Context_var::~CORBA_Context_var (void) +{ + CORBA::release (this->ptr_); +} + +ACE_INLINE CORBA_Context_ptr +CORBA_Context_var::ptr (void) const +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_Context_var::CORBA_Context_var (const CORBA_Context_var &p) + : ptr_ (CORBA_Context::_duplicate (p.ptr ())) +{} + +ACE_INLINE CORBA_Context_var & +CORBA_Context_var::operator= (CORBA_Context_ptr p) +{ + CORBA::release (this->ptr_); + this->ptr_ = p; + return *this; +} + +ACE_INLINE CORBA_Context_var & +CORBA_Context_var::operator= (const CORBA_Context_var &p) +{ + if (this != &p) + { + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Context::_duplicate (p.ptr ()); + } + return *this; +} + +ACE_INLINE +CORBA_Context_var::operator const CORBA_Context_ptr &() const +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_Context_var::operator CORBA_Context_ptr &() +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr +CORBA_Context_var::operator-> (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr +CORBA_Context_var::in (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr & +CORBA_Context_var::inout (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr & +CORBA_Context_var::out (void) +{ + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Context::_nil (); + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr +CORBA_Context_var::_retn (void) +{ + // yield ownership + CORBA_Context_ptr val = this->ptr_; + this->ptr_ = CORBA_Context::_nil (); + return val; +} + +// ************************************************************* +// Inline operations for class CORBA_Context_out +// ************************************************************* + +ACE_INLINE +CORBA_Context_out::CORBA_Context_out (CORBA_Context_ptr &p) + : ptr_ (p) +{ + this->ptr_ = CORBA_Context::_nil (); +} + +ACE_INLINE +CORBA_Context_out::CORBA_Context_out (CORBA_Context_var &p) + : ptr_ (p.out ()) +{ + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Context::_nil (); +} + +ACE_INLINE +CORBA_Context_out::CORBA_Context_out (CORBA_Context_out &p) + : ptr_ (p.ptr_) +{} + +ACE_INLINE CORBA_Context_out & +CORBA_Context_out::operator= (CORBA_Context_out &p) +{ + this->ptr_ = p.ptr_; + return *this; +} + +ACE_INLINE CORBA_Context_out & +CORBA_Context_out::operator= (const CORBA_Context_var &p) +{ + this->ptr_ = CORBA_Context::_duplicate (p.ptr ()); + return *this; +} + +ACE_INLINE CORBA_Context_out & +CORBA_Context_out::operator= (CORBA_Context_ptr p) +{ + this->ptr_ = p; + return *this; +} + +ACE_INLINE +CORBA_Context_out::operator CORBA_Context_ptr &() +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr & +CORBA_Context_out::ptr (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Context_ptr +CORBA_Context_out::operator-> (void) +{ + return this->ptr_; +} + +// ************************************************************* +// Inline operations for class CORBA_ContextList +// ************************************************************* + +ACE_INLINE +CORBA_ContextList::CORBA_ContextList (void) +{ +} + +ACE_INLINE CORBA::ULong +CORBA_ContextList::count (void) +{ + return (CORBA::ULong) this->ctx_list_.size (); +} + +ACE_INLINE CORBA_ContextList_ptr +CORBA_ContextList::_nil (void) +{ + return (CORBA_ContextList_ptr)0; +} + +ACE_INLINE CORBA_ContextList * +CORBA_ContextList::_duplicate (CORBA_ContextList* x) +{ + if (x != 0) + x->_incr_refcnt (); + return x; +} + +// ************************************************************* +// Inline operations for class CORBA_ContextList_var +// ************************************************************* + +// default constructor + +ACE_INLINE +CORBA_ContextList_var::CORBA_ContextList_var (void) + : ptr_ (CORBA_ContextList::_nil ()) +{} + +ACE_INLINE +CORBA_ContextList_var::CORBA_ContextList_var (CORBA_ContextList_ptr p) + : ptr_ (p) +{} + +ACE_INLINE CORBA_ContextList_ptr +CORBA_ContextList_var::ptr (void) const +{ + return this->ptr_; +} + +// copy constructor +ACE_INLINE +CORBA_ContextList_var::CORBA_ContextList_var (const CORBA_ContextList_var &p) + : ptr_ (p.ptr_->_duplicate ()) +{} + +ACE_INLINE +CORBA_ContextList_var::~CORBA_ContextList_var (void) // destructor +{ + this->ptr_->_destroy (); +} + +ACE_INLINE CORBA_ContextList_var & +CORBA_ContextList_var::operator= (CORBA_ContextList_ptr p) +{ + this->ptr_->_destroy (); + this->ptr_ = p; + return *this; +} + +ACE_INLINE CORBA_ContextList_var & +CORBA_ContextList_var::operator= (const CORBA_ContextList_var &p) +{ + if (this != &p) + { + this->ptr_->_destroy (); + this->ptr_ = p.ptr_->_duplicate (); + } + return *this; +} + +ACE_INLINE +CORBA_ContextList_var::operator const CORBA_ContextList_ptr &() const // cast +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_ContextList_var::operator CORBA_ContextList_ptr &() // cast +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr +CORBA_ContextList_var::operator-> (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr +CORBA_ContextList_var::in (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr & +CORBA_ContextList_var::inout (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr & +CORBA_ContextList_var::out (void) +{ + this->ptr_->_destroy (); + this->ptr_ = CORBA_ContextList::_nil (); + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr +CORBA_ContextList_var::_retn (void) +{ + // yield ownership of managed obj reference + CORBA_ContextList_ptr val = this->ptr_; + this->ptr_ = CORBA_ContextList::_nil (); + return val; +} + +// ************************************************************* +// Inline operations for class CORBA_ContextList_out +// ************************************************************* + +ACE_INLINE +CORBA_ContextList_out::CORBA_ContextList_out (CORBA_ContextList_ptr &p) + : ptr_ (p) +{ + this->ptr_ = CORBA_ContextList::_nil (); +} + +ACE_INLINE +CORBA_ContextList_out::CORBA_ContextList_out (CORBA_ContextList_var &p) + : ptr_ (p.out ()) +{ + this->ptr_->_destroy (); + this->ptr_ = CORBA_ContextList::_nil (); +} + +ACE_INLINE +CORBA_ContextList_out::CORBA_ContextList_out (CORBA_ContextList_out &p) + : ptr_ (p.ptr_) +{} + +ACE_INLINE CORBA_ContextList_out & +CORBA_ContextList_out::operator= (CORBA_ContextList_out &p) +{ + this->ptr_ = p.ptr_; + return *this; +} + +ACE_INLINE CORBA_ContextList_out & +CORBA_ContextList_out::operator= (const CORBA_ContextList_var &p) +{ + this->ptr_ = p.ptr ()->_duplicate (); + return *this; +} + +ACE_INLINE CORBA_ContextList_out & +CORBA_ContextList_out::operator= (CORBA_ContextList_ptr p) +{ + this->ptr_ = p; + return *this; +} + +ACE_INLINE +CORBA_ContextList_out::operator CORBA_ContextList_ptr &() +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr & +CORBA_ContextList_out::ptr (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ContextList_ptr +CORBA_ContextList_out::operator-> (void) +{ + return this->ptr_; +} diff --git a/TAO/tao/DynamicInterface/DII_Invocation.cpp b/TAO/tao/DynamicInterface/DII_Invocation.cpp new file mode 100644 index 00000000000..a1d7a4075f9 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Invocation.cpp @@ -0,0 +1,77 @@ +// $Id$ + + +#include "DII_Invocation.h" + +ACE_RCSID(DynamicInterface, DII_Invocation, "$Id$") + +#include "tao/Stub.h" +#include "tao/Principal.h" +#include "tao/Object_KeyC.h" +#include "tao/Transport_Mux_Strategy.h" +#include "tao/debug.h" + +#if !defined (__ACE_INLINE__) +# include "DII_Invocation.inl" +#endif /* ! __ACE_INLINE__ */ + + +void +TAO_GIOP_DII_Deferred_Invocation::start (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->TAO_GIOP_Invocation::start (ACE_TRY_ENV); + ACE_CHECK; + + this->target_spec_.target_specifier (this->profile_->object_key ()); + this->transport_->start_request (this->orb_core_, + this->target_spec_, + this->out_stream_, + ACE_TRY_ENV); + ACE_CHECK; +} + +int +TAO_GIOP_DII_Deferred_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->invoke_i (ACE_TRY_ENV); +} + + +int +TAO_GIOP_DII_Deferred_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Register a reply dispatcher for this Asynch_Invocation. Use the + // heap allocated reply dispatcher. + + int retval = + this->transport_->tms ()->bind_dispatcher (this->op_details_.request_id (), + this->rd_); + if (retval == -1) + { + // @@ What is the right way to handle this error? + this->close_connection (); + ACE_THROW_RETURN (CORBA::INTERNAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO), + TAO_INVOKE_EXCEPTION); + } + + // Just send the request, without trying to wait for the reply. + retval = TAO_GIOP_Invocation::invoke (0, + ACE_TRY_ENV); + ACE_CHECK_RETURN (retval); + + if (retval != TAO_INVOKE_OK) + { + return retval; + } + + // Everything executed ok; lets remember the transport for later. + this->rd_->transport (this->transport_); + + // We do not wait for the reply. Let us return. + return TAO_INVOKE_OK; +} + diff --git a/TAO/tao/DynamicInterface/DII_Invocation.h b/TAO/tao/DynamicInterface/DII_Invocation.h new file mode 100644 index 00000000000..3c5d2439c12 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Invocation.h @@ -0,0 +1,78 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + + +// ============================================================================ +// +// = LIBRARY +// DynamicInterface +// +// = DESCRIPTION +// The DII invocation classes. +// +// = AUTHOR +// Carlos O'Ryan and Alexander Babu Arulanthu +// +// +// ============================================================================ + +#ifndef TAO_DII_INVOCATION_H +#define TAO_DII_INVOCATION_H +#include "ace/pre.h" + +#include "tao/Invocation.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "DII_Reply_Dispatcher.h" +#include "Request.h" + +class TAO_DynamicInterface_Export TAO_GIOP_DII_Deferred_Invocation + : public TAO_GIOP_Invocation +{ + // = TITLE + // Sends a two-way request does not expect the reply. + // + // = DESCRIPTION + // This class connects (or lookups a connection from the cache) to + // the remote server, builds the CDR stream for the Request, send + // the CDR stream and returns. + // +public: + TAO_GIOP_DII_Deferred_Invocation (TAO_Stub *data, + TAO_ORB_Core* orb_core, + const CORBA::Request_ptr req); + // Constructor. + + void start (CORBA_Environment &TAO_IN_ENV = + TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Calls TAO_GIOP_Asynch_Invocation::start. + + int invoke (CORBA_Environment &TAO_IN_ENV = + TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Send request, block until any reply comes back, and unmarshal + // reply parameters as appropriate. + + const IOP::ServiceContextList& reply_service_info (void) const; + // Accessor to the reply ServiceContextList. + +private: + int invoke_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Implementation of the invoke() methods, handles the basic + // send/reply code and the system exceptions. + + TAO_DII_Deferred_Reply_Dispatcher *rd_; + // Reply dispatcher for the current synchronous Asynch_Invocation. +}; + +#if defined (__ACE_INLINE__) +# include "tao/DII_Invocation.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_ASYNCH_INVOCATION_H */ diff --git a/TAO/tao/DynamicInterface/DII_Invocation.inl b/TAO/tao/DynamicInterface/DII_Invocation.inl new file mode 100644 index 00000000000..70a21a36a73 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Invocation.inl @@ -0,0 +1,24 @@ +// This may look like C, but it's really -*- C++ -*- +// +// $Id$ +// + +ACE_INLINE +TAO_GIOP_DII_Deferred_Invocation:: +TAO_GIOP_DII_Deferred_Invocation (TAO_Stub *stub, + TAO_ORB_Core *orb_core, + const CORBA::Request_ptr req) + : TAO_GIOP_Invocation (stub, + req->operation (), + ACE_OS::strlen (req->operation ()), + orb_core), + rd_ (0) +{ + // New reply dispatcher on the heap, because + // we will go out of scope and hand over the + // reply dispatcher to the ORB. + // So this->rd_ is 0, because we do not need to + // hold a pointer to it. + ACE_NEW (rd_, + TAO_DII_Deferred_Reply_Dispatcher (req)); +} diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp new file mode 100644 index 00000000000..ff257fa4ea9 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp @@ -0,0 +1,130 @@ +// $Id$ + + +#include "DII_Reply_Dispatcher.h" + +ACE_RCSID(DynamicInterface, DII_Reply_Dispatcher, "$Id$") + +#include "Request.h" +#include "tao/Pluggable.h" +#include "tao/Environment.h" +#include "tao/GIOP_Message_State.h" +#include "tao/debug.h" + +#if !defined (__ACE_INLINE__) +#include "DII_Reply_Dispatcher.inl" +#endif /* __ACE_INLINE__ */ + +// Constructor. +TAO_DII_Deferred_Reply_Dispatcher::TAO_DII_Deferred_Reply_Dispatcher (const CORBA::Request_ptr req) + : req_ (req), + transport_ (0) +{ +} + +// Destructor. +TAO_DII_Deferred_Reply_Dispatcher::~TAO_DII_Deferred_Reply_Dispatcher (void) +{ + if (this->transport_ != 0) + { + this->transport_->idle_after_reply (); + } +} + +// Dispatch the reply. +int +TAO_DII_Deferred_Reply_Dispatcher::dispatch_reply ( + CORBA::ULong reply_status, + const TAO_GIOP_Version & /* version */, + IOP::ServiceContextList &reply_ctx, + TAO_GIOP_Message_State *message_state + ) +{ + this->reply_status_ = reply_status; + this->message_state_ = message_state; + + // Steal the buffer, that way we don't do any unnecesary copies of + // this data. + CORBA::ULong max = reply_ctx.maximum (); + CORBA::ULong len = reply_ctx.length (); + IOP::ServiceContext* context_list = reply_ctx.get_buffer (1); + this->reply_service_info_.replace (max, len, context_list, 1); + + if (TAO_debug_level >= 4) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P | %t):TAO_Asynch_Reply_Dispatcher::dispatch_reply:\n"))); + } + + ACE_TRY_NEW_ENV + { + // Call the Request back and send the reply data. + this->req_->handle_response (this->message_state_->cdr, + reply_status, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + if (TAO_debug_level >= 4) + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception during reply handler"); + } + } + ACE_ENDTRY; + + // This was dynamically allocated. Now the job is done. Commit + // suicide here. + delete this; + + return 1; +} + +TAO_GIOP_Message_State * +TAO_DII_Deferred_Reply_Dispatcher::message_state (void) +{ + return this->message_state_; +} + +void +TAO_DII_Deferred_Reply_Dispatcher::dispatcher_bound (TAO_Transport*) +{ +} + +void +TAO_DII_Deferred_Reply_Dispatcher::connection_closed (void) +{ + ACE_TRY_NEW_ENV + { + // Generate a fake exception.... + CORBA::COMM_FAILURE comm_failure (0, + CORBA::COMPLETED_MAYBE); + + TAO_OutputCDR out_cdr; + + comm_failure._tao_encode (out_cdr, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Turn into an output CDR + TAO_InputCDR cdr (out_cdr); + + this->req_->handle_response (cdr, + TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + if (TAO_debug_level >= 4) + { + ACE_PRINT_EXCEPTION ( + ACE_ANY_EXCEPTION, + "DII_Deferred_Reply_Dispacher::connection_closed" + ); + } + } + ACE_ENDTRY; +} + diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h new file mode 100644 index 00000000000..44854fa79aa --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h @@ -0,0 +1,94 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = DESCRIPTION +// Dispatch the reply appropriately. +// +// = AUTHOR +// Alexander Babu Arulanthu +// +// ============================================================================ + +#ifndef TAO_DII_REPLY_DISPATCHER_H +#define TAO_DII_REPLY_DISPATCHER_H +#include "ace/pre.h" + +#include "tao/orbconf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "dynamicinterface_export.h" +#include "tao/Reply_Dispatcher.h" + +class TAO_DynamicInterface_Export TAO_DII_Deferred_Reply_Dispatcher + : public TAO_Reply_Dispatcher +{ + // = TITLE + // TAO_DII_Deferred_Reply_Dispatcher + // + // = DESCRIPTION + // Reply dispatcher for DII deferred requests. + // +public: + TAO_DII_Deferred_Reply_Dispatcher (const CORBA::Request_ptr req); + // Constructor. + + virtual ~TAO_DII_Deferred_Reply_Dispatcher (void); + // Destructor. + + CORBA::ULong reply_status (void) const; + // Get the reply status. + + const TAO_GIOP_Version& version (void) const; + // Get the GIOP version + + void transport (TAO_Transport *t); + // Sets the transport for this invocation. + + // = The Reply_Dispatcher methods + virtual int dispatch_reply (CORBA::ULong reply_status, + const TAO_GIOP_Version& version, + IOP::ServiceContextList& reply_ctx, + TAO_GIOP_Message_State* message_state); + virtual TAO_GIOP_Message_State *message_state (void); + virtual void dispatcher_bound (TAO_Transport*); + virtual void connection_closed (void); + +protected: + IOP::ServiceContextList reply_service_info_; + // The service context list + // Note, that this is not a reference as in + // the synchronous case. We own the reply_service_info + // because our TAO_Asynch_Invocation will go out + // of scope before we are done. + +private: + CORBA::ULong reply_status_; + // Reply or LocateReply status. + + TAO_GIOP_Message_State *message_state_; + // CDR stream for reading the input. + // @@ Carlos : message_state should go away. All we need is the reply + // cdr. Is that right? (Alex). + + const CORBA::Request_ptr req_; + // Where the reply needs to go. + + TAO_Transport *transport_; + // This invocation is using this transport, may change... +}; + +#if defined (__ACE_INLINE__) +#include "tao/DII_Reply_Dispatcher.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_REPLY_DISPATCHER_H */ diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.inl b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.inl new file mode 100644 index 00000000000..d1b661944c4 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.inl @@ -0,0 +1,26 @@ +// $Id$ + +#if (TAO_HAS_MINIMUM_CORBA == 0) + +ACE_INLINE CORBA::ULong +TAO_DII_Deferred_Reply_Dispatcher::reply_status (void) const +{ + return this->reply_status_; +} + +#if 0 +ACE_INLINE const TAO_GIOP_Version& +TAO_DII_Deferred_Reply_Dispatcher::version (void) const +{ + return this->version_; +} + +#endif /*If 0 */ + +ACE_INLINE void +TAO_DII_Deferred_Reply_Dispatcher::transport (TAO_Transport *t) +{ + this->transport_ = t; +} + +#endif /* TAO_HAS_MINIMUM_CORBA */ diff --git a/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp new file mode 100644 index 00000000000..5e87524c347 --- /dev/null +++ b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp @@ -0,0 +1,198 @@ +// $Id$ + +#include "Dynamic_Adapter_Impl.h" +#include "Request.h" +#include "Server_Request.h" +#include "tao/Invocation.h" + +ACE_RCSID(DynamicInterface, TAO_Dynamic_Adapter_Impl, "$Id$") + +TAO_Dynamic_Adapter_Impl::TAO_Dynamic_Adapter_Impl (void) +{ +} + +TAO_Dynamic_Adapter_Impl::~TAO_Dynamic_Adapter_Impl (void) +{ +} + +void +TAO_Dynamic_Adapter_Impl::create_request ( + CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const char *operation, + CORBA::NVList_ptr arg_list, + CORBA::NamedValue_ptr result, + CORBA::ExceptionList_ptr exceptions, + CORBA::Request_ptr &request, + CORBA::Flags req_flags, + CORBA_Environment &ACE_TRY_ENV + ) +{ + ACE_NEW_THROW_EX (request, + CORBA::Request (obj, + orb, + operation, + arg_list, + result, + req_flags, + exceptions, + ACE_TRY_ENV), + CORBA::NO_MEMORY ( + CORBA_SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM + ), + CORBA::COMPLETED_MAYBE + )); +} + +CORBA::Request_ptr +TAO_Dynamic_Adapter_Impl::request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const char *operation, + CORBA::Environment &ACE_TRY_ENV) +{ + CORBA::Request_ptr req = CORBA::Request::_nil (); + ACE_NEW_THROW_EX (req, + CORBA::Request (obj, + orb, + operation, + ACE_TRY_ENV), + CORBA::NO_MEMORY ( + CORBA_SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM + ), + CORBA::COMPLETED_MAYBE + )); + ACE_CHECK_RETURN (CORBA::Request::_nil ()); + + return req; +} + +CORBA::Boolean +TAO_Dynamic_Adapter_Impl::context_is_nil (CORBA::Context_ptr ctx) +{ + return ctx == 0; +} + +void +TAO_Dynamic_Adapter_Impl::context_release (CORBA::Context_ptr ctx) +{ + if (ctx != 0) + { + ctx->_decr_refcnt (); + } +} + +CORBA::Boolean +TAO_Dynamic_Adapter_Impl::request_is_nil (CORBA::Request_ptr req) +{ + return req == 0; +} + +void +TAO_Dynamic_Adapter_Impl::request_release (CORBA::Request_ptr req) +{ + if (req != 0) + { + req->_decr_refcnt (); + } +} + +CORBA::Boolean +TAO_Dynamic_Adapter_Impl::server_request_is_nil (CORBA::ServerRequest_ptr req) +{ + return req == 0; +} + +void +TAO_Dynamic_Adapter_Impl::server_request_release (CORBA::ServerRequest_ptr req) +{ + if (req != 0) + { + req->_decr_refcnt (); + } +} + +void +TAO_Dynamic_Adapter_Impl::create_exception_list ( + CORBA::ExceptionList_ptr &list, + CORBA_Environment &ACE_TRY_ENV + ) +{ + ACE_NEW_THROW_EX (list, + CORBA::ExceptionList, + CORBA::NO_MEMORY ( + CORBA_SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM + ), + CORBA::COMPLETED_NO + )); +} + +CORBA::Exception * +TAO_Dynamic_Adapter_Impl::decode_user_exception ( + CORBA::ExceptionList_ptr exceptions, + TAO_GIOP_Twoway_Invocation *invocation, + const char *buf, + CORBA::Environment &ACE_TRY_ENV + ) +{ + for (CORBA::ULong i = 0; + exceptions != 0 && i < exceptions->count (); + i++) + { + CORBA::TypeCode_ptr tcp = exceptions->item (i, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + const char *xid = tcp->id (ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + if (ACE_OS::strcmp (buf, xid) != 0) + { + continue; + } + + const ACE_Message_Block *cdr = invocation->inp_stream ().start (); + + CORBA_Any any (tcp, + 0, + invocation->inp_stream ().byte_order (), + cdr); + + CORBA_Exception *exception = 0; + + ACE_NEW_RETURN (exception, + CORBA_UnknownUserException (any), + 0); + + return exception; + } + + return 0; +} + +int +TAO_Dynamic_Adapter_Impl::Initializer (void) +{ + ACE_Service_Config::static_svcs ()->insert ( + &ace_svc_desc_TAO_Dynamic_Adapter_Impl + ); + + return 0; +} + +ACE_STATIC_SVC_DEFINE ( + TAO_Dynamic_Adapter_Impl, + ACE_TEXT ("Dynamic_Adapter"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_Dynamic_Adapter_Impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0 + ) + +ACE_FACTORY_DEFINE (TAO_DynamicInterface, TAO_Dynamic_Adapter_Impl) + diff --git a/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h new file mode 100644 index 00000000000..4503c0204e8 --- /dev/null +++ b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h @@ -0,0 +1,122 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// DynamicInterface +// +// = FILENAME +// Dynamic_Adapter_Impl.h +// +// = DESCRIPTION +// Header file for class TAO_Dynamic_Adapter_Impl. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_DYNAMIC_ADAPTER_IMPL_H +#define TAO_DYNAMIC_ADAPTER_IMPL_H +#include "ace/pre.h" + +#include "dynamicinterface_export.h" +#include "tao/Dynamic_Adapter.h" +#include "ace/Service_Config.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_DynamicInterface_Export TAO_Dynamic_Adapter_Impl + : public TAO_Dynamic_Adapter +{ + // = TITLE + // TAO_Dynamic_Adapter_Impl. + // + // = DESCRIPTION + // Concrete subclass of TAO_Dynamic_Adapter + // in the TAO library. This class helps implement various + // functions in the CORBA namespace relating to DII/DSI + // invocations. + // +public: + TAO_Dynamic_Adapter_Impl (void); + virtual ~TAO_Dynamic_Adapter_Impl (void); + + // CORBA::Object::_create_request and CORBA::Object::_request. + + virtual void create_request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const char *operation, + CORBA::NVList_ptr arg_list, + CORBA::NamedValue_ptr result, + CORBA::ExceptionList_ptr exceptions, + CORBA::Request_ptr &request, + CORBA::Flags req_flags, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + virtual CORBA::Request_ptr request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const char *op, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + // CORBA::is_nil and CORBA::release for Context, Request, and ServerRequest. + + virtual CORBA::Boolean context_is_nil (CORBA::Context_ptr ctx); + + virtual CORBA::Boolean request_is_nil (CORBA::Request_ptr req); + + virtual CORBA::Boolean server_request_is_nil (CORBA::ServerRequest_ptr req); + + virtual void context_release (CORBA::Context_ptr ctx); + + virtual void request_release (CORBA::Request_ptr req); + + virtual void server_request_release (CORBA::ServerRequest_ptr req); + + // CORBA::ORB::create_exception_list. + + virtual void create_exception_list (CORBA::ExceptionList_ptr &list, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + // Decoding the user exception in the DII version of + // TAO_GIOP_Twoway_Invocation::invoke(). + + virtual CORBA::Exception *decode_user_exception ( + CORBA::ExceptionList_ptr exceptions, + TAO_GIOP_Twoway_Invocation *invocation, + const char *buf, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment () + ); + + // Used to force the initialization of the ORB code. + static int Initializer (void); +}; + +ACE_STATIC_SVC_DECLARE (TAO_Dynamic_Adapter_Impl) +ACE_FACTORY_DECLARE (TAO_DynamicInterface, TAO_Dynamic_Adapter_Impl) + +#if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) + +typedef int (*TAO_Module_Initializer) (void); + +static TAO_Module_Initializer +TAO_Requires_Request_Factory_Initializer = + &TAO_Dynamic_Adapter_Impl::Initializer; + +#else + +static int +TAO_Requires_Request_Factory_Initializer = + TAO_Dynamic_Adapter_Impl::Initializer (); + +#endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */ + +#include "ace/post.h" +#endif /* TAO_DYNAMIC_ADAPTER_IMPL_H */ diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp new file mode 100644 index 00000000000..83c8003d8ab --- /dev/null +++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp @@ -0,0 +1,137 @@ +// $Id$ + +#include "Dynamic_Implementation.h" +#include "Server_Request.h" +#include "tao/ORB_Core.h" +#include "tao/PortableServer/POA.h" +#include "tao/PortableServer/Collocated_Object.h" + +ACE_RCSID(DynamicInterface, Dynamic_Implementation, "$Id$") + +CORBA::Object_ptr +TAO_DynamicImplementation::_this (CORBA::Environment &ACE_TRY_ENV) +{ + // The _this() function returns a CORBA::Object_ptr for the target + // object. Unlike _this() for static skeletons, its return type is + // not interface-specific because a DSI servant may very well + // incarnate multiple CORBA objects of different types. + TAO_Stub *stub = this->_create_stub (ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + // Create a object. + TAO_Collocated_Object *retval = 0; + ACE_NEW_RETURN (retval, + TAO_Collocated_Object (stub, + 1, + this), + CORBA::Object::_nil ()); + + return retval; +} + +const char * +TAO_DynamicImplementation::_interface_repository_id (void) const +{ + // This should never be called. + return 0; +} + +void * +TAO_DynamicImplementation::_downcast (const char *repository_id) +{ + ACE_UNUSED_ARG (repository_id); + + // Don't know enough to do better. + return this; +} + +TAO_Stub * +TAO_DynamicImplementation::_create_stub (CORBA::Environment &ACE_TRY_ENV) +{ + // If DynamicImplementation::_this() is invoked outside of the + // context of a request invocation on a target object being served + // by the DSI servant, it raises the PortableServer::WrongPolicy + // exception. + TAO_POA_Current_Impl *poa_current_impl = + ACE_static_cast(TAO_POA_Current_Impl *, + TAO_TSS_RESOURCES::instance ()->poa_current_impl_); + + if (poa_current_impl == 0 + || this != poa_current_impl->servant ()) + { + ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (), + 0); + } + + PortableServer::POA_var poa = poa_current_impl->get_POA (ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + CORBA::RepositoryId interface = + this->_primary_interface (poa_current_impl->object_id (), + poa.in (), + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + CORBA::PolicyList_var client_exposed_policies = + poa_current_impl->poa ()->client_exposed_policies ( + poa_current_impl->priority (), + ACE_TRY_ENV + ); + ACE_CHECK_RETURN (0); + + // @@ PPOA + // @@ return orb->create_stub_object ( + // @@ client_exposed_policies._retn (), + // @@ poa_current_impl->poa (), + // @@ ACE_TRY_ENV); + return poa_current_impl->poa ()->key_to_stub ( + poa_current_impl->object_key (), + interface, + poa_current_impl->priority (), + ACE_TRY_ENV + ); +} + +void +TAO_DynamicImplementation::_dispatch (TAO_ServerRequest &request, + void *context, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_UNUSED_ARG (context); + + // Create DSI request object. + CORBA::ServerRequest *dsi_request = 0; + ACE_NEW (dsi_request, + CORBA::ServerRequest (request)); + + // Delegate to user. + this->invoke (dsi_request, + ACE_TRY_ENV); + ACE_CHECK; + + if (request.response_expected ()) + { + request.init_reply (ACE_TRY_ENV); + ACE_CHECK; + + dsi_request->dsi_marshal (ACE_TRY_ENV); + ACE_CHECK; + } + + ACE_TRY + { + if ((!request.sync_with_server () && request.response_expected ())) + { + request.tao_send_reply (); + ACE_TRY_CHECK; + } + } + ACE_CATCH(CORBA::Exception,ex) + { + request.tao_send_reply_exception(ex); + } + ACE_ENDTRY; + + CORBA::release (dsi_request); +} + diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.h b/TAO/tao/DynamicInterface/Dynamic_Implementation.h new file mode 100644 index 00000000000..810245bbbd5 --- /dev/null +++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.h @@ -0,0 +1,85 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// DynamicInterface +// +// = FILENAME +// Dynamic_Implementation.h +// +// = DESCRIPTION +// Header file for class TAO_DynamicImplementation. +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#ifndef TAO_DYNAMIC_IMPLEMENTATION_H +#define TAO_DYNAMIC_IMPLEMENTATION_H +#include "ace/pre.h" + +#include "tao/PortableServer/Servant_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "dynamicinterface_export.h" + +class TAO_DynamicInterface_Export TAO_DynamicImplementation + : public virtual TAO_ServantBase +{ + // = TITLE + // Base class for DSI. + // + // = DESCRIPTION + // It is expected that the and <_primary_interface> + // methods will be only invoked by the POA in the context of + // serving a CORBA request. Invoking this method in other + // circumstances may lead to unpredictable results. +public: + virtual void invoke (CORBA::ServerRequest_ptr request, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()) = 0; + // The invoke() method receives requests issued to any CORBA object + // incarnated by the DSI servant and performs the processing + // necessary to execute the request. + + virtual CORBA::RepositoryId _primary_interface ( + const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment () + ) = 0; + // The _primary_interface() method receives an ObjectId value and a + // POA_ptr as input parameters and returns a valid RepositoryId + // representing the most-derived interface for that oid. + + CORBA::Object_ptr _this (CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Returns a CORBA::Object_ptr for the target object. + +protected: + + virtual const char *_interface_repository_id (void) const; + // Return 0. Should never be used. + + virtual void *_downcast (const char *repository_id); + // Simply returns "this" + + virtual TAO_Stub *_create_stub (CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // This is an auxiliary method for _this() and _narrow(). + + virtual void _dispatch (TAO_ServerRequest &request, + void *context, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Turns around and calls invoke. +}; + +#include "ace/post.h" +#endif /* TAO_DYNAMIC_IMPLEMENTATION_H */ diff --git a/TAO/tao/DynamicInterface/ExceptionList.cpp b/TAO/tao/DynamicInterface/ExceptionList.cpp new file mode 100644 index 00000000000..dfe4bace7a4 --- /dev/null +++ b/TAO/tao/DynamicInterface/ExceptionList.cpp @@ -0,0 +1,119 @@ +// $Id$ + +#include "ExceptionList.h" +#include "tao/Typecode.h" +#include "tao/Environment.h" + +#if !defined (__ACE_INLINE__) +# include "ExceptionList.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(DynamicInterface, ExceptionList, "$Id$") + +CORBA_ExceptionList::CORBA_ExceptionList (CORBA::ULong len, + CORBA::TypeCode_ptr *tc_list) + : ref_count_ (1) +{ + for (CORBA::ULong i = 0; i < len; ++i) + { + this->add (tc_list [i]); + } +} + +CORBA_ExceptionList::~CORBA_ExceptionList (void) +{ + for (CORBA::ULong i = 0; i < this->count (); ++i) + { + CORBA::TypeCode_ptr *tc = 0; + + if (this->tc_list_.get (tc, i) == -1) + { + return; + } + + CORBA::release (*tc); + } +} + +void +CORBA_ExceptionList::add (CORBA::TypeCode_ptr tc) +{ + this->tc_list_.enqueue_tail (CORBA::TypeCode::_duplicate (tc)); +} + +void +CORBA_ExceptionList::add_consume (CORBA::TypeCode_ptr tc) +{ + this->tc_list_.enqueue_tail (tc); +} + +CORBA::TypeCode_ptr +CORBA_ExceptionList::item (CORBA::ULong slot, + CORBA::Environment &ACE_TRY_ENV) +{ + CORBA::TypeCode_ptr *tc = 0; + + if (this->tc_list_.get (tc, slot) == -1) + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + CORBA::TypeCode::_nil ()); + } + else + { + return CORBA::TypeCode::_duplicate (*tc); + } +} + +void +CORBA_ExceptionList::remove (CORBA::ULong, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA_ExceptionList_ptr +CORBA_ExceptionList::_duplicate (void) +{ + this->_incr_refcnt (); + return this; +} + +void +CORBA_ExceptionList::_destroy (void) +{ + this->_decr_refcnt (); +} + +void +CORBA_ExceptionList::_incr_refcnt (void) +{ + this->ref_count_++; +} + +void +CORBA_ExceptionList::_decr_refcnt (void) +{ + this->ref_count_--; + + if (this->ref_count_ == 0) + { + delete this; + } +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Node; +template class ACE_Unbounded_Queue; +template class ACE_Unbounded_Queue_Iterator; +template class ACE_Atomic_Op; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Node +#pragma instantiate ACE_Unbounded_Queue +#pragma instantiate ACE_Unbounded_Queue_Iterator +#pragma instantiate ACE_Atomic_Op + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/tao/DynamicInterface/ExceptionList.h b/TAO/tao/DynamicInterface/ExceptionList.h new file mode 100644 index 00000000000..9a8f3e3f969 --- /dev/null +++ b/TAO/tao/DynamicInterface/ExceptionList.h @@ -0,0 +1,152 @@ +// This may look like C, but it's really -*- C++ -*- +// +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// DynamicInterface +// +// = FILENAME +// ExceptionList.h +// +// = DESCRIPTION +// This file defines the ExceptionList datatype used in +// dynamic invocations. +// +// = AUTHOR +// Copyright 1994-1995 by Sun Microsystems Inc. +// +// ============================================================================ + +#ifndef TAO_CORBA_EXCEPTIONLIST_H +#define TAO_CORBA_EXCEPTIONLIST_H +#include "ace/pre.h" + +#include "tao/corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "dynamicinterface_export.h" + +class CORBA_ExceptionList; +typedef CORBA_ExceptionList *CORBA_ExceptionList_ptr; + +class TAO_DynamicInterface_Export CORBA_ExceptionList +{ + // = TITLE + // ExceptionList definition taken from CORBA v2.2 Feb 1998. + // + // = DESCRIPTION + // Maintains a list of TypeCodes for Exceptions. +public: + // = Intialization and termination methods. + + CORBA_ExceptionList (void); + // Constructor. + + CORBA_ExceptionList (CORBA::ULong len, + CORBA::TypeCode_ptr *tc_list); + // Constructor - initialize given a length and an array of + // TypeCodes. + + ~CORBA_ExceptionList (void); + // Destructor. + + CORBA::ULong count (void); + // Return the number of elements. + + CORBA_ExceptionList_ptr _duplicate (void); + // Increase the reference count. + + static CORBA_ExceptionList_ptr _duplicate (CORBA_ExceptionList *); + // Increase the reference count in the spec defined manner. + + void _destroy (void); + + static CORBA_ExceptionList_ptr _nil (void); + + void add (CORBA::TypeCode_ptr tc); + // Add a TypeCode to the list. + + void add_consume (CORBA::TypeCode_ptr tc); + // Add and consume a TypeCode to the list. + + CORBA::TypeCode_ptr item (CORBA::ULong slot, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Return the typecode at slot i. Raises the "Bounds" exception. + + void remove (CORBA::ULong slot, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Remove the typecode at slot i. Raises the "Bounds" exception. + + void _incr_refcnt (void); + void _decr_refcnt (void); + // Increment and decrement ref counts. + +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA::ExceptionList_ptr _ptr_type; + typedef CORBA::ExceptionList_var _var_type; +#endif /* __GNUC__ */ + // Useful for template programming. + +private: + // = Not allowed. + CORBA_ExceptionList (const CORBA_ExceptionList &); + CORBA_ExceptionList &operator= (const CORBA_ExceptionList &); + + ACE_Atomic_Op ref_count_; + // Reference counter. + + ACE_Unbounded_Queue tc_list_; + // Internal list of typecodes. +}; + +class TAO_DynamicInterface_Export CORBA_ExceptionList_var +{ + // = TITLE + // CORBA_ExceptionList_var + // + // = DESCRIPTION + // Lifecycle management helper class for ExceptionList objects. +public: + CORBA_ExceptionList_var (void); + // Default constructor. + + CORBA_ExceptionList_var (CORBA_ExceptionList_ptr); + + CORBA_ExceptionList_var (const CORBA_ExceptionList_var &); + // Copy constructor. + + ~CORBA_ExceptionList_var (void); + // Destructor. + + CORBA_ExceptionList_var &operator= (CORBA_ExceptionList_ptr); + CORBA_ExceptionList_var &operator= (const CORBA_ExceptionList_var &); + CORBA_ExceptionList_ptr operator-> (void) const; + + operator const CORBA_ExceptionList_ptr &() const; + operator CORBA_ExceptionList_ptr &(); + + // in, inout, out, _retn. + CORBA_ExceptionList_ptr in (void) const; + CORBA_ExceptionList_ptr &inout (void); + CORBA_ExceptionList_ptr &out (void); + CORBA_ExceptionList_ptr _retn (void); + CORBA_ExceptionList_ptr ptr (void) const; + +private: + CORBA_ExceptionList_ptr ptr_; +}; + +#if defined (__ACE_INLINE__) +# include "ExceptionList.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_CORBA_EXCEPTIONLIST_H */ + diff --git a/TAO/tao/DynamicInterface/ExceptionList.inl b/TAO/tao/DynamicInterface/ExceptionList.inl new file mode 100644 index 00000000000..dc7b3121afc --- /dev/null +++ b/TAO/tao/DynamicInterface/ExceptionList.inl @@ -0,0 +1,137 @@ +ACE_INLINE +CORBA_ExceptionList::CORBA_ExceptionList (void) + : ref_count_ (1) +{ +} + +ACE_INLINE CORBA::ULong +CORBA_ExceptionList::count (void) +{ + return (CORBA::ULong) this->tc_list_.size (); +} + +ACE_INLINE CORBA_ExceptionList_ptr +CORBA_ExceptionList::_nil (void) +{ + return (CORBA_ExceptionList_ptr)0; +} + +ACE_INLINE CORBA_ExceptionList * +CORBA_ExceptionList::_duplicate (CORBA_ExceptionList* x) +{ + if (x != 0) + { + x->_incr_refcnt (); + } + + return x; +} + +ACE_INLINE +CORBA_ExceptionList_var::CORBA_ExceptionList_var (void) // default constructor + : ptr_ (CORBA_ExceptionList::_nil ()) +{} + +ACE_INLINE +CORBA_ExceptionList_var::CORBA_ExceptionList_var (CORBA_ExceptionList_ptr p) + : ptr_ (p) +{} + +ACE_INLINE CORBA_ExceptionList_ptr +CORBA_ExceptionList_var::ptr (void) const +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_ExceptionList_var::CORBA_ExceptionList_var (const CORBA_ExceptionList_var &p) // copy constructor + : ptr_ (CORBA_ExceptionList::_duplicate (p.ptr_)) +{ +} + +ACE_INLINE +CORBA_ExceptionList_var::~CORBA_ExceptionList_var (void) // destructor +{ + if (this->ptr_ != 0) + { + this->ptr_->_destroy (); + } +} + +ACE_INLINE CORBA_ExceptionList_var & +CORBA_ExceptionList_var::operator= (CORBA_ExceptionList_ptr p) +{ + if (this->ptr_ != 0) + { + this->ptr_->_destroy (); + } + + this->ptr_ = p; + return *this; +} + +ACE_INLINE CORBA_ExceptionList_var & +CORBA_ExceptionList_var::operator= (const CORBA_ExceptionList_var &p) +{ + if (this != &p) + { + if (this->ptr_ != 0) + { + this->ptr_->_destroy (); + } + + this->ptr_ = CORBA_ExceptionList::_duplicate (p.ptr_); + } + + return *this; +} + +ACE_INLINE +CORBA_ExceptionList_var::operator const CORBA_ExceptionList_ptr &() const +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_ExceptionList_var::operator CORBA_ExceptionList_ptr &() +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ExceptionList_ptr +CORBA_ExceptionList_var::operator-> (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ExceptionList_ptr +CORBA_ExceptionList_var::in (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ExceptionList_ptr & +CORBA_ExceptionList_var::inout (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_ExceptionList_ptr & +CORBA_ExceptionList_var::out (void) +{ + if (this->ptr_ != 0) + { + this->ptr_->_destroy (); + } + + this->ptr_ = CORBA_ExceptionList::_nil (); + return this->ptr_; +} + +ACE_INLINE CORBA_ExceptionList_ptr +CORBA_ExceptionList_var::_retn (void) +{ + CORBA_ExceptionList_ptr val = this->ptr_; + this->ptr_ = CORBA_ExceptionList::_nil (); + return val; +} diff --git a/TAO/tao/DynamicInterface/Makefile b/TAO/tao/DynamicInterface/Makefile new file mode 100644 index 00000000000..11db7283986 --- /dev/null +++ b/TAO/tao/DynamicInterface/Makefile @@ -0,0 +1,59 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +MAKEFILE = Makefile +LIBNAME = libTAO_DynamicInterface +LIB = $(LIBNAME).a +SHLIB = $(LIBNAME).$(SOEXT) + +ACE_SHLIBS = -lTAO_PortableServer -lTAO -lACE + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +CPP_SRCS += \ + Context \ + DII_Invocation \ + DII_Reply_Dispatcher \ + Dynamic_Adapter_Impl \ + Dynamic_Implementation \ + ExceptionList \ + Request \ + Server_Request + +FILES = $(CPP_SRCS) +DEFS = $(addsuffix .h,$(FILES)) +LSRC = $(addsuffix .cpp,$(FILES)) + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local targets (and local hacks) +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/tao +CPPFLAGS += -I$(TAO_ROOT) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + diff --git a/TAO/tao/DynamicInterface/Makefile.bor b/TAO/tao/DynamicInterface/Makefile.bor new file mode 100644 index 00000000000..6f9327b7090 --- /dev/null +++ b/TAO/tao/DynamicInterface/Makefile.bor @@ -0,0 +1,31 @@ +# +# Makefile for building the TAO DynamicInterface library +# + +NAME = TAO_DynamicInterface + +OBJFILES = \ + $(OBJDIR)\Context.obj \ + $(OBJDIR)\DII_Invocation.obj \ + $(OBJDIR)\DII_Reply_Dispatcher.obj \ + $(OBJDIR)\Dynamic_Adapter_Impl.obj \ + $(OBJDIR)\Dynamic_Implementation.obj \ + $(OBJDIR)\ExceptionList.obj \ + $(OBJDIR)\Request.obj \ + $(OBJDIR)\Server_Request.obj + +!ifdef STATIC +CFLAGS = $(ACE_CFLAGS) $(TAO_CFLAGS) $(TAO_DYNAMICINTERFACE_CFLAGS) +!else +CFLAGS = $(ACE_CFLAGS) $(TAO_CFLAGS) $(TAO_DYNAMICINTERFACE_CFLAGS) \ + -DTAO_DYNAMICINTERFACE_BUILD_DLL +!endif + +CPPDIR = . + +INCDIR_NAME = tao\DynamicInterface +INCLUDES = *.h *.i + +LIBFILES = $(ACE_LIB) $(TAO_LIB) $(TAO_PORTABLESERVER_LIB) + +!include <$(ACE_ROOT)\include\makeinclude\build_core_library.bor> diff --git a/TAO/tao/DynamicInterface/Request.cpp b/TAO/tao/DynamicInterface/Request.cpp new file mode 100644 index 00000000000..9837a2e52fc --- /dev/null +++ b/TAO/tao/DynamicInterface/Request.cpp @@ -0,0 +1,428 @@ +// $Id$ + +#include "Request.h" +#include "ExceptionList.h" +#include "DII_Invocation.h" +#include "tao/Object.h" + +#if !defined (__ACE_INLINE__) +# include "Request.inl" +#endif /* ! __ACE_INLINE__ */ + +ACE_RCSID(DynamicInterface, Request, "$Id$") + +// Reference counting for DII Request object + +CORBA::ULong +CORBA_Request::_incr_refcnt (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + return this->refcount_++; +} + +CORBA::ULong +CORBA_Request::_decr_refcnt (void) +{ + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + this->refcount_--; + + if (this->refcount_ != 0) + { + return this->refcount_; + } + } + + delete this; + return 0; +} + +// DII Request class implementation + +CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const CORBA::Char *op, + CORBA::NVList_ptr args, + CORBA::NamedValue_ptr result, + CORBA::Flags flags, + CORBA::ExceptionList_ptr exceptions, + CORBA::Environment &ACE_TRY_ENV) + : orb_ (CORBA::ORB::_duplicate (orb)), + args_ (CORBA::NVList::_duplicate (args)), + result_ (CORBA::NamedValue::_duplicate (result)), + flags_ (flags), + env_ (ACE_TRY_ENV), + exceptions_ (CORBA::ExceptionList::_duplicate (exceptions)), + contexts_ (0), + ctx_ (CORBA::Context::_nil ()), + refcount_ (1), + lazy_evaluation_ (0), + response_received_ (0) +{ + this->target_ = CORBA::Object::_duplicate (obj); + this->opname_ = CORBA::string_dup (op); + + if (this->exceptions_.in () == 0) + { + CORBA::ExceptionList *tmp = 0; + ACE_NEW (tmp, + CORBA::ExceptionList); + + this->exceptions_ = tmp; + } +} + +CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const CORBA::Char *op, + CORBA::Environment &ACE_TRY_ENV) + : orb_ (CORBA::ORB::_duplicate (orb)), + flags_ (0), + env_ (ACE_TRY_ENV), + contexts_ (0), + ctx_ (CORBA::Context::_nil ()), + refcount_ (1), + lazy_evaluation_ (0), + response_received_ (0) +{ + this->target_ = CORBA::Object::_duplicate (obj); + this->opname_ = CORBA::string_dup (op); + + CORBA::ExceptionList *tmp = 0; + ACE_NEW (tmp, + CORBA::ExceptionList); + + this->exceptions_ = tmp; + + ACE_NEW (this->args_, + CORBA::NVList); + + ACE_NEW (this->result_, + CORBA::NamedValue); +} + +CORBA_Request::~CORBA_Request (void) +{ + ACE_ASSERT (refcount_ == 0); + + CORBA::release (this->target_); + CORBA::string_free ((char*) this->opname_); + this->opname_ = 0; + CORBA::release (this->args_); + CORBA::release (this->result_); +} + +// The public DII interfaces: normal and oneway calls. +// +// NOTE that using DII, programmers can get the special behaviour of +// discarding the response for normal calls. This doesn't change the +// semantics of any OMG-IDL interface, it just streamlines control +// flow in some exotic situations. + +void +CORBA_Request::invoke (CORBA::Environment &ACE_TRY_ENV) +{ + TAO_GIOP_Twoway_Invocation call (this->target_->_stubobj (), + this->opname_, + ACE_OS::strlen (this->opname_), + this->orb_->orb_core ()); + + // Loop as needed for forwarding. + for (;;) + { + call.start (ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Short flag = TAO_TWOWAY_RESPONSE_FLAG; + + call.prepare_header (ACE_static_cast (CORBA::Octet, + flag), + ACE_TRY_ENV); + ACE_CHECK; + + this->args_->_tao_encode (call.out_stream (), + this->orb_->orb_core (), + CORBA::ARG_IN | CORBA::ARG_INOUT, + ACE_TRY_ENV); + ACE_CHECK; + + // Make the call ... blocking for the response. + int status = call.invoke (this->exceptions_.in (), + ACE_TRY_ENV); + ACE_CHECK; + + if (status == TAO_INVOKE_RESTART) + { + continue; + } + + if (status == TAO_INVOKE_EXCEPTION) + { + // Shouldn't happen. + return; + } + + if (status != TAO_INVOKE_OK) + { + ACE_THROW (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_MAYBE)); + } + + // The only case left is status == TAO_INVOKE_OK, exit the + // loop. We cannot retry because at this point we either + // got a reply or something with an status of + // COMPLETED_MAYBE, thus we cannot reissue the request if we + // are to satisfy the "at most once" semantics. + break; + } + + // Now, get all the "return", "out", and "inout" parameters + // from the response message body ... return parameter is + // first, the rest are in the order defined in the IDL spec + // (which is also the order that DII users are required to + // use). + + if (this->result_ != 0) + { + this->result_->value ()->_tao_decode (call.inp_stream (), + ACE_TRY_ENV); + ACE_CHECK; + } + + this->args_->_tao_incoming_cdr (call.inp_stream (), + CORBA::ARG_OUT | CORBA::ARG_INOUT, + this->lazy_evaluation_, + ACE_TRY_ENV); +} + +void +CORBA_Request::send_oneway (CORBA::Environment &ACE_TRY_ENV) +{ + TAO_GIOP_Oneway_Invocation call (this->target_->_stubobj (), + this->opname_, + ACE_OS::strlen (this->opname_), + this->orb_->orb_core ()); + + // Loop as needed for forwarding. + for (;;) + { + call.start (ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Octet response_flag = ACE_static_cast (CORBA::Octet, + call.sync_scope ()); + + call.prepare_header (response_flag, + ACE_TRY_ENV); + ACE_CHECK; + + this->args_->_tao_encode (call.out_stream (), + this->orb_->orb_core (), + CORBA::ARG_IN | CORBA::ARG_INOUT, + ACE_TRY_ENV); + ACE_CHECK; + + int status = call.invoke (ACE_TRY_ENV); + ACE_CHECK; + + if (status == TAO_INVOKE_RESTART) + { + continue; + } + + if (status == TAO_INVOKE_EXCEPTION) + { + // Shouldn't happen. + return; + } + + if (status != TAO_INVOKE_OK) + { + ACE_THROW (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_MAYBE)); + } + + // The only case left is status == TAO_INVOKE_OK, exit the + // loop. We cannot retry because at this point we either + // got a reply or something with an status of + // COMPLETED_MAYBE, thus we cannot reissue the request if we + // are to satisfy the "at most once" semantics. + break; + } +} + +void +CORBA_Request::send_deferred (CORBA::Environment &ACE_TRY_ENV) +{ + { + ACE_GUARD (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_); + + this->response_received_ = 0; + } + + TAO_GIOP_DII_Deferred_Invocation call (this->target_->_stubobj (), + this->orb_->orb_core (), + this); + + // Loop as needed for forwarding. + for (;;) + { + call.start (ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Short flag = TAO_TWOWAY_RESPONSE_FLAG; + + call.prepare_header (ACE_static_cast (CORBA::Octet, flag), + ACE_TRY_ENV); + ACE_CHECK; + + this->args_->_tao_encode (call.out_stream (), + this->orb_->orb_core (), + CORBA::ARG_IN | CORBA::ARG_INOUT, + ACE_TRY_ENV); + ACE_CHECK; + + // Make the call without blocking. + CORBA::ULong status = call.invoke (ACE_TRY_ENV); + ACE_CHECK; + + if (status == TAO_INVOKE_RESTART) + { + continue; + } + + if (status != TAO_INVOKE_OK) + { + ACE_THROW (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_MAYBE)); + } + + // The only case left is status == TAO_INVOKE_OK, exit the + // loop. We cannot retry because at this point we either + // got a reply or something with an status of + // COMPLETED_MAYBE, thus we cannot reissue the request if we + // are to satisfy the "at most once" semantics. + break; + } +} + +void +CORBA_Request::get_response (CORBA::Environment &ACE_TRY_ENV) +{ + while (!this->response_received_) + { + (void) this->orb_->perform_work (); + } + + if (this->lazy_evaluation_) + { + this->args_->evaluate (ACE_TRY_ENV); + ACE_CHECK; + } +} + +CORBA::Boolean +CORBA_Request::poll_response (CORBA::Environment &) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + return this->response_received_; +} + +void +CORBA_Request::handle_response (TAO_InputCDR &incoming, + CORBA::ULong reply_status, + CORBA::Environment &ACE_TRY_ENV) +{ + switch (reply_status) + { + case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION: + if (this->result_ != 0) + { + this->result_->value ()->_tao_decode (incoming, + ACE_TRY_ENV); + ACE_CHECK; + } + + this->args_->_tao_incoming_cdr (incoming, + CORBA::ARG_OUT | CORBA::ARG_INOUT, + this->lazy_evaluation_, + ACE_TRY_ENV); + ACE_CHECK; + + { + ACE_GUARD (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_); + + this->response_received_ = 1; + } + + break; + case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION: + case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION: + case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: + default: + // @@ (JP) Don't know what to do about any of these yet. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) unhandled reply status\n"))); + } +} + +// Constructor. +CORBA_ORB_RequestSeq::CORBA_ORB_RequestSeq (CORBA::ULong max) + : TAO_Unbounded_Pseudo_Sequence (max) +{ + // No-op. +} + +CORBA_ORB_RequestSeq::CORBA_ORB_RequestSeq (const CORBA_ORB_RequestSeq &rhs) + : TAO_Unbounded_Pseudo_Sequence (rhs) +{ + // No-op. +} + +CORBA_ORB_RequestSeq::CORBA_ORB_RequestSeq (CORBA::ULong max, + CORBA::ULong length, + CORBA_Request **data, + CORBA::Boolean release) + : TAO_Unbounded_Pseudo_Sequence (max, + length, + data, + release) +{ + // No-op. +} + + +CORBA_ORB_RequestSeq::CORBA_ORB_RequestSeq (void) +{ + // No-op. +} + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_Unbounded_Pseudo_Sequence; +template class TAO_Pseudo_Object_Manager; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_Unbounded_Pseudo_Sequence +#pragma instantiate TAO_Pseudo_Object_Manager + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/tao/DynamicInterface/Request.h b/TAO/tao/DynamicInterface/Request.h new file mode 100644 index 00000000000..cd68a99aa32 --- /dev/null +++ b/TAO/tao/DynamicInterface/Request.h @@ -0,0 +1,375 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// Request.h +// +// = DESCRIPTION +// Header file for CORBA's Dynamic Invocation Interface "Request" +// type. +// +// = AUTHOR +// Copyright 1994-1995 by Sun Microsystems, Inc. +// Additions and RequestSeq by Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_REQUEST_H +#define TAO_REQUEST_H +#include "ace/pre.h" + +#include "tao/orbconf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Context.h" +#include "ExceptionList.h" +#include "tao/corbafwd.h" +#include "tao/ORB.h" +#include "tao/NVList.h" +#include "tao/Environment.h" +#include "tao/Sequence.h" +#include "tao/MessagingC.h" + +class TAO_DynamicInterface_Export CORBA_Request +{ + // = TITLE + // CORBA_Request + // + // = DESCRIPTION + // Provides a way to create requests and populate it with parameters for + // use in the Dynamic Invocation Interface. + // +public: + CORBA::Object_ptr target (void) const; + // Return the target of this request. + + const CORBA::Char *operation (void) const; + // Return the operation name for the request. + + CORBA::NVList_ptr arguments (void); + // Return the arguments for the request. + + CORBA::NamedValue_ptr result (void); + // Return the result for the request. + + CORBA::ExceptionList_ptr exceptions (void); + // Return the exceptions resulting from this request. + + CORBA::Context_ptr ctx (void) const; + // Accessor for the Context member. + + void ctx (CORBA::Context_ptr); + // Mutator for the Context member. + + CORBA::ContextList_ptr contexts (void); + // Return a list of the request's result's contexts. Since + // TAO does not implement Contexts, this will always be 0. + + CORBA::Environment_ptr env (void); + // Return the for this request. + + // Argument manipulation helper functions. + + // Arg adders, one for each type of parameter, + // with and without optional name. Returns + // reference to Any for insertion using <<=. + CORBA_Any &add_in_arg (void); + CORBA_Any &add_in_arg (const char* name); + CORBA_Any &add_inout_arg (void); + CORBA_Any &add_inout_arg (const char* name); + CORBA_Any &add_out_arg (void); + CORBA_Any &add_out_arg (const char* name); + + void set_return_type (CORBA::TypeCode_ptr tc); + // Initialize the return type. + + CORBA_Any &return_value (void); + // Returns reference to Any for extraction using >>=. + + void invoke (CORBA::Environment &ACE_TRY_ENV = + CORBA::Environment::default_environment ()); + // Perform method resolution and invoke an appropriate method. If + // the method returns successfully, its result is placed in the + // result argument specified on . The behavior is + // undefined if this has already been used with a previous + // call to , , or . + + // A default argument is set, but please note that this not recommended + // as the user may not be able to propagate the exceptions + + void send_oneway (CORBA::Environment &ACE_TRY_ENV = + CORBA::Environment::default_environment ()); + // Send a oneway request. + // A default argument is set, but please note that this not recommended + // as the user may not be able to propagate the exceptions. + + // The 'deferred synchronous' methods. + void send_deferred (CORBA::Environment &ACE_TRY_ENV = + CORBA::Environment::default_environment ()); + void get_response (CORBA::Environment &ACE_TRY_ENV = + CORBA::Environment::default_environment ()); + CORBA::Boolean poll_response (CORBA::Environment &ACE_TRY_ENV = + CORBA::Environment::default_environment ()); + + // Callback method for deferred synchronous requests. + void handle_response (TAO_InputCDR &incoming, + CORBA::ULong reply_status, + CORBA::Environment &ACE_TRY_ENV = + CORBA::Environment::default_environment ()); + + // Pseudo object methods. + static CORBA_Request* _duplicate (CORBA_Request*); + static CORBA_Request* _nil (void); + + // = Reference counting. + CORBA::ULong _incr_refcnt (void); + CORBA::ULong _decr_refcnt (void); + + void _tao_lazy_evaluation (int lazy_evaluation); + // Set the lazy evaluation flag. + +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA_Request_ptr _ptr_type; + typedef CORBA_Request_var _var_type; +#endif /* __GNUC__ */ + // Useful for template programming. + +private: + friend class TAO_Dynamic_Adapter_Impl; + + // The following are not allowed except when called from the friend class. + + CORBA_Request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const CORBA::Char *op, + CORBA::NVList_ptr args, + CORBA::NamedValue_ptr result, + CORBA::Flags flags, + CORBA::ExceptionList_ptr exceptions, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + CORBA_Request (CORBA::Object_ptr obj, + CORBA::ORB_ptr orb, + const CORBA::Char *op, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + + ~CORBA_Request (void); + + CORBA::Object_ptr target_; + // Target object. + + CORBA::ORB_var orb_; + // Pointer to our ORB. + + const CORBA::Char *opname_; + // Operation name. + + CORBA::NVList_ptr args_; + // Parameter list. + + CORBA::NamedValue_ptr result_; + // Result of the operation. + + CORBA::Flags flags_; + // Invocation flags. + + CORBA::Environment env_; + // Holds exceptions. + + CORBA_ExceptionList_var exceptions_; + // List of exceptions raised by the operation. + + CORBA::ContextList_ptr contexts_; + // List of the request's result's contexts. + + CORBA::Context_ptr ctx_; + // Context associated with this request. + + CORBA::ULong refcount_; + // Reference counting. + + ACE_SYNCH_MUTEX lock_; + // Protect the refcount_ and response_receieved_. + + int lazy_evaluation_; + // If not zero then the NVList is not evaluated by default. + + CORBA::Boolean response_received_; + // Set to TRUE upon completion of invoke() or + // handle_response(). +}; + +typedef CORBA_Request* CORBA_Request_ptr; + +class TAO_DynamicInterface_Export CORBA_Request_var +{ + // = TITLE + // The T_var class for Request. + // + // = DESCRIPTION + // As any other pseudo object Request must have a T_var class, + // the interface an semantics are specified in the CORBA spec. + // + // = NOTE + // We use CORBA_Request_ptr as the _ptr type instead of + // CORBA::Request_ptr, this is an attempt to reduced the cyclic + // dependencies in TAO. + // +public: + CORBA_Request_var (void); + CORBA_Request_var (CORBA_Request_ptr); + CORBA_Request_var (const CORBA_Request_var &); + ~CORBA_Request_var (void); + + CORBA_Request_var &operator= (CORBA_Request_ptr); + CORBA_Request_var &operator= (const CORBA_Request_var &); + CORBA_Request_ptr operator-> (void) const; + + operator const CORBA_Request_ptr &() const; + operator CORBA_Request_ptr &(); + + // in, inout, out, _retn. + CORBA_Request_ptr in (void) const; + CORBA_Request_ptr &inout (void); + CORBA_Request_ptr &out (void); + CORBA_Request_ptr _retn (void); + CORBA_Request_ptr ptr (void) const; + +private: + CORBA_Request_ptr ptr_; +}; + +class TAO_DynamicInterface_Export CORBA_Request_out +{ + // = TITLE + // The T_out class for Request + // + // = DESCRIPTION + // As any other pseudo object Request must have a T_out class, + // the interface an semantics are specified in the CORBA spec. + // + // = NOTE + // We use CORBA_Request_ptr as the _ptr type instead of + // CORBA::Request_ptr, this is an attempt to reduced the cyclic + // dependencies in TAO. + // +public: + CORBA_Request_out (CORBA_Request_ptr &); + CORBA_Request_out (CORBA_Request_var &); + CORBA_Request_out (CORBA_Request_out &); + CORBA_Request_out &operator= (CORBA_Request_out &); + CORBA_Request_out &operator= (const CORBA_Request_var &); + CORBA_Request_out &operator= (CORBA_Request_ptr); + operator CORBA_Request_ptr &(); + CORBA_Request_ptr &ptr (void); + CORBA_Request_ptr operator-> (void); + +private: + CORBA_Request_ptr &ptr_; +}; + +#if defined (__ACE_INLINE__) +# include "tao/Request.i" +#endif /* __ACE_INLINE__ */ + +// Make sure you instantiate this in Request.cpp +class TAO_DynamicInterface_Export CORBA_ORB_RequestSeq + : public TAO_Unbounded_Pseudo_Sequence +{ +public: +// Helpful with template programming. +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA_ORB_RequestSeq_var _var_type; +#endif /* __GNUC__ */ + + // Implement the same constructors provided by the template here, + // check Sequence_T.h for ideas. + // Simply delegate on the template for the implementation... + + CORBA_ORB_RequestSeq (void); + // Default constructor. + + CORBA_ORB_RequestSeq (CORBA::ULong max); + // Constructor with a "hint" for the maximum capacity. + + CORBA_ORB_RequestSeq (CORBA::ULong maximum, + CORBA::ULong length, + CORBA_Request* * data, + CORBA::Boolean release=0); + // Constructor with a given buffer. + + CORBA_ORB_RequestSeq (const CORBA_ORB_RequestSeq &); + // Copy ctor, deep copies. +}; + +class TAO_DynamicInterface_Export CORBA_ORB_RequestSeq_var +{ +public: + CORBA_ORB_RequestSeq_var (void); + // Default constructor. + + CORBA_ORB_RequestSeq_var (CORBA_ORB_RequestSeq *); + + CORBA_ORB_RequestSeq_var (const CORBA_ORB_RequestSeq_var &); + // Copy constructor. + + ~CORBA_ORB_RequestSeq_var (void); + // Destructor. + + CORBA_ORB_RequestSeq_var &operator= (CORBA_ORB_RequestSeq *); + CORBA_ORB_RequestSeq_var &operator= (const CORBA_ORB_RequestSeq_var &); + CORBA_ORB_RequestSeq *operator-> (void); + const CORBA_ORB_RequestSeq *operator-> (void) const; + + operator const CORBA_ORB_RequestSeq &() const; + operator CORBA_ORB_RequestSeq &(); + operator CORBA_ORB_RequestSeq &() const; + CORBA::Octet &operator[] (CORBA::ULong slot); + + // in, inout, out, _retn. + const CORBA_ORB_RequestSeq &in (void) const; + CORBA_ORB_RequestSeq &inout (void); + CORBA_ORB_RequestSeq *&out (void); + CORBA_ORB_RequestSeq *_retn (void); + CORBA_ORB_RequestSeq *ptr (void) const; + +private: + CORBA_ORB_RequestSeq *ptr_; +}; + +class TAO_DynamicInterface_Export CORBA_ORB_RequestSeq_out +{ +public: + CORBA_ORB_RequestSeq_out (CORBA_ORB_RequestSeq *&); + CORBA_ORB_RequestSeq_out (CORBA_ORB_RequestSeq_var &); + CORBA_ORB_RequestSeq_out (CORBA_ORB_RequestSeq_out &); + CORBA_ORB_RequestSeq_out &operator= (CORBA_ORB_RequestSeq_out &); + CORBA_ORB_RequestSeq_out &operator= (CORBA_ORB_RequestSeq *); + operator CORBA_ORB_RequestSeq *&(); + CORBA_ORB_RequestSeq *&ptr (void); + CORBA_ORB_RequestSeq *operator-> (void); + CORBA::Octet &operator[] (CORBA::ULong slot); + +private: + CORBA_ORB_RequestSeq *&ptr_; + + // Assignment from T_var not allowed. + void operator= (const CORBA_ORB_RequestSeq_var &); +}; + +#if defined (__ACE_INLINE__) +# include "Request.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_REQUEST_H */ diff --git a/TAO/tao/DynamicInterface/Request.inl b/TAO/tao/DynamicInterface/Request.inl new file mode 100644 index 00000000000..13ba1f53583 --- /dev/null +++ b/TAO/tao/DynamicInterface/Request.inl @@ -0,0 +1,304 @@ +// $Id$ + +// This may look like C, but it's really -*- C++ -*- + +ACE_INLINE CORBA_Request_ptr +CORBA_Request::_duplicate (CORBA_Request_ptr x) +{ + if (x != 0) + { + x->_incr_refcnt (); + } + + return x; +} + +ACE_INLINE CORBA_Request_ptr +CORBA_Request::_nil (void) +{ + return (CORBA_Request_ptr)0; +} + +ACE_INLINE CORBA::Object_ptr +CORBA_Request::target (void) const +{ + return this->target_; +} + +// Return the operation name for the request. +ACE_INLINE const CORBA::Char * +CORBA_Request::operation (void) const +{ + return this->opname_; +} + +// Return the arguments for the request. +ACE_INLINE CORBA::NVList_ptr +CORBA_Request::arguments (void) +{ + return this->args_; +} + +// Return the result for the request. +ACE_INLINE CORBA::NamedValue_ptr +CORBA_Request::result (void) +{ + return this->result_; +} + +// Return the exceptions resulting from this request. +ACE_INLINE CORBA::ExceptionList_ptr +CORBA_Request::exceptions (void) +{ + return this->exceptions_.in (); +} + +// Return the request's contexts +ACE_INLINE CORBA::ContextList_ptr +CORBA_Request::contexts (void) +{ + return this->contexts_; +} + +// Return the for this request. +ACE_INLINE CORBA::Environment * +CORBA_Request::env (void) +{ + return &this->env_; +} + +// The argument manipulation helper functions + +ACE_INLINE CORBA_Any & +CORBA_Request::add_in_arg (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + return this->args_->add_element (CORBA::ARG_IN, ACE_TRY_ENV)->any_; +} + +ACE_INLINE CORBA_Any & +CORBA_Request::add_in_arg (const CORBA::Char *name) +{ + ACE_DECLARE_NEW_CORBA_ENV; + return this->args_->add_item (name, CORBA::ARG_IN, ACE_TRY_ENV)->any_; +} + +ACE_INLINE CORBA_Any & +CORBA_Request::add_inout_arg (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + return this->args_->add_element (CORBA::ARG_INOUT, ACE_TRY_ENV)->any_; +} + +ACE_INLINE CORBA_Any & +CORBA_Request::add_inout_arg (const CORBA::Char *name) +{ + ACE_DECLARE_NEW_CORBA_ENV; + return this->args_->add_item (name, CORBA::ARG_INOUT, ACE_TRY_ENV)->any_; +} + +ACE_INLINE CORBA_Any & +CORBA_Request::add_out_arg (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + return this->args_->add_element (CORBA::ARG_OUT, ACE_TRY_ENV)->any_; +} + +ACE_INLINE CORBA_Any & +CORBA_Request::add_out_arg (const CORBA::Char *name) +{ + ACE_DECLARE_NEW_CORBA_ENV; + return this->args_->add_item (name, CORBA::ARG_OUT, ACE_TRY_ENV)->any_; +} + +ACE_INLINE void +CORBA_Request::set_return_type (CORBA::TypeCode_ptr tc) +{ + CORBA::Any newtype (tc); + this->result_->any_ = newtype; +} + +ACE_INLINE CORBA_Any & +CORBA_Request::return_value (void ) +{ + return this->result_->any_; +} + +ACE_INLINE CORBA::Context_ptr +CORBA_Request::ctx (void) const +{ + return this->ctx_; +} + +ACE_INLINE void +CORBA_Request::ctx (CORBA::Context_ptr ctx) +{ + this->ctx_ = ctx; +} + +ACE_INLINE void +CORBA_Request::_tao_lazy_evaluation (int lazy_evaluation) +{ + this->lazy_evaluation_ = lazy_evaluation; +} + +// ************************************************************* +// Inline operations for class CORBA_Request_var +// ************************************************************* + +ACE_INLINE +CORBA_Request_var::CORBA_Request_var (void) + : ptr_ (CORBA_Request::_nil ()) +{ +} + +ACE_INLINE +CORBA_Request_var::CORBA_Request_var (CORBA_Request_ptr p) + : ptr_ (p) +{} + +ACE_INLINE +CORBA_Request_var::~CORBA_Request_var (void) +{ + CORBA::release (this->ptr_); +} + +ACE_INLINE CORBA_Request_ptr +CORBA_Request_var::ptr (void) const +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_Request_var::CORBA_Request_var (const CORBA_Request_var &p) + : ptr_ (CORBA_Request::_duplicate (p.ptr ())) +{} + +ACE_INLINE CORBA_Request_var & +CORBA_Request_var::operator= (CORBA_Request_ptr p) +{ + CORBA::release (this->ptr_); + this->ptr_ = p; + return *this; +} + +ACE_INLINE CORBA_Request_var & +CORBA_Request_var::operator= (const CORBA_Request_var &p) +{ + if (this != &p) + { + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Request::_duplicate (p.ptr ()); + } + return *this; +} + +ACE_INLINE +CORBA_Request_var::operator const CORBA_Request_ptr &() const +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_Request_var::operator CORBA_Request_ptr &() +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr +CORBA_Request_var::operator-> (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr +CORBA_Request_var::in (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr & +CORBA_Request_var::inout (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr & +CORBA_Request_var::out (void) +{ + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Request::_nil (); + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr +CORBA_Request_var::_retn (void) +{ + // yield ownership + CORBA_Request_ptr val = this->ptr_; + this->ptr_ = CORBA_Request::_nil (); + return val; +} + +// ************************************************************* +// Inline operations for class CORBA_Request_out +// ************************************************************* + +ACE_INLINE +CORBA_Request_out::CORBA_Request_out (CORBA_Request_ptr &p) + : ptr_ (p) +{ + this->ptr_ = CORBA_Request::_nil (); +} + +ACE_INLINE +CORBA_Request_out::CORBA_Request_out (CORBA_Request_var &p) + : ptr_ (p.out ()) +{ + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Request::_nil (); +} + +ACE_INLINE +CORBA_Request_out::CORBA_Request_out (CORBA_Request_out &p) + : ptr_ (p.ptr_) +{} + +ACE_INLINE CORBA_Request_out & +CORBA_Request_out::operator= (CORBA_Request_out &p) +{ + this->ptr_ = p.ptr_; + return *this; +} + +ACE_INLINE CORBA_Request_out & +CORBA_Request_out::operator= (const CORBA_Request_var &p) +{ + this->ptr_ = CORBA_Request::_duplicate (p.ptr ()); + return *this; +} + +ACE_INLINE CORBA_Request_out & +CORBA_Request_out::operator= (CORBA_Request_ptr p) +{ + this->ptr_ = p; + return *this; +} + +ACE_INLINE +CORBA_Request_out::operator CORBA_Request_ptr &() +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr & +CORBA_Request_out::ptr (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Request_ptr +CORBA_Request_out::operator-> (void) +{ + return this->ptr_; +} diff --git a/TAO/tao/DynamicInterface/Server_Request.cpp b/TAO/tao/DynamicInterface/Server_Request.cpp new file mode 100644 index 00000000000..00153434621 --- /dev/null +++ b/TAO/tao/DynamicInterface/Server_Request.cpp @@ -0,0 +1,206 @@ +// $Id$ + +// Implementation of the Dynamic Server Skeleton Interface. + +#include "Server_Request.h" +#include "tao/NVList.h" +#include "tao/GIOP_Utils.h" +#include "tao/Marshal.h" + +#if !defined (__ACE_INLINE__) +# include "Server_Request.inl" +#endif /* ! __ACE_INLINE__ */ + +ACE_RCSID(DynamicInterface, Server_Request, "$Id$") + +// Reference counting for DSI ServerRequest object. + +CORBA::ULong +CORBA_ServerRequest::_incr_refcnt (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + return this->refcount_++; +} + +CORBA::ULong +CORBA_ServerRequest::_decr_refcnt (void) +{ + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + this->refcount_--; + + if (this->refcount_ != 0) + { + return this->refcount_; + } + } + + delete this; + return 0; +} + +CORBA_ServerRequest::CORBA_ServerRequest ( + TAO_ServerRequest &orb_server_request + ) + : lazy_evaluation_ (0), + ctx_ (CORBA::Context::_nil ()), + params_ (CORBA::NVList::_nil ()), + retval_ (0), + exception_ (0), + refcount_ (1), + orb_server_request_ (orb_server_request) +{ + this->orb_server_request_.is_dsi (); +} + +CORBA_ServerRequest::~CORBA_ServerRequest (void) +{ + if (this->params_ != 0) + { + CORBA::release (this->params_); + } + + delete this->retval_; + delete this->exception_; +} + +// Unmarshal in/inout params, and set up to marshal the appropriate +// inout/out/return values later on. +void +CORBA_ServerRequest::arguments (CORBA::NVList_ptr &list, + CORBA::Environment &ACE_TRY_ENV) +{ + // Save params for later use when marshaling the reply. + this->params_ = list; + + this->params_->_tao_incoming_cdr (this->orb_server_request_.incoming (), + CORBA::ARG_IN | CORBA::ARG_INOUT, + this->lazy_evaluation_, + ACE_TRY_ENV); + + // Pass this alignment back to the TAO_ServerRequest. + this->orb_server_request_.dsi_nvlist_align ( + this->params_->_tao_target_alignment () + ); +} + +// Store the result value. There's either an exception, or a result, +// but not both of them. Results (and exceptions) can be reported +// only after the parameter list has been provided (maybe empty). +void +CORBA_ServerRequest::set_result (const CORBA::Any &value, + CORBA::Environment &ACE_TRY_ENV) +{ + // Setting a result when another result already exists or if an exception + // exists is an error. + if (this->retval_ != 0 || this->exception_ != 0) + { + ACE_THROW (CORBA::BAD_INV_ORDER ()); + } + + ACE_NEW_THROW_EX (this->retval_, + CORBA::Any (value), + CORBA::NO_MEMORY ()); + ACE_CHECK; +} + +// Store the exception value. +void +CORBA_ServerRequest::set_exception (const CORBA::Any &value, + CORBA::Environment &ACE_TRY_ENV) +{ + if (this->retval_ != 0 || this->exception_ != 0) + { + ACE_THROW (CORBA::BAD_INV_ORDER ()); + } + + ACE_NEW_THROW_EX (this->exception_, + CORBA::Any (value), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + this->orb_server_request_.exception_type (TAO_GIOP_USER_EXCEPTION); + + if (value.value ()) + { + // @@ TODO - Change this to use <<=, now that we have it + // for CORBA_Exception. + CORBA_Exception* x = (CORBA_Exception*)value.value (); + + if (CORBA_SystemException::_downcast (x) != 0) + { + this->orb_server_request_.exception_type ( + TAO_GIOP_SYSTEM_EXCEPTION + ); + } + } +} + +// This method will be utilized by the DSI servant to marshal outgoing +// parameters. +void +CORBA_ServerRequest::dsi_marshal (CORBA::Environment &ACE_TRY_ENV) +{ + // NOTE: if "env" is set, it takes precedence over exceptions + // reported using the mechanism of the ServerRequest. Only system + // exceptions are reported that way ... + // + // XXX Exception reporting is ambiguous; it can be cleaner than + // this. With both language-mapped and dynamic/explicit reporting + // mechanisms, one of must be tested "first" ... so an exception + // reported using the other mechanism could be "lost". Perhaps only + // the language mapped one should be used for system exceptions. + + // If there wasn't any exception, we proceed. + if (this->orb_server_request_.exception_type () == TAO_GIOP_NO_EXCEPTION + && CORBA::is_nil (this->orb_server_request_.forward_location ())) + { + // Send the return value, if any. + if (this->retval_ != 0) + { + if (this->retval_->any_owns_data ()) + { + this->retval_->_tao_encode ( + this->orb_server_request_.outgoing (), + this->orb_server_request_.orb_core (), + ACE_TRY_ENV + ); + ACE_CHECK; + } + else + { + CORBA::TypeCode_var tc = this->retval_->type (); + + TAO_InputCDR cdr (this->retval_->_tao_get_cdr (), + this->retval_->_tao_byte_order ()); + + (void) TAO_Marshal_Object::perform_append ( + tc.in (), + &cdr, + &this->orb_server_request_.outgoing (), + ACE_TRY_ENV + ); + ACE_CHECK; + } + } + + // Send the "inout" and "out" parameters. + if (this->params_ != 0) + { + this->params_->_tao_encode (this->orb_server_request_.outgoing (), + this->orb_server_request_.orb_core (), + CORBA::ARG_INOUT | CORBA::ARG_OUT, + ACE_TRY_ENV); + ACE_CHECK; + } + } +} + diff --git a/TAO/tao/DynamicInterface/Server_Request.h b/TAO/tao/DynamicInterface/Server_Request.h new file mode 100644 index 00000000000..3efb9a7d1aa --- /dev/null +++ b/TAO/tao/DynamicInterface/Server_Request.h @@ -0,0 +1,145 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// Server_Request.h +// +// = DESCRIPTION +// Header file for CORBA's Dynamic Server Skeleton Interface's +// "Server Request" type. +// +// = AUTHOR +// Copyright 1994-1995 by Sun Microsystems, Inc. and Chris Cleeland. +// Modifications by Aniruddha Gokhale based on CORBAv2.2 Feb 98 +// ============================================================================ + +#ifndef TAO_CORBA_SERVER_REQUEST_H +#define TAO_CORBA_SERVER_REQUEST_H +#include "ace/pre.h" + +#include "tao/corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Context.h" +#include "tao/TAO_Server_Request.h" + +class TAO_DynamicInterface_Export CORBA_ServerRequest +{ + // = TITLE + // Class representing the CORBA ServerRequest pseudo-object. + // + // = DESCRIPTION + // Instantiated by the POA for DSI requests and passed up + // to the application. Contains a reference to the instance + // of TAO_ServerRequest that is passed up to the POA from + // the ORB. +public: + CORBA_ServerRequest (TAO_ServerRequest &orb_server_request); + // Constructor. + + ~CORBA_ServerRequest (void); + // Destructor. + + void arguments (CORBA::NVList_ptr &list, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Implementation uses this to provide the ORB with the operation's + // parameter list ... on return, their values are available; the + // list fed in has typecodes and (perhap) memory assigned. + + void set_result (const CORBA::Any &value, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Implementation uses this to provide the operation result + // ... illegal if exception() was called or params() was not called. + // + // XXX Implementation should be able to assume response has been + // sent when this returns, and reclaim memory it allocated. + + void set_exception (const CORBA::Any &value, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Implementation uses this to provide the exception value which is + // the only result of this particular invocation. + // + // XXX Implementation should be able to assume response has been + // sent when this returns, and reclaim memory it allocated. + + // = Get various universal call attributes. + + // e.g., who made the call, the target of the call, what ORB and OA + // that target object uses. + // + // NOTE: none of these report exceptions; unavailability of any of + // this stuff is a catastrophic error since this is all part of the + // basic CORBA Object Model. + + void dsi_marshal (CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Marshal outgoing parameters. + + CORBA::Context_ptr ctx (void) const; + // Accessor for the Context member. + + void ctx (CORBA::Context_ptr); + // Mutator for the Context member. + + const char *operation (void) const; + // Get the operation name. + + // Pseudo object methods. + static CORBA_ServerRequest_ptr _duplicate (CORBA_ServerRequest_ptr); + static CORBA_ServerRequest_ptr _nil (void); + + // = Reference counting. + CORBA::ULong _incr_refcnt (void); + CORBA::ULong _decr_refcnt (void); + + void _tao_lazy_evaluation (int lazy_evaluation); + // Set the lazy evaluation flag. + +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA::ServerRequest_ptr _ptr_type; +#endif /* __GNUC__ */ + // Useful for template programming. + +private: + int lazy_evaluation_; + // If zero then the NVList is evaluated ASAP. + + CORBA::Context_ptr ctx_; + // Context associated with this request. + + CORBA::NVList_ptr params_; + // Incoming parameters. + + CORBA::Any_ptr retval_; + // Return value. + + CORBA::Any_ptr exception_; + // Any exception which might be raised. + + CORBA::ULong refcount_; + // Reference counting. + + ACE_SYNCH_MUTEX lock_; + // Protect the refcount_ and response_receieved_. + + TAO_ServerRequest &orb_server_request_; + // Request from the ORB. +}; + +#if defined (__ACE_INLINE__) +# include "Server_Request.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_CORBA_SERVER_REQUEST_H */ diff --git a/TAO/tao/DynamicInterface/Server_Request.inl b/TAO/tao/DynamicInterface/Server_Request.inl new file mode 100644 index 00000000000..e79890ee8cf --- /dev/null +++ b/TAO/tao/DynamicInterface/Server_Request.inl @@ -0,0 +1,44 @@ +// -*- C++ -*- +// $Id$ + +ACE_INLINE CORBA_ServerRequest_ptr +CORBA_ServerRequest::_duplicate (CORBA_ServerRequest_ptr x) +{ + if (x != 0) + { + x->_incr_refcnt (); + } + + return x; +} + +ACE_INLINE CORBA_ServerRequest_ptr +CORBA_ServerRequest::_nil (void) +{ + return (CORBA_ServerRequest_ptr)0; +} + +ACE_INLINE CORBA::Context_ptr +CORBA_ServerRequest::ctx (void) const +{ + return this->ctx_; +} + +ACE_INLINE void +CORBA_ServerRequest::ctx (CORBA::Context_ptr ctx) +{ + this->ctx_ = ctx; +} + +ACE_INLINE const char * +CORBA_ServerRequest::operation (void) const +{ + return this->orb_server_request_.operation (); +} + +ACE_INLINE void +CORBA_ServerRequest::_tao_lazy_evaluation (int lazy_evaluation) +{ + this->lazy_evaluation_ = lazy_evaluation; +} + diff --git a/TAO/tao/DynamicInterface/TAO_DynamicInterface.dsp b/TAO/tao/DynamicInterface/TAO_DynamicInterface.dsp new file mode 100644 index 00000000000..025c59c04ec --- /dev/null +++ b/TAO/tao/DynamicInterface/TAO_DynamicInterface.dsp @@ -0,0 +1,259 @@ +# Microsoft Developer Studio Project File - Name="DynamicInterface" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=DynamicInterface - Win32 MFC Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TAO_DynamicInterface.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TAO_DynamicInterface.mak" CFG="DynamicInterface - Win32 MFC Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "DynamicInterface - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "DynamicInterface - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "DynamicInterface - Win32 MFC Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "DynamicInterface - Win32 MFC Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "DynamicInterface - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "DLL\Release\DynamicInterface" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DynamicInterface_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "../../" /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "TAO_DYNAMICANY_BUILD_DLL" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 ace.lib TAO.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\TAO_DynamicInterface.dll" /libpath:"..\..\tao" /libpath:"..\..\..\ace" + +!ELSEIF "$(CFG)" == "DynamicInterface - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "DLL\Debug\DynamicInterface" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DynamicInterface_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /I "../../" /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "TAO_DYNAMICINTERFACE_BUILD_DLL" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 TAOd.lib aced.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\TAO_DynamicInterfaced.dll" /pdbtype:sept /libpath:"..\..\tao" /libpath:"..\..\..\ace" + +!ELSEIF "$(CFG)" == "DynamicInterface - Win32 MFC Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DynamicInterface___Win32_MFC_Debug" +# PROP BASE Intermediate_Dir "DynamicInterface___Win32_MFC_Debug" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "DLL\Debug\DynamicInterfaceMFC" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /I "../../" /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "TAO_EVENT_BUILD_DLL" /FD /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../" /I "../../" /I "../../../" /D "_DEBUG" /D ACE_HAS_MFC=1 /D "WIN32" /D "_WINDOWS" /D "TAO_DYNAMICANY_BUILD_DLL" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 TAOd.lib aced.lib TAO_Svc_Utilsd.lib TAO_RTEventd.lib TAO_RTSchedd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\TAO_DynamicInterfaced.dll" /pdbtype:sept /libpath:"..\..\tao" /libpath:"..\..\..\ace" +# ADD LINK32 TAOmfcd.lib acemfcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\TAO_DynamicInterfacemfcd.dll" /pdbtype:sept /libpath:"..\..\tao" /libpath:"..\..\..\ace" + +!ELSEIF "$(CFG)" == "DynamicInterface - Win32 MFC Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "DynamicInterface___Win32_MFC_Release" +# PROP BASE Intermediate_Dir "DynamicInterface___Win32_MFC_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "DLL\Release\DynamicInterfaceMFC" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "../" /I "../../" /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "TAO_EVENT_BUILD_DLL" /FD /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "../../" /I "../../../" /D "NDEBUG" /D "TAO_DYNAMICANY_BUILD_DLL" /D ACE_HAS_MFC=1 /D "WIN32" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 ace.lib TAO.lib TAO_Svc_Utils.lib TAO_RTEvent.lib TAO_RTSched.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\TAO_DynamicInterface.dll" /libpath:"..\..\tao" /libpath:"..\..\..\ace" +# ADD LINK32 ace.lib TAO.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\TAO_DynamicInterfacemfc.dll" /libpath:"..\..\tao" /libpath:"..\..\..\ace" + +!ENDIF + +# Begin Target + +# Name "DynamicInterface - Win32 Release" +# Name "DynamicInterface - Win32 Debug" +# Name "DynamicInterface - Win32 MFC Debug" +# Name "DynamicInterface - Win32 MFC Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Context.cpp +# End Source File +# Begin Source File + +SOURCE=.\DII_Invocation.cpp +# End Source File +# Begin Source File + +SOURCE=.\DII_Reply_Dispatcher.cpp +# End Source File +# Begin Source File + +SOURCE=.\Dynamic_Adapter_Impl.cpp +# End Source File +# Begin Source File + +SOURCE=.\Dynamic_Implementation.cpp +# End Source File +# Begin Source File + +SOURCE=.\ExceptionList.cpp +# End Source File +# Begin Source File + +SOURCE=.\Request.cpp +# End Source File +# Begin Source File + +SOURCE=.\Server_Request.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h" +# Begin Source File + +SOURCE=.\Context.h +# End Source File +# Begin Source File + +SOURCE=.\DII_Invocation.h +# End Source File +# Begin Source File + +SOURCE=.\DII_Reply_Dispatcher.h +# End Source File +# Begin Source File + +SOURCE=.\Dynamic_Adapter_Impl.h +# End Source File +# Begin Source File + +SOURCE=.\Dynamic_Implementation.h +# End Source File +# Begin Source File + +SOURCE=.\dynamicinterface_export.h +# End Source File +# Begin Source File + +SOURCE=.\ExceptionList.h +# End Source File +# Begin Source File + +SOURCE=.\Request.h +# End Source File +# Begin Source File + +SOURCE=.\Server_Request.h +# End Source File +# End Group +# Begin Group "Inline Files" + +# PROP Default_Filter "i" +# Begin Source File + +SOURCE=.\Context.i +# End Source File +# Begin Source File + +SOURCE=.\DII_Invocation.i +# End Source File +# Begin Source File + +SOURCE=.\DII_Reply_Dispatcher.i +# End Source File +# Begin Source File + +SOURCE=.\ExceptionList.i +# End Source File +# Begin Source File + +SOURCE=.\Request.i +# End Source File +# Begin Source File + +SOURCE=.\Server_Request.i +# End Source File +# End Group +# End Target +# End Project diff --git a/TAO/tao/DynamicInterface/dynamicinterface_export.h b/TAO/tao/DynamicInterface/dynamicinterface_export.h new file mode 100644 index 00000000000..ed6cd9c5682 --- /dev/null +++ b/TAO/tao/DynamicInterface/dynamicinterface_export.h @@ -0,0 +1,40 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by +// generate_export_file.pl +// ------------------------------ +#ifndef TAO_DYNAMICINTERFACE_EXPORT_H +#define TAO_DYNAMICINTERFACE_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (TAO_DYNAMICINTERFACE_HAS_DLL) +#define TAO_DYNAMICINTERFACE_HAS_DLL 1 +#endif /* ! TAO_DYNAMICINTERFACE_HAS_DLL */ + +#if defined (TAO_DYNAMICINTERFACE_HAS_DLL) +# if (TAO_DYNAMICINTERFACE_HAS_DLL == 1) +# if defined (TAO_DYNAMICINTERFACE_BUILD_DLL) +# define TAO_DynamicInterface_Export ACE_Proper_Export_Flag +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else +# define TAO_DynamicInterface_Export ACE_Proper_Import_Flag +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_DYNAMICINTERFACE_BUILD_DLL */ +# else +# define TAO_DynamicInterface_Export +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T) +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ! TAO_DYNAMICINTERFACE_HAS_DLL == 1 */ +#else +# define TAO_DynamicInterface_Export +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T) +# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_DYNAMICINTERFACE_HAS_DLL */ + +#endif /* TAO_DYNAMICINTERFACE_EXPORT_H */ + +// End of auto generated file. -- cgit v1.2.1