//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / mgmt module
//
//File: mgmtsend.h
//
//Version: $Revision: 1.12 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/12/16 15:30:21 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Timo Kokkonen
//
//Description:
//      Base class for corba interface with un/register to other and nameserver,
//      sending getValue, setValue and execute over corba. Version 1 there can be
//      only one connection at same time. So class can register to only one
//      or only one other can register in. It is possible register to the nameserver
//      and one otherside at the same time.
//
//      Possible exceptions: Comes from class toveSwitch_impl.
//                           pfException(uniCauseValue_NWOutOfOrder)
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History:
//
#ifndef __MGMT_SEND_H__
#define __MGMT_SEND_H__

#include <typeinfo>
#include <string>

#include "pf/naming.h"
#include "pf/types.h"
#include "mgmtcommand.h"

class mgmtDelegationBase;

class mgmtSend
{
    public:
        virtual ~mgmtSend(void);

        static mgmtSend *createOB(mgmtDelegationBase *delegationPtr_);

        void registerToNameService(const string &name_);
        void unRegisterToNameService(void);
        virtual void registerToOther(const string &name_) = 0;
        virtual void unRegisterToOther(void) = 0;

        virtual string sendGet(const string &name_) = 0;
        virtual void sendSet(const string &name_, const string &value_) = 0;
        virtual void sendExecute(mgmtCommand &command_) = 0;

    protected:
        mgmtSend(void);

        virtual void registerIfaceToNameService(void) = 0;
        virtual void unRegisterIfaceToNameService(void) = 0;

        void receiveRegister(void);
        void receiveUnRegister(void);
        string receiveGet(const string &name_);
        void receiveSet(const string &name_, const string &value_);
        void receiveExecute(mgmtCommand &command_);

        virtual void registerUserInterface(CORBA_Object_ptr iface_) = 0;
        virtual void unregisterUserInterface(CORBA_Object_ptr iface_) = 0;

        bool _isUIregistered;
        mgmtDelegationBase *_delegationPtr;
        CosNaming_Name _name;
};

#endif // __MGMT_SEND_H__

