Entering content frame

Procedure documentation Implementing the Callback Object Locate the document in its SAP Library structure

Use

Use the Notificator_impl.cpp file that you have generated in the Generating C++ Code for the Notificator Object step of this tutorial to provide an implementation of the message method of the callback object.

Procedure

...

       1.      Open the Notificator_impl.cpp file for editing.

       2.      Enter the following code in the body of the message method:

void

examples::iiop::Notificator_impl::message(::CORBA::WStringValue* arg0)

   throw(CORBA::SystemException)

{

   cout << endl << "Notificator: ";

 

   const CORBA::WChar*  w = arg0->_boxed_in();

   while(*w != 0)

      cout << (char)(*w++);

 

   cout << endl; 

}

Result

You now have a fully-functional implementation of the Notificator callback object.

The full source code of the Notificator_impl.cpp file must be:

#include <OB/CORBA.h>

#include <Notificator_impl.h>

 

#include <iostream.h>

//

// IDL:examples:1.0

//

 

//

// IDL:examples/iiop:1.0

//

 

//

// RMI:examples.iiop.Notificator:0000000000000000

//

examples::iiop::Notificator_impl::Notificator_impl(PortableServer::POA_ptr poa)

   : poa_(PortableServer::POA::_duplicate(poa))

{

}

 

examples::iiop::Notificator_impl::~Notificator_impl()

{

}

 

PortableServer::POA_ptr

examples::iiop::Notificator_impl::_default_POA()

{

   return PortableServer::POA::_duplicate(poa_);

}

 

//

// IDL:examples/iiop/Notificator/message:1.0

//

void

examples::iiop::Notificator_impl::message(::CORBA::WStringValue* arg0)

   throw(CORBA::SystemException)

{

   cout << endl << "Notificator: ";

 

   const CORBA::WChar*  w = arg0->_boxed_in();

   while(*w != 0)

      cout << (char)(*w++);

 

   cout << endl;

}

Next Step:

Implementing the Client

 

Leaving content frame