#include "ArcnetRouter.h"

namespace cosi {

namespace library {

namespace wiredbas {

std::string ArcnetRouter::ComponentName = "ArcnetRouter";
std::string ArcnetRouter::ComponentType = "Router";

ArcnetRouter::ArcnetRouter() {
	//set up the ports
	mPorts.AddPort("P1", "EIA-485", cosi::PortInterface::INOUT) ;
	mPorts.AddPort("P2", "EIA-485", cosi::PortInterface::INOUT) ;
	mPorts.AddPort("P3", "EIA-485", cosi::PortInterface::INOUT) ;
	mPorts.AddPort("P4", "EIA-485", cosi::PortInterface::INOUT) ;
}

ArcnetRouter::~ArcnetRouter() {
}

cosi::commstruct::wiredbas::PlatformInstance* ArcnetRouter::GetPlatformInstance(
		int V, Position pP) {
	cosi::commstruct::wiredbas::PlatformInstance
			* RetVal = new cosi::commstruct::wiredbas::PlatformInstance("");
	RetVal->AddVertex(V) ;
	(*RetVal)[V].PRJ(Position)Set(pP);
	(*RetVal)[V].PRJ(Name)SetValue(ComponentName);
	(*RetVal)[V].PRJ(Type)SetValue(ComponentType);
	(*RetVal)[V].PRJ(Ports)Set(mPorts);
	return RetVal ;
}
cosi::commstruct::wiredbas::Implementation* ArcnetRouter::GetImplementationInstance(
		int V, Position pP, ThreadSet pThreads, TransferTable pT) {
	cosi::commstruct::wiredbas::Implementation
			* RetVal = new cosi::commstruct::wiredbas::Implementation("");
	RetVal->AddVertex(V) ;
	(*RetVal)[V].PRJ(Position)Set(pP);
	(*RetVal)[V].PRJ(ThreadSet)Set(pThreads);
	(*RetVal)[V].PRJ(TransferTable)Set(pT);
	(*RetVal)[V].PRJ(Name)SetValue(ComponentName);
	(*RetVal)[V].PRJ(Type)SetValue(ComponentType);
	(*RetVal)[V].PRJ(Ports)Set(mPorts);
	return RetVal ;
}

double ArcnetRouter::GetCost() {
	return mCostModel->GetValue(ComponentName, ComponentType, mPorts) ;
}

RealDelay
ArcnetRouter::GetDelay(Vertex NodeId,
				cosi::commstruct::wiredbas::Implementation* pI, Vertex Src,
				Vertex Dest){
	return RealDelay(0) ;
}
double
ArcnetRouter::GetDelayValue(Vertex NodeId,
				cosi::commstruct::wiredbas::Implementation* pI, Vertex Src,
				Vertex Dest){
	return 0 ;
}


}

}

}
