/* 
 * File:   circuit.h
 * Author: macino
 *
 * Created on �tvrtok, 2008, november 13, 16:22
 */
#ifndef _CIRCUIT_H
#define	_CIRCUIT_H

#include <iostream>
#include <vector>

//abstract object classes 
#include "Input.h"
#include "Output.h"
#include "Rule.h"

//positioned real object classes
#include "Piece.h"
#include "Node.h"
#include "Connection.h"

//vnutorna reprezentacia obvodu
class Circuit{
	//mnozina vstupov 
    vector<Input*> *inputs;
	//mnozina vystupov
    vector<Output*> *outputs;
	//mnozina vsetkych pravidiel popisanych v bench subore
    vector<Rule*> *rules;
	//mnozina prvkov
    vector<Piece*> *pieces;

public:
    Circuit();
    ~Circuit();
    
    void addInput(Input* input);
    void addOutput(Output* output);
    void addRule(Rule* rule);
    void addPiece(Piece* piece);
    
    vector<Input*>* getInputs();
    vector<Output*>* getOutputs();
    vector<Rule*>* getRules();
    vector<Piece*>* getPieces();
	vector<Node*> nodes;
	vector<Connection> connections;
    
    bool isRuleIncluded(string name);
    bool isInputIncluded(string name);
    bool isOutputIncluded(string name);
    bool isPieceIncluded(string name);
    
    //Prepis zobrazenia pi^-1
    Piece* getPiece(string ruleName);
    Piece* getPiece(Rule* rule);

	Connection* getConnection(string name);
	int iOfNode(Node *n);

	//Testovanie prekazok pri routovani cesty
	bool isTherePiece(Point* p, Node *eNode);
	//Zisti, ci sa na danom bode nachadza spoj
	//nebude sa prihliadat na spoj, ktory je uvedeny v withoutCnnt
	bool isThereConnection(int x, int y, string withoutCnnt);
	//zisti, ci sa dva body nachadzaju na rovnakej ceste
	bool arePntsOnTheSamePath(Point *pPath1, Point *pPath2);
	int numOfPaths(Point p1, Point p2);
    string toString();
};

#endif	/* _CIRCUIT_H */

