//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project/CC
//
//File: ccCrossConnectorMux.cpp
//
//Version: $Revision: 1.5 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/11/05 08:21:56 $
//
//Organisation:
//      University of Technology
// 
//Author:
//      Pasi Nummisalo
//
//Description:
//     See header.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//      
//Licence:
//     
//
//History:
//

#include "cccrossconnectormux.h"
#include "pf/debug.h"

ccCrossConnectorMux *ccCrossConnectorMux :: _only = 0;

ccCrossConnectorMux :: ccCrossConnectorMux(pfKey maxKeyValue_,
                                           const string &keyName_)
    : pfMux(maxKeyValue_, keyName_)
{
    return;
}

ccCrossConnectorMux :: ~ccCrossConnectorMux(void)
{
    _only = 0;
    return;
}

ccCrossConnectorMux *ccCrossConnectorMux :: instance(void)
{
    if(_only == 0)
    {
        string name = getLinkIdName();
        _only = new ccCrossConnectorMux(0xFFFFFF, name);
    }
    return _only;
}

//
//Function: toFactory
//
//Description:
//   This method is called when dispatch key is not found.
//

void ccCrossConnectorMux :: toFactory(pfTransporter *transporter_)
{
    if(transporter_ == 0)
    {
        debugUser("Port/link id not found");
    }
    else
    {
        debugPfUlong("Port/link id not found", transporter_->getKey());
    }
    return;
}

//
//Function: noReference
//
//Description:
//   Over written because this is a singleton and
//   runtime deletions are not allowed
//

int ccCrossConnectorMux :: noReference(void) const
{
    int reference = 0; // allways references
    return reference;
}


string ccCrossConnectorMux :: getLinkIdName(void)
{
    string linkIdName("linkId");
    return linkIdName;
}

