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
|
// $Id$
#include "tao/corba.h"
#if !defined (__ACE_INLINE__)
# include "tao/Request.i"
#endif /* ! __ACE_INLINE__ */
ACE_RCSID(tao, Request, "$Id$")
CORBA::ULong
CORBA_Request::_incr_refcnt (void)
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->refcount_lock_, 0);
return refcount_++;
}
CORBA::ULong
CORBA_Request::_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;
}
// Reference counting for DII Request object
// DII Request class implementation
CORBA_Request::CORBA_Request (CORBA::Object_ptr obj,
const CORBA::Char *op,
CORBA::NVList_ptr args,
CORBA::NamedValue_ptr result,
CORBA::Flags flags)
: args_ (args),
result_ (result),
flags_ (flags),
refcount_ (1)
{
target_ = CORBA::Object::_duplicate (obj);
opname_ = CORBA::string_copy (op);
}
CORBA_Request::CORBA_Request (CORBA::Object_ptr obj,
const CORBA::Char *op)
: flags_ (0),
refcount_ (1)
{
target_ = CORBA::Object::_duplicate (obj);
opname_ = CORBA::string_copy (op);
ACE_NEW (args_, CORBA::NVList);
ACE_NEW (result_, CORBA::NamedValue);
}
CORBA_Request::~CORBA_Request (void)
{
assert (refcount_ == 0);
CORBA::release (this->target_);
CORBA::string_free ((CORBA::String) 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 (void)
{
STUB_Object *stub = this->target_->_stubobj ();
stub->do_dynamic_call ((char *) opname_,
CORBA::B_TRUE,
args_,
result_,
flags_,
exceptions_,
env_);
}
void
CORBA_Request::send_oneway (void)
{
STUB_Object *stub = this->target_->_stubobj ();
stub->do_dynamic_call ((char *) opname_,
CORBA::B_FALSE,
args_,
result_,
flags_,
exceptions_,
env_);
}
|