//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / debug/event
//
//File: pushsupplier_impl.cpp
//
//Version: $Revision: 1.1 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/07/10 11:45:32 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Timo Kokkonen
//
//Description:
//      See corresponding header file.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History:
//
#include <OB/CORBA.h>
#include <OB/Util.h>

#ifdef HAVE_UNISTD_H
#   include <unistd.h>
#endif
  
#include <stdio.h>
#include <time.h>

#include "pushsupplier_impl.h"

//
//Function: constructor
//
//Description:
//
//
PushSupplier_impl :: PushSupplier_impl(CosEventComm_PushConsumer *consumer)
    : consumer_(consumer)
{
    return;
}

//----------------------------------------------------------------------

//
//Function: destructor
//
//Description:
//
//
PushSupplier_impl :: ~PushSupplier_impl(void)
{
    if (!CORBA_is_nil(consumer_))
    {
	consumer_ -> disconnect_push_consumer();
    }

    return;
}

//----------------------------------------------------------------------

//
//Function: 
//
//Description: disconnect_push_supplier
//
//
void PushSupplier_impl :: disconnect_push_supplier(void)
{
    consumer_ = CosEventComm_PushConsumer::_nil();

    return;
}

//----------------------------------------------------------------------

//
//Function: send
//
//Description:
//
//
void PushSupplier_impl :: send(const string &info_)
{
    try
    {
        CORBA_Any any;

        any <<= CORBA_string_dup(info_.c_str());
        consumer_ -> push(any);
    }

    catch (CORBA_SystemException& ex)
    {
        OBPrintException(ex);
    }

    return;
}
