/*******************************************************************************
*                                                                              *
* Société de Transports de Montréal.                                    	   *
* 2012                                                                         *
*                                                                              *
* Projet Zones Tests                                                           *
*                                                                              *
*                                                                              *
*                                                                              *
*******************************************************************************/
/*
	Description:
	Description du fichier si nécessaire.
	
*/

/* ************************************************************************** */
/* Revision:
### 20130603 JFM
	Verision d'origine.
	
### YYYYMMDD Description du besoin ou du bug
	Description du changement.
 */

/* ************************************************************************** */

#ifndef CDV_H
#define CDV_H

#include "GlobalDefine.h"
#include "CDVItem.h"
#include "ZTData.h"

class CCDV
{
public:
	CCDV();
	CCDV(unsigned int CDVITIMask, unsigned int CDVInputMask, unsigned int CDVType, QString CDVLabel, unsigned int CDVWay, unsigned int CDVGraphicalPosition);
    virtual ~CCDV();

	unsigned int SetInputMask(unsigned int Mask);
	unsigned int SetLabel(QString Label);
	void SetITIMask(unsigned int Mask){mCDVITIMask = Mask;}
	virtual unsigned int ComputeCDVState(unsigned int InputsBuf,unsigned int ZT1ItiMask, unsigned int ZT2ItiMask);
	unsigned int GetCDVType(){return mCDVType;}

	bool IsOccupied(){return mIsOccupied;}
	bool IsITICommanded(){return mIsItiCommanded;}
	unsigned int GetCDVState(){return mCDVState;}
	QString GetLabel(){return mCDVLabel;}
	unsigned int GetInputMask(){return mCDVInputMask;}
	void SetCDVWay(unsigned int Way){mCDVWay = Way;}
	unsigned int GetCDVWay(){return mCDVWay;}
	void SetCDVGraphicalPos(unsigned int Pos){mCDVGraphicalPosition = Pos;}
	unsigned int GetCDVGraphicalPos(){return mCDVGraphicalPosition;}
    void SetCDVDeck(bool IsDeck);
    bool IsCDVDeck(){return mCDVIsDeck;}

//	virtual void SetNormalItiMask(unsigned int Mask){qDebug("Error: Trying to set normal itinerary to an non-switch CDV");}
//	virtual void SetReverseItiMask(unsigned int Mask){qDebug("Error: Trying to set reverse itinerary to an non-switch CDV");}
//	virtual void SetLane(unsigned int Lane){qDebug("Error: Trying to set lane to an non-switch CDV");}


protected:
    unsigned int mCDVITIMask;       //Masque d'entrée de l'itinéraire dont fait partie ce CDV
    unsigned int mCDVInputMask;     //Masque d'entrée de l'état d'occupation du CDV
    unsigned int mCDVType;          //Type de CDV, soit normal ou aiguillage (SWITCH)
    QString mCDVLabel;              //Texte qui identifie le CDV
    unsigned int mCDVWay;           //La voie dans laquelle est présente le CDV (Voie 1 ou voie 2).
    unsigned int mCDVGraphicalPosition; //Position graphique du CDV à l'écran
    bool mCDVIsDeck;                //Flag indiquant si le CDV est vis-à-vis le quai

	//CDV State
    bool mIsOccupied;           //État d'occupation du CDV
    bool mIsItiCommanded;       //Flag indiquant si l'itinéraire dont fait partie le CDV est commandé
    unsigned int mCDVState;     //État global du CDV (libre - occupé - itinéraire commandé)

};

#endif // CDV_H
