//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / OVOPS++
//
//File: factory.h
//
//Version: $Revision: 1.24 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/10/19 08:46:02 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
// 
//Authors:
//      Pasi Nummisalo
//      Timo Pärnänen
//	Vesa-Matti Puro
//
//Description:
//      Factory is a default conduit for a Mux. When a new session
//      has to be set up, the Factory installs a new instance of the
//      required session protocol on SideB of the mux. Factory
//      Can also be used as default conduit that logs erros and responds
//      to them.      
//
//      Prototype pattern specify the kinds of objects to create using a
//      prototypical instance, and create new objects by copying this
//      prototype. Factory method pattern defines an iterface for creating
//      an object.   
//
//Copyright:    
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//      
//Licence:
//     
//
//History:
//
//
 
#ifndef __PF_FACTORY_H__
#define __PF_FACTORY_H__

#include "protocol.h"

class pfFactory : public pfProtocol
{
    public:
        static pfConduit createFactory(pfConduit &prototype_);
        static pfConduit createFactory(pfConduit &aSidePrototype_,
                                       pfConduit &bSidePrototype_);
        pfFactory(const pfFactory &other_);
        virtual ~pfFactory(void);
        
        virtual void accept(pfTransporter *transporter_);
        virtual void makeConduit(pfConduit &aSide_, pfConduit &bSide_) const;

        virtual pfKey sendInstallerToA(pfConduit &conduit_,
                                       bool useKey_ = 0,
                                       pfKey key_ = 0);
        virtual pfKey sendInstallerToB(pfConduit &conduit_,
                                       bool useKey_ = 0,
                                       pfKey key_ = 0); 
        
    protected:
        pfFactory(void);
        virtual pfProtocol *cloneImplementation(void) const;
        virtual void acceptSynchronous(pfTransporter *transporter_);
        
    private:
	pfFactory &operator=(const pfFactory &other_);
        pfConduit _aSidePrototype;
        pfConduit _bSidePrototype;
        bool _bSideSet;
};

#endif // __PF_FACTORY_H__

