blob: 0c8683b1bee6bbd4e483911aefdca253032d20ec (
plain)
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
|
// $Id$
#include "Notifier_Handler.h"
ACE_RCSID(Supplier, Notifier_Handler, "$Id$")
Notifier_Handler::Notifier_Handler (void)
{
// No-Op.
}
// Destroy a Notifier target object.
Notifier_Handler::~Notifier_Handler (void)
{
this->close ();
}
int
Notifier_Handler::close (void)
{
if (this->notifier_ != 0)
{
ACE_DEBUG ((LM_DEBUG,
"closing down Notifier_Handler\n"));
CORBA::release (this->notifier_);
this->notifier_ = 0;
}
return 0;
}
Event_Comm::Notifier *
Notifier_Handler::notifier (void)
{
return this->notifier_;
}
void
Notifier_Handler::notifier (Event_Comm::Notifier *notifier)
{
if (this->notifier_ != notifier)
{
CORBA::release (this->notifier_);
this->notifier_ = notifier;
}
}
// Init function.
int
Notifier_Handler::init (int argc, char *argv[])
{
TAO_TRY
{
// Retrieve the ORB.
this->orb_ = CORBA::ORB_init (argc,
argv,
0,
TAO_TRY_ENV);
TAO_CHECK_ENV;
// Initialization of the naming service.
if (this->naming_client_.init (orb_.in ()) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) Unable to initialize "
"the TAO_Naming_Client. \n"),
-1);
CosNaming::Name notifier_ref_name (1);
notifier_ref_name.length (1);
notifier_ref_name[0].id =
CORBA::string_dup (NOTIFIER_BIND_NAME);
CORBA::Object_var notifier_obj =
this->naming_client_->resolve (notifier_ref_name,
TAO_TRY_ENV);
TAO_CHECK_ENV;
// The CORBA::Object_var object is downcast to Notifier_var
// using the <_narrow> method.
this->notifier_ =
Event_Comm::Notifier::_narrow (notifier_obj.in (),
TAO_TRY_ENV);
TAO_CHECK_ENV;
return 0;
}
TAO_CATCHANY
{
TAO_TRY_ENV.print_exception ("Notifier_Handler::init\n");
return -1;
}
TAO_ENDTRY;
return 0;
}
|