summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1997-12-02 22:42:54 +0000
committergokhale <asgokhale@users.noreply.github.com>1997-12-02 22:42:54 +0000
commitf3bbb8f6ba3aa044fcb78b6a0ecf95eb2ea66fcf (patch)
tree07b7bdaa16b88531ccf0047717f650c19b68a9d3
parentbf7383f11022391e5f3b6fc04419ee07f342818e (diff)
downloadATCD-f3bbb8f6ba3aa044fcb78b6a0ecf95eb2ea66fcf.tar.gz
dispatch method
CVS: CVS: CVS: CVS: CVS: CVS: CVS: CVS:
-rw-r--r--TAO/tao/corbacom.h64
-rw-r--r--TAO/tao/poa.cpp121
2 files changed, 99 insertions, 86 deletions
diff --git a/TAO/tao/corbacom.h b/TAO/tao/corbacom.h
index b6bcbc522c6..d9fafd3203a 100644
--- a/TAO/tao/corbacom.h
+++ b/TAO/tao/corbacom.h
@@ -6,7 +6,7 @@
//
// = LIBRARY
// TAO
-//
+//
// = FILENAME
// corbacom.h
//
@@ -15,8 +15,8 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems Inc. and Andy Gokhale
-// <gokhale@cs.wustl.edu>.
-//
+// <gokhale@cs.wustl.edu>.
+//
// ============================================================================
#if !defined (TAO_CORBACOM_H)
@@ -138,10 +138,10 @@ class TAO_ORB_Parameters;
struct CDR;
// enum values defined in nvlist.h, bitwise ORed.
-typedef u_int CORBA_Flags;
+typedef u_int CORBA_Flags;
template <class T>
-struct CORBA_SEQUENCE
+struct CORBA_SEQUENCE
// = TITLE
// Utility template class.
//
@@ -164,9 +164,9 @@ struct CORBA_SEQUENCE
~CORBA_SEQUENCE (void) { }
};
-class TAO_Export CORBA
+class TAO_Export CORBA
// = TITLE
- // Provides the CORBA namespace.
+ // Provides the CORBA namespace.
//
// = DESCRIPTION
// This class allows the use of CORBA::Foo, as well as CORBA_Foo
@@ -177,7 +177,7 @@ public:
typedef bool Boolean;
# define B_FALSE false
# define B_TRUE true
-
+
# else /* "bool" not builtin to this compiler */
typedef int Boolean;
enum { B_FALSE = 0, B_TRUE = 1 };
@@ -259,7 +259,7 @@ public:
typedef long double LongDouble;
# else
# define NONNATIVE_LONGDOUBLE
- struct LongDouble
+ struct LongDouble
{
char ld[16];
};
@@ -349,7 +349,7 @@ public:
// String_out
// =DESCRIPTION
// To support the memory management for "out" parameter passing mode.
-
+
public:
// =operations
@@ -376,7 +376,7 @@ public:
char *&ptr (void);
// return underlying instance
-
+
private:
char *&ptr_;
// instance
@@ -396,14 +396,14 @@ public:
typedef wchar_t WChar;
#endif
typedef WChar *WString;
-
+
typedef WChar &WChar_out; // out type for WChar
static WString wstring_alloc (ULong len);
static WString wstring_copy (const WChar *const);
static void wstring_free (WChar *const);
- // various CORBA defined classes
+ // various CORBA defined classes
typedef CORBA_Any Any;
typedef CORBA_Any_var Any_var;
@@ -447,27 +447,27 @@ public:
typedef TypeCode *TypeCode_ptr;
typedef CORBA_UserException UserException;
-
+
typedef CORBA_SEQUENCE <TypeCode_ptr> ExceptionList;
typedef ExceptionList *ExceptionList_ptr;
typedef CORBA_ImplementationDef *ImplementationDef_ptr;
-
+
typedef class CORBA_InterfaceDef *InterfaceDef_ptr;
// enum values defined in nvlist.hh, bitwise ORed.
- typedef u_int Flags;
-
+ typedef u_int Flags;
+
// Completion Status for System exceptions
- enum CompletionStatus
+ enum CompletionStatus
{
COMPLETED_YES, // successful or exceptional completion
COMPLETED_NO, // didn't change any state; retry is OK
COMPLETED_MAYBE // can't say what happened; retry unsafe
};
-
+
// exception type
- enum ExceptionType
+ enum ExceptionType
{
NO_EXCEPTION,
SYSTEM_EXCEPTION,
@@ -517,7 +517,7 @@ public:
static Boolean is_nil (ORB_ptr);
static Boolean is_nil (Principal_ptr);
static Boolean is_nil (ServerRequest_ptr req);
-
+
// = all the CORBA release methods
static void release (POA_ptr);
static void release (Object_ptr);
@@ -531,7 +531,7 @@ public:
static void release (ORB_ptr);
static void release (ServerRequest_ptr req);
- enum TCKind
+ enum TCKind
{
tk_null = 0,
tk_void = 1,
@@ -556,21 +556,21 @@ public:
tk_array = 20,
tk_alias = 21, // 94-11-7
tk_except = 22, // 94-11-7
-
+
// these five are OMG-IDL data type extensions
tk_longlong = 23, // 94-9-32 Appendix A (+ 2)
tk_ulonglong = 24, // 94-9-32 Appendix A (+ 2)
tk_longdouble = 25, // 94-9-32 Appendix A (+ 2)
tk_wchar = 26, // 94-9-32 Appendix A (+ 2)
tk_wstring = 27, // 94-9-32 Appendix A (+ 2)
-
+
// This symbol is not defined by CORBA 2.0. It's used to speed up
// dispatch based on TCKind values, and lets many important ones
// just be table lookups. It must always be the last enum value!!
-
+
TC_KIND_COUNT
};
-
+
// All the typecode constants
static TypeCode_ptr _tc_null;
static TypeCode_ptr _tc_void;
@@ -641,10 +641,10 @@ public:
char *orb_name,
Environment &env);
// ORB initialisation, per OMG document 94-9-46.
-
+
// Define flags for NVList add methods
- enum
- {
+ enum
+ {
ARG_IN = 0x01,
ARG_OUT = 0x02,
ARG_INOUT = 0x04,
@@ -657,8 +657,10 @@ typedef CORBA::OctetSeq TAO_opaque;
extern CORBA::TypeCode TC_opaque;
typedef void (*TAO_Skeleton)(CORBA::ServerRequest &,
- CORBA::Object_ptr,
- CORBA::Environment &);
+ // CORBA::Object_ptr,
+ void *, // object_ptr
+ void *, // context_ptr
+ CORBA::Environment &);
// signature of a skeleton for every operation of an interface
// COM interface IIDs
diff --git a/TAO/tao/poa.cpp b/TAO/tao/poa.cpp
index 454d9065bdf..b3de0dd5b8c 100644
--- a/TAO/tao/poa.cpp
+++ b/TAO/tao/poa.cpp
@@ -3,7 +3,7 @@
// Copyright 1994-1995 by Sun Microsystems Inc.
// All Rights Reserved
//
-// POA initialisation -- both anonymous and (for system bootstrapping)
+// POA initialisation -- both anonymous and (for system bootstrapping)
// named POAs.
//
// XXX at this time, there's a strong linkage between this code and
@@ -43,14 +43,14 @@ CORBA_POA::init (CORBA::ORB_ptr parent,
CORBA_POA::CORBA_POA (CORBA::ORB_ptr owning_orb,
CORBA::Environment &)
- : do_exit_ (CORBA::B_FALSE),
+ : do_exit_ (CORBA::B_FALSE),
orb_ (owning_orb),
call_count_ (0),
skeleton_ (0)
{
TAO_Server_Strategy_Factory *f = orb_->server_factory ();
TAO_ORB_Core* p = TAO_ORB_Core_instance ();
-
+
this->objtable_ = f->create_object_table ();
// @@ What is this doing here? Why is it setting the root poa based
@@ -78,7 +78,7 @@ CORBA_POA::create (CORBA::OctetSeq &key,
else
id = 0;
-
+
data = new IIOP_Object (id,
IIOP::Profile (TAO_ORB_Core_instance ()->orb_params ()->addr (),
@@ -181,7 +181,7 @@ CORBA_POA::register_dir (dsi_handler handler,
CORBA::POA_ptr
CORBA_POA::get_named_poa (CORBA::ORB_ptr orb,
CORBA::String name,
- CORBA::Environment &env)
+ CORBA::Environment &env)
{
env.clear ();
@@ -189,7 +189,7 @@ CORBA_POA::get_named_poa (CORBA::ORB_ptr orb,
{
IIOP_ORB *internet;
- if (orb->QueryInterface (IID_IIOP_ORB, (void **) &internet) == NOERROR)
+ if (orb->QueryInterface (IID_IIOP_ORB, (void **) &internet) == NOERROR)
{
CORBA::POA_ptr tcp_oa;
@@ -202,7 +202,7 @@ CORBA_POA::get_named_poa (CORBA::ORB_ptr orb,
tcp_oa = CORBA::POA::init (orb, poa_name, env);
- if (env.exception () != 0)
+ if (env.exception () != 0)
return 0;
else
return tcp_oa; // derives from POA
@@ -221,7 +221,7 @@ CORBA_POA::get_named_poa (CORBA::ORB_ptr orb,
CORBA::POA_ptr
CORBA_POA::get_poa (CORBA::ORB_ptr orb,
- CORBA::Environment &env)
+ CORBA::Environment &env)
{
env.clear ();
@@ -229,7 +229,7 @@ CORBA_POA::get_poa (CORBA::ORB_ptr orb,
{
IIOP_ORB *internet;
- if (orb->QueryInterface (IID_IIOP_ORB, (void **) &internet) == NOERROR)
+ if (orb->QueryInterface (IID_IIOP_ORB, (void **) &internet) == NOERROR)
{
CORBA::POA_ptr tcp_oa;
@@ -241,7 +241,7 @@ CORBA_POA::get_poa (CORBA::ORB_ptr orb,
tcp_oa = CORBA::POA::init (orb, anonymous, env);
- if (env.exception () != 0)
+ if (env.exception () != 0)
return 0;
else
return tcp_oa; // derives from POA
@@ -255,12 +255,12 @@ CORBA_POA::get_poa (CORBA::ORB_ptr orb,
}
void CORBA_POA::dispatch (CORBA::OctetSeq &key,
- CORBA::ServerRequest &req,
- void *context,
- CORBA::Environment &env)
+ CORBA::ServerRequest &req,
+ void *context,
+ CORBA::Environment &env)
{
ACE_UNUSED_ARG(context);
-
+
TAO_Skeleton skel; // pointer to function pointer for the operation
CORBA::Object_ptr obj; // object that will be looked up based on the key
CORBA::String opname;
@@ -268,27 +268,38 @@ void CORBA_POA::dispatch (CORBA::OctetSeq &key,
// Get the skeleton
// Find the object based on the key
- if (this->find (key, obj) != -1)
+ if (this->find (key, obj) != -1)
{
+#if 0 // XXXASG - testing a new way of handling requests to overcome the
+ // casting problem arising out of virtual inheritance
opname = req.op_name ();
// Find the skeleton "glue" function based on the operation name
if (obj->find (opname, skel) != -1)
// Schedule the upcall. This is the degenerate case of scheduling...
// using a "do it now!" scheduler
- skel (req, obj, env);
+ skel (req, obj, env);
else
- {
- // Something really bad happened: the operation was not
- // found in the object, fortunately there is a standard
- // exception for that purpose.
- env.exception (new CORBA_BAD_OPERATION (CORBA::COMPLETED_NO));
- ACE_ERROR ((LM_ERROR,
- "Cannot find operation <%s> in object\n",
- opname));
- }
+ {
+ // Something really bad happened: the operation was not
+ // found in the object, fortunately there is a standard
+ // exception for that purpose.
+ env.exception (new CORBA_BAD_OPERATION (CORBA::COMPLETED_NO));
+ ACE_ERROR ((LM_ERROR,
+ "Cannot find operation <%s> in object\n",
+ opname));
+ }
+#endif
+ obj->dispatch (req, context, env);
+ }
+ else
+ {
+ env.exception (new CORBA::OBJECT_NOT_EXIST (CORBA::COMPLETED_NO));
+ ACE_ERROR ((LM_ERROR, "Cannot find object\n"));
+
}
+ // @@ XXXASG -
// We need to pass this skel and associated information to the
// scheduler. How do we do it??
}
@@ -301,7 +312,7 @@ CORBA_POA::find (const CORBA::OctetSeq &key,
}
int
-CORBA_POA::bind (const CORBA::OctetSeq &key,
+CORBA_POA::bind (const CORBA::OctetSeq &key,
CORBA::Object_ptr obj)
{
return objtable_->bind (key, obj);
@@ -315,16 +326,16 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
CORBA::Environment &env)
{
ACE_UNUSED_ARG (some_info);
-
+
IIOP_ServerRequest svr_req (&request_body, this->orb (), this);
// Why are we copying this when we can just pass in a handle to the
// hdr?
- svr_req.opname_ = hdr.operation;
+ svr_req.opname_ = hdr.operation;
this->dispatch (hdr.object_key,
svr_req,
- 0, // this is IIOP residue
+ 0, // this is IIOP residue
env);
svr_req.release ();
@@ -332,7 +343,7 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
// If no reply is necessary (i.e., oneway), then return!
if (hdr.response_expected == 0)
return;
-
+
// Otherwise check for correct parameter handling, and reply as
// appropriate.
//
@@ -351,19 +362,19 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
resp_ctx.length = 0;
response.encode (&TC_ServiceContextList, &resp_ctx, 0, env);
response.put_ulong (hdr.request_id);
-
+
CORBA::TypeCode_ptr tc;
const void *value;
- if (!svr_req.params_ && env.exception () == 0)
+ if (!svr_req.params_ && env.exception () == 0)
{
dmsg ("DSI user error, didn't supply params");
env.exception (new CORBA::BAD_INV_ORDER (CORBA::COMPLETED_NO));
}
// Standard exceptions only.
- if (env.exception () != 0)
- {
+ if (env.exception () != 0)
+ {
CORBA::Environment env2;
CORBA::Exception *x = env.exception ();
CORBA::TypeCode_ptr except_tc = x->type ();
@@ -374,7 +385,7 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
// Any exception at all.
else if (svr_req.exception_)
- {
+ {
CORBA::Exception *x;
CORBA::TypeCode_ptr except_tc;
@@ -385,43 +396,43 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
//
// XXX x->type () someday ...
if (svr_req.ex_type_ == CORBA::SYSTEM_EXCEPTION)
- response.put_ulong (TAO_GIOP_SYSTEM_EXCEPTION);
+ response.put_ulong (TAO_GIOP_SYSTEM_EXCEPTION);
else
- response.put_ulong (TAO_GIOP_USER_EXCEPTION);
+ response.put_ulong (TAO_GIOP_USER_EXCEPTION);
(void) response.encode (except_tc, x, 0, env);
}
// Normal reply.
else
- {
+ {
// First finish the GIOP header ...
response.put_ulong (TAO_GIOP_NO_EXCEPTION);
// ... then send any return value ...
if (svr_req.retval_)
- {
- tc = svr_req.retval_->type ();
- value = svr_req.retval_->value ();
- (void) response.encode (tc, value, 0, env);
- }
+ {
+ tc = svr_req.retval_->type ();
+ value = svr_req.retval_->value ();
+ (void) response.encode (tc, value, 0, env);
+ }
// ... Followed by "inout" and "out" parameters, left to right
for (u_int i = 0;
i < svr_req.params_->count ();
i++)
- {
- CORBA::NamedValue_ptr nv = svr_req.params_->item (i);
- CORBA::Any_ptr any;
-
- if (!(nv->flags () & (CORBA::ARG_INOUT|CORBA::ARG_OUT)))
- continue;
-
- any = nv->value ();
- tc = any->type ();
- value = any->value ();
- (void) response.encode (tc, value, 0, env);
- }
+ {
+ CORBA::NamedValue_ptr nv = svr_req.params_->item (i);
+ CORBA::Any_ptr any;
+
+ if (!(nv->flags () & (CORBA::ARG_INOUT|CORBA::ARG_OUT)))
+ continue;
+
+ any = nv->value ();
+ tc = any->type ();
+ value = any->value ();
+ (void) response.encode (tc, value, 0, env);
+ }
}
}