1 // Smart_Messenger_Proxy.cpp
3 #include "Smart_Messenger_Proxy.h"
6 Smart_Messenger_Proxy_Factory::Smart_Messenger_Proxy_Factory(
9 std::cout
<< "Creating smart proxy factory" << std::endl
;
10 // Convert the contents of the Logger.ior file to an object reference.
11 CORBA::Object_var obj
= orb
->string_to_object("file://Logger.ior");
12 if (CORBA::is_nil(obj
.in())) {
13 std::cerr
<< "Nil Logger reference" << std::endl
;
17 // Narrow the object reference to a Logger object reference.
18 logger_
= Logger::_narrow(obj
.in());
19 if (CORBA::is_nil(logger_
.in ())) {
20 std::cerr
<< "Not a Logger object reference" << std::endl
;
26 Smart_Messenger_Proxy_Factory::create_proxy (
29 Messenger_ptr smart_proxy
= 0;
30 if (CORBA::is_nil(proxy
) == 0)
31 smart_proxy
= new Smart_Messenger_Proxy(proxy
, logger_
.in());
36 Smart_Messenger_Proxy::Smart_Messenger_Proxy(
37 Messenger_ptr proxy
, Logger_ptr logger
)
38 : TAO_Smart_Proxy_Base(proxy
),
39 logger_(Logger::_duplicate(logger
))
41 std::cout
<< "Creating smart proxy" << std::endl
;
45 Smart_Messenger_Proxy::send_message (
46 const char * user_name
,
50 logger_
->log_message("Before send_message()");
51 CORBA::Boolean ret_val
=
52 TAO_Messenger_Smart_Proxy_Base::send_message(user_name
, subject
, message
);
53 logger_
->log_message("After send_message()");