//============================================================================
// Name        : Thread.h
// Author      : Alessandro Pinto <apinto@eecs.berkeley.edu>
//               University of California, Berkeley
//               545 Cory Hall, Berkeley, CA 94720
// Version     : $Id: Thread.h,v 1.3 2008/01/13 21:12:45 apinto Exp $
// Copyright   : See COPYING file that comes with this distribution
// Description : Declaration of a basis quantities.
//============================================================================

#ifndef THREAD_H_
#define THREAD_H_

#include <iostream>
#include <string>
#include "core/Quantity.h"

namespace cosi {

/** This class represents a thread. A thread has a name, the name of the destination node,
 * the name of the destination thread,
 * the period of the messages that the thread generates and their length in bit.
 *
 *
 *@author Alessandro Pinto,
 *@author The Donald O. Pederson Center for Electronic System Design
 *@author Electrical Engineering Department
 *@author University of California, Berkeley
 *@author 545P Cory Hall, Berkeley, CA 94720
 *@author +1 (510) 642 9670
 *@author http://www.eecs.berkeley.edu/~apinto
 *
 *@version $Id: Thread.h,v 1.3 2008/01/13 21:12:45 apinto Exp $
 */

class Thread : public cosi::Quantity {
	/**\brief Thread name.*/
	std::string mThreadName;
	/**\brief Name of the destination node.*/
	std::string mDestinationNodeName;
	/**\brief Id of the destination node.*/
	int mDestId;
	/**\brief Destination thread name.*/
	std::string mDestinationThreadName;
	/**\brief Message period in seconds.*/
	double mPeriod;
	/**\brief Message length in bits.*/
	int mMsgLength;
public:
	/**\brief Default constructor.*/
	Thread();
	/**\brief Default destructor.*/
	~Thread();

	/**\brief Returns this thread.*/
	Thread Get();

	/**\brief Sets this thread*/
	void Set(Thread pT);

	/**\brief Sets the name of this thread.*/
	std::string GetThreadName() const;

	/**\brief Gets the name of this thread.*/
	void SetThreadName(std::string pName);

	/**\brief Sets the name of the destination thread.*/
	std::string GetDestinationThreadName() const ;

	/**\brief Gets the name of the destination thread.*/
	void SetDestinationThreadName(std::string pName);

	/**\brief Sets the name of the destination node.*/
	std::string GetDestinationNodeName() const ;

	/**\brief Gets the name of the destination node.*/
	void SetDestinationNodeName(std::string pName);

	/**\brief Sets the Id of the destination node.*/
	int GetDestinationNodeId() const;

	/**\brief Gets the id of the destination node.*/
	void SetDestinationNodeId(int pId);

	/**\brief Gets the message period generated by the thread.*/
	double GetPeriod() const;

	/**\brief Sets the message period generated by the thread.*/
	void SetPeriod(double pPeriod);

	/**\brief Gets the length of the messages.*/
	int GetMessageLength() const;

	/**\brief Sets the length of the messages.*/
	void SetMessageLength(int pMessageLength);

	Thread& operator=(const Thread& pT) ;

	bool operator<(const Thread &pT) const;

	bool operator==(const Thread &pT) const;

	friend std::ostream& operator<<(std::ostream &pOs , const Thread &pT) ;

};

}

#endif /*THREAD_H_*/
