#ifndef _TRACKED_CORNERS_H_
#define _TRACKED_CORNERS_H_
#include <iostream>

class TrackedCorners
{
public:
	TrackedCorners( int maxPoints );
	~TrackedCorners();

	inline int getMaxPoints() const { return _maxPoints; }

	inline int getNumPoints() const { return _numPoints; }
	inline void setNumPoints( int count ) { _numPoints = count; }

	inline int* getPoints() const { return _points; }

	inline int* getPoint( int i ) const { return &_points[2*i]; }
	inline void setPoint( int i, int x, int y ) { _points[2*i] = x; _points[2*i+1] = y; }

	inline bool isPointValid( int i ) { return _validPoints[i]; }
	inline void setPointValid( int i, bool valid ) { _validPoints[i] = valid; }

	inline bool isEmpty() const { return _numPoints == 0; }
	inline void clear() { _numPoints = 0; }

	inline int getTrustyRate( int i ) { return _trustyRate[i]; }

	inline void setTrustyRate( int i, float val ) 
	{
		if( _trustyRate[i] < 0.0f ) 
		{
			_trustyRate[i] = 0.0f;
		}
		else if ( _trustyRate[i] > 1.0f )
		{
			_trustyRate[i] = 1.0f;
		}
		else
			_trustyRate[i] = val; 
	}

	inline void resetTrustyRate()
	{
		std::fill( _trustyRate, _trustyRate + _maxPoints, 1.0f );
	}

	inline void resetValidState()
	{
		std::fill( _validPoints, _validPoints + _maxPoints , true );
	}
	
private:
	int _maxPoints;
	int _numPoints;

	int*  _points;
	bool*  _validPoints;
	float* _trustyRate; 
};


#endif