//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / SW
//
//File: swunilink.cpp
//
//Version: $Revision: 1.9 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/12/04 16:24:53 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Timo Pärnänen
//
//Description:
//      See corresponding header file.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History: 

#include <autoptr.h>
#include "pf/factory.h"
#include "pf/mux.h"
#include "pf/debug.h"
#include "protocol/uni/unistrings.h"
#include "protocol/uni/unicoordprotocol.h"
#include "swswitch.h"
#include "swunilink.h"

// create & clone

swUNIlink *swUNIlink :: createPrototype(void)
{
    swUNIlink *newLink = new swUNIlink();
    return newLink;
}

swUNIlink *swUNIlink :: clonePrototype(pfUlong linkIdentifier_)
{
    auto_ptr<swUNIlink> newLink(new swUNIlink(*this));
    newLink->setConduits(linkIdentifier_);
    newLink->connectProtocols();
    return newLink.release();
}

// constructors & destructor

swUNIlink :: swUNIlink(void)
    : swLink()
{
    return;
}

swUNIlink :: swUNIlink(const swUNIlink &other_)
    : swLink(other_)
{
    return;
}

swUNIlink :: ~swUNIlink(void)
{
    return;
}

void swUNIlink :: setConduits(pfUlong linkIdentifier_)
{
    pfConduit uniProxy = swSwitch::instance()->getUNIprototype();
    uniProxy.setId(linkIdentifier_);
    _factoryProxy = pfFactory::createFactory(uniProxy);
    _factoryProxy.setId(linkIdentifier_);
    _muxProxy = pfMux::createMux(_maxMuxKeyValue, uniMuxReferenceStr);
    _muxProxy.setId(linkIdentifier_);
    _coOrdProxy = uniCoOrdProtocol::create(_muxProxy);
    _coOrdProxy.setId(linkIdentifier_);
    
    setLinkIdentifier(linkIdentifier_);
    return;
}
