//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project
//
//File: msg_impl.h
//
//Version: $Revision: 1.14 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/10/12 14:08:18 $
//
//Organisation:
//      Open Environment Software Oy
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//	Vesa-Matti Puro
//      Jussi Turunen
//
//Description:
//      Implementation of the otMessage IDL interface. The implementation
//      is herited from both the OmniBroker skeleton class and pfAdapter
//      conduit, so that it can provide a direct IDL interface to a conduit.
//
//Copyright:
//      Copyright Open Environment software Oy (unpublished / work in progress)
//      ALL RIGHTS RESERVED.
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History: 

#ifndef __ADAPTER_FORWARDER_H__
#define __ADAPTER_FORWARDER_H__

#include <JTC/JTC.h>
#include <OB/CORBA.h>
#include <OB/Util.h>

#include <typeinfo>
#include <string>
#include "msg_skel.h"

class pfState;

class oesSender : public JTCThread
{
    public:
        oesSender(string identifier_,
                  otMessage::SerializedMessage message_,
                  otMessage_ptr ior_,
                  string destination_);
        virtual ~oesSender(void);
        virtual void run(void);

    private:
        void printMessage(const string &identifier_,
                   const otMessage::SerializedMessage& message_);
        string _identifier;
        otMessage::SerializedMessage _message;
        otMessage_ptr _ior;
        string _destination;
};

class oesForwarder : public otMessage_skel
{
    public:
        oesForwarder(CORBA_ORB_ptr orb_);
        virtual ~oesForwarder(void);

        virtual void send(const char* identifier_,
                          const otMessage::SerializedMessage& message_);
        virtual otMessage::SerializedMessage*
	  sendTwoWay(const char* identifier_,
		     const ParameterList& parameters_);
        static CORBA_Object_ptr loadIOR(CORBA_ORB_ptr orb_,
                                        const string &filename_);

    private:
        JTCInitialize _init;
        otMessage_var _n1tior;
        otMessage_var _n1rior;
        otMessage_var _iutior;
        otMessage_var _opior;
        otMessage_var _testertior;
        otMessage_var _testerrior;
};

#endif // __ADAPTER_FORWARDER_H__

