//Editor-Info: -*- C++ -*-
//
//Subject:
//
//File: taprimitives.h
//
//Version: $Revision: 1.14 $
//
//State: $State: Exp $
//
//Date: $Date: 1999/03/11 18:57:00 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//	Vesa-Matti Puro
//      Jussi Turunen
//
//Description:
//      Encapsulation class for otMessage::SerializedMessage which allows
//      it to travel a conduit graph. Has send method for sending
//      data to a otMessage_var receiver which implements the otMessage
//      IDL interface.
//
//Copyright:
//
//
//Licence:
//
//
//History: 
//
//

#ifndef __ADAPTER_TAPRIMITIVES_H__
#define __ADAPTER_TAPRIMITIVES_H__

// codinglib.a files compile ok, but everything else seems to break if 
// this is omitted. Could somehow be related to msg.h .

class pfState;
class pfProtocol;

class usscfProtocol;
class sscopProtocol;

#include <typeinfo>
#include <string>

#include "pf/messenge.h"
#include "msg.h"

class taMessenger : public pfMessenger
{
    public:
        taMessenger();
        taMessenger(const string &identifier_);
        taMessenger(const string &identifier_,
                    const otMessage::SerializedMessage& message_);
        taMessenger(const taMessenger &other_);
        virtual ~taMessenger(void);

        virtual void apply(pfState *state_,
                           pfProtocol *protocol_);
        virtual void send(const otMessage_var &receiver_);

        // Methods for accessing private class members
        string getIdentifier(void) const;
        otMessage::SerializedMessage getData(void) const;

        // access methods for _data
        int getIntFieldValue(const string &fieldName_) const;
        string getStringFieldValue(const string &fieldName_) const;
        pfFrame getFieldAsFrame(const string &fieldName_) const;

        void printData(void) const;
        string printKind(otMessage::ElementKind kind_) const;

    private:
        void doSomething(pfState *state_, pfProtocol *protocol_);
        void executeSSCOPstate1(pfState *state_, 
                                sscopProtocol *sscop_);
        void executeSSCOPstate2(pfState *state_, 
                                sscopProtocol *sscop_);
        void executeSSCOPstate4(pfState *state_, 
                                sscopProtocol *sscop_);
        void executeSSCOPstate5(pfState *state_, 
                                sscopProtocol *sscop_);
        void executeSSCOPstate10(pfState *state_, 
                                 sscopProtocol *sscop_);
        
        void executeUSSCFstate1_1(pfState *state_,
                                  usscfProtocol *protocol_);
        void executeUSSCFstate2_2(pfState *state_,
                                  usscfProtocol *protocol_);
        void executeUSSCFstate2_5(pfState *state_,
                                  usscfProtocol *protocol_);
        void executeUSSCFstate3_4(pfState *state_,
                                  usscfProtocol *protocol_);
        void executeUSSCFstate4_10(pfState *state_,
                                   usscfProtocol *protocol_);

        const char *dupString(const string &s_) const;
        otMessage::SerializedMessage _data;
        string _identifier;
        
        

};

//////////////////////////////////////////////////////////////////
// Class taInputs
//
// Pure virtual interface class for all protocol states using
// TA-interface (between protocol tester and system under test).
// Primitive messengers (requests and responses from testers)
// are defined above.
//

class taInputs
{
    public:
        virtual void taMessengerAct(taMessenger *messenger_,
                                    pfProtocol *protocol_) = 0;
};

#endif // __ADAPTER_TAPRIMITIVES_H__

