1 #include "MessengerHandler.h"
2 #include "ace/OS_NS_time.h"
5 // Implementation skeleton constructor
6 MessengerHandler::MessengerHandler (CORBA::ORB_ptr orb
)
8 , orb_(CORBA::ORB::_duplicate(orb
))
12 // Implementation skeleton destructor
13 MessengerHandler::~MessengerHandler ()
17 void MessengerHandler::send_message (
18 CORBA::Boolean ami_return_val
,
27 const ACE_TCHAR
* time_str
= ACE_OS::ctime(&t
);
29 std::cout
<< std::endl
<< "Message sent at " <<
30 ACE_TEXT_ALWAYS_CHAR (time_str
) << std::endl
;
32 std::cout
<< "Content of message: " << message
<< std::endl
;
36 std::cerr
<< "Error: Message was not sent." << std::endl
;
38 // Our simple test just shuts down after sending one message.
39 orb_
->shutdown(false);
42 void MessengerHandler::send_message_excep (Messaging::ExceptionHolder
* excep_holder
)
44 // We'll print an error message and shut down the orb
47 excep_holder
->raise_exception();
49 catch(const CORBA::Exception
& ex
)
51 std::cerr
<< "A CORBA Exception was thrown: " << ex
<< std::endl
;
53 orb_
->shutdown(false);