#include "ArcnetController.h"

namespace cosi
{

namespace library
{

namespace wiredbas
{
std::string ArcnetController::ComponentName = "ArcnetController";
std::string ArcnetController::ComponentType = "Controller";

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

ArcnetController::~ArcnetController() {
}

cosi::commstruct::wiredbas::PlatformInstance* ArcnetController::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* ArcnetController::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 ArcnetController::GetCost() {
	return mCostModel->GetValue(ComponentName,ComponentType,mPorts) ;
}

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


}

}

}
