1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
// -*- Mode: C++; -*-
// Package : omniORB
// callDescriptor.h Created on: 12/98
// Author : David Riddoch (djr)
//
// Copyright (C) 1996-1999 AT&T Research Cambridge
//
// This file is part of the omniORB library.
//
// The omniORB library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Description:
//
/*
$Log: callDescriptor.h,v $
Revision 1.1.2.1 1999/09/24 09:51:43 djr
Moved from omniORB2 + some new files.
*/
#ifndef __OMNIORB_CALLDESCRIPTOR_H__
#define __OMNIORB_CALLDESCRIPTOR_H__
class omniObjRef;
class omniServant;
class GIOP_C;
//////////////////////////////////////////////////////////////////////
///////////////////////// omniCallDescriptor /////////////////////////
//////////////////////////////////////////////////////////////////////
class omniCallDescriptor {
public:
typedef void (*LocalCallFn)(omniCallDescriptor*, omniServant*);
inline omniCallDescriptor(LocalCallFn lcfn, const char* op,
int op_len, _CORBA_Boolean oneway = 0)
: pd_localCall(lcfn),
pd_is_oneway(oneway),
pd_op(op), pd_oplen(op_len),
pd_ctxt(0) {}
///////////////////////////////
// Methods to implement call //
///////////////////////////////
virtual _CORBA_ULong alignedSize(_CORBA_ULong);
// Defaults to no arguments.
virtual void marshalArguments(GIOP_C&);
// Defaults to no arguments.
virtual void unmarshalReturnedValues(GIOP_C&);
// Defaults to no arguments and returns void.
virtual void userException(GIOP_C&, const char*);
// Defaults to no user exceptions, and thus throws
// CORBA::MARSHAL. Any version of this should in all
// cases either throw a user exception or CORBA::MARSHAL.
// Must call giop_client.RequestCompleted().
///////////////
// Accessors //
///////////////
inline const char* op() const { return pd_op; }
inline size_t op_len() const { return pd_oplen; }
inline _CORBA_Boolean is_oneway() const { return pd_is_oneway; }
inline void doLocalCall(omniServant* servant) {
pd_localCall(this, servant);
}
/////////////////////
// Context support //
/////////////////////
struct ContextInfo {
inline ContextInfo(CORBA::Context_ptr c, const char*const* cl, int n)
: context(c), expected(cl), num_expected(n) {}
CORBA::Context_ptr context;
const char*const* expected;
int num_expected;
};
inline void set_context_info(const ContextInfo* ci) { pd_ctxt = ci; }
inline const ContextInfo* context_info() { return pd_ctxt; }
private:
omniCallDescriptor(const omniCallDescriptor&);
omniCallDescriptor& operator = (const omniCallDescriptor&);
// Not implemented.
LocalCallFn pd_localCall;
_CORBA_Boolean pd_is_oneway;
const char* pd_op;
size_t pd_oplen;
const ContextInfo* pd_ctxt;
};
//////////////////////////////////////////////////////////////////////
/////////////////////////// omniStdCallDesc //////////////////////////
//////////////////////////////////////////////////////////////////////
// This just provides a namespace for pre-defined call descriptors.
class omniStdCallDesc {
public:
// Mangled signature: void
typedef omniCallDescriptor void_call;
// Mangled signature: _cCORBA_mObject_i_cstring
class _cCORBA_mObject_i_cstring : public omniCallDescriptor {
public:
inline _cCORBA_mObject_i_cstring(LocalCallFn lcfn, const char* op,
size_t oplen, _CORBA_Boolean oneway, const char* a_0) :
omniCallDescriptor(lcfn, op, oplen, oneway),
arg_0(a_0) {}
virtual CORBA::ULong alignedSize(CORBA::ULong size_in);
virtual void marshalArguments(GIOP_C&);
virtual void unmarshalReturnedValues(GIOP_C&);
inline CORBA::Object_ptr result() { return pd_result; }
const char* arg_0;
CORBA::Object_ptr pd_result;
};
};
//////////////////////////////////////////////////////////////////////
///////////////////// omniLocalOnlyCallDescriptor ////////////////////
//////////////////////////////////////////////////////////////////////
// This class is needed to support calls to objects which
// may only reside in the local address space.
// eg. ServantLocator, ServantActivator, AdapterActivator.
class omniLocalOnlyCallDescriptor : public omniCallDescriptor {
public:
omniLocalOnlyCallDescriptor(LocalCallFn lcfn, const char* op,
int op_len, _CORBA_Boolean is_oneway = 0)
: omniCallDescriptor(lcfn, op, op_len, is_oneway) {}
// We only need to override this one -- as it will throw an
// exception, so the other members won't get called.
virtual _CORBA_ULong alignedSize(_CORBA_ULong);
};
#endif // __OMNIORB_CALLDESCRIPTOR_H__
|