//============================================================================
// Name        : Node.h
// Author      : Alessandro Pinto <apinto@eecs.berkeley.edu>
//               University of California, Berkeley
//               545 Cory Hall, Berkeley, CA 94720
// Version     : $Id: Node.h,v 1.1 2007/12/13 03:25:27 apinto Exp $
// Copyright   : See COPYING file that comes with this distribution
// Description : Definition of a library node and interfaces.
//============================================================================


#ifndef NODE_H_
#define NODE_H_

#include <string>
#include <sstream>
#include <map>

using namespace std;

namespace cosi
{

/** The interface of a node is a multiset of availalbe port interfaces.
 *
 *
 *@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: Node.h,v 1.1 2007/12/13 03:25:27 apinto Exp $
 */

class Interface : public map<string,string> {
public:
	Interface( ) ;
	~Interface( ) ;
	/**\brief Adds a single port interface.*/
	void Add(string pName,string pType) ;
	/**\brief Adds a number of port interface.*/
	void Add(string pName , string pType , int pCount ) ;
	/**\brief Returns trie if the port interface is contained in the interface of the node.*/
	bool HasPortType( string pType ) ;
	bool HasPortName( string pName ) ;
private:
};


/** A node has an associated name, type and a set of interfaces.
 *
 *
 *@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: Node.h,v 1.1 2007/12/13 03:25:27 apinto Exp $
 */


class Node : public Interface
{
public:
	Node();
	virtual ~Node();
	/**\brief Sets the node name.*/
	void SetName( string pName ) ;
	/**\brief Returns the node name.*/
	string GetName( ) ;
	/**\brief Sets the node type.*/
	void SetType( string Type ) ;
	/**\brief Returns the node type.*/
	string GetType( ) ;

private:
	string mName ;
	string mType ;
};

}

#endif /*NODE_H_*/
