#include "Thread.h"

namespace cosi {

Thread::Thread() {
}

Thread::~Thread() {
}

Thread Thread::Get() {
	return (*this);
}

void Thread::Set(Thread pT) {
	(*this) = pT ;
	IsBot(false) ;
}

std::string Thread::GetThreadName() const {
	return mThreadName ;
}

void Thread::SetThreadName(std::string pName) {
	mThreadName = pName ;
	IsBot(false) ;
}

std::string Thread::GetDestinationThreadName() const {
	return mDestinationThreadName ;
}

void Thread::SetDestinationThreadName(std::string pName) {
	mDestinationThreadName = pName ;
	IsBot(false) ;
}

std::string Thread::GetDestinationNodeName()  const {
	return mDestinationNodeName ;
}

void Thread::SetDestinationNodeName(std::string pName) {
	mDestinationNodeName = pName ;
	IsBot(false) ;
}

int Thread::GetDestinationNodeId() const {
	return mDestId ;
}

void Thread::SetDestinationNodeId(int pId) {
	mDestId = pId ;
	IsBot(false) ;
}

double Thread::GetPeriod() const {
	return mPeriod ;
}

void Thread::SetPeriod(double pPeriod) {
	mPeriod = pPeriod ;
	IsBot(false) ;
}

int Thread::GetMessageLength() const {
	return mMsgLength ;
}

void Thread::SetMessageLength(int pMessageLength) {
	mMsgLength = pMessageLength ;
	IsBot(false) ;
}

Thread& Thread::operator=(const Thread& pT) {
	mThreadName = pT.GetThreadName();
	mDestinationNodeName = pT.GetDestinationNodeName();
	mDestId = pT.GetDestinationNodeId();
	mDestinationThreadName = pT.GetDestinationThreadName();
	mPeriod = pT.GetPeriod();
	mMsgLength = pT.GetMessageLength();
	IsBot(false) ;
	return *this ;
}

bool Thread::operator<(const Thread &pT) const {
	return (mThreadName < pT.GetThreadName());
}

bool Thread::operator==(const Thread &pT) const {
	return (mThreadName == pT.GetThreadName());
}

std::ostream& operator<<(std::ostream &pOs , const Thread &pT) {
	pOs << "Thread " << pT.mThreadName << std::endl ;
	pOs << "Destination Thread " << pT.mDestinationThreadName << " on node " << pT.mDestinationNodeName << " with id " << pT.mDestId << std::endl ;
 	pOs << "Period = " << pT.mPeriod << " s   Message = " << pT.mMsgLength << " bits" << std::endl ;
	return pOs ;
}

}
