//******************************************************************************
//
// Restricted Rights
// WARNING: This is a restricted distribution Zeligsoft file.
//
//******************************************************************************
//
// Copyright (C) 2006 Zeligsoft Inc. - All Rights Reserved
//

//******************************************************************************
//
//     FILE: zcePushPorts_OctetSeqConsumerUsesPort.h
//
//******************************************************************************

#ifndef __ZCEPUSHPORTS_OCTETSEQCONSUMERUSESPORT_H
#define __ZCEPUSHPORTS_OCTETSEQCONSUMERUSESPORT_H


#if defined(OS_WIN32)
#pragma warning(disable:4786)
#endif

#include "zceOperatingEnvironment.h"

#include <string>

#include "CF_s.h"


#include "PushPorts.h"
#include "PushPorts_s.h"


#define ZCEPUSHPORTS_OCTETSEQCONSUMERUSESPORT_CARDINALITY_DEFAULT 1


class zcePushPorts_OctetSeqConsumerUsesPort : public POA_CF::Port
{
	public : 
		zcePushPorts_OctetSeqConsumerUsesPort( std::string name ZCE_EXC_ENV_ARG);

		virtual ~zcePushPorts_OctetSeqConsumerUsesPort();

		/*!
		 * \brief Applications require the connectPort operation to establish associations
		 * between Ports. Ports provide channels through which data and/or control pass.
		 * The connectPort operation provides half of a two-way association; therefore two
		 * calls are required to create a two-way association.
		 *
		 * Specification reference:  3.1.3.1.1.5.1
		 *
		 * The connectPort operation shall make a connection to the component identified
		 * by its input parameters. A port may support several connections. The input
		 * connectionId is a unique identifier to be used by disconnectPort when breaking
		 * this specific connection.
		 *
		 * \return This operation does not return a value.
		 *
		 * \throw InvalidPort The connectPort operation shall raise the InvalidPort
		 * exception when the input connection parameter is an invalid connection for this
		 * Port.
		 *
		 * \throw OccupiedPort The connectPort operation shall raise the OccupiedPort
		 * exception when unable to accept the connections because the Port is already
		 * fully occupied.
		 *
		 */
		void connectPort ( CORBA::Object_ptr connection,  const char * connectionId ZCE_EXC_ENV_ARG)
			throw ( CORBA::SystemException, CF::Port::InvalidPort, CF::Port::OccupiedPort );

		/*!
		 * \brief Applications require the disconnectPort operation in order to allow
		 * consumer/producer data components to disassociate themselves from their
		 * counterparts (consumer/producer).
		 *
		 * Specification reference:  3.1.3.1.1.5.2
		 *
		 * The disconnectPort operation shall break the connection to the component
		 * identified by the input parameter.
		 *
		 * \return This operation does not return a value.
		 *
		 * \throw InvalidPort The disconnectPort operation shall raise the InvalidPort
		 * exception when the name passed to disconnectPort is not connected with the Port
		 * component.
		 *
		 */
		void disconnectPort ( const char * connectionId ZCE_EXC_ENV_ARG)
			throw ( CORBA::SystemException , CF::Port::InvalidPort );


		/*!	\brief
		 *
		 *	 Describe operation here.
		 * 
		 *	\param msg ( ::CF::OctetSequence ) 
		 * 
		 *	\param options ( ::CF::Properties ) 
		 * 
		 */
		void processOctetMsg( const CF::OctetSequence& msg, const CF::Properties& options ZCE_EXC_ENV_ARG );


		bool is_connected(ZCE_EXC_ENV_SINGLE_ARG);



	private : 
		::PushPorts::OctetSeqConsumer_var port_;

		std::string name_; // the name of the port

		std::string connectionId_; // the id of the connection that the port is involved in

		short consCount_; // a count of the number of consumers connected to the port

		short cardinality_; // the maximum number of connections accepted by this port


};
#endif     // __ZCEPUSHPORTS_OCTETSEQCONSUMERUSESPORT_H

// End-Of-File
//------------------------------------------------------------------------------
