// __author__ = Juan Carlos De Abreu (jcabreur@gmail.com)

#ifndef DATA_TIME_H__
#define DATA_TIME_H__
 
#include "../DataTypes/Data.h"
#include "DataCallFunction.h"

BEGIN_TEG_NAMESPACE();

class DataTime : public IData {
public:
	// Attributes.
	clock_t last;
	clock_t begin;
	clock_t end;
	bool isRunning;			// is the clock running
	long interval;			// interval to do a task

	// Attributes
	SmartPointer<DataCallFunction> funcInterval;
	SmartPointer<DataCallFunction> funcEnd;

	// 
	DataTime(const std::vector<SmartPointer<IData> >& params);
	~DataTime();

	// Methods
	AUTO_SIZE();
	void print() { }
	SmartPointer<IData> resolve(std::map<std::string, SmartPointer<IData>>& variables) { return NULL; }

	// for the ".()" operator
	SmartPointer<IData> getMethod(SmartPointer<IData> elem, std::map<std::string, SmartPointer<IData>>& variables);

	void pause(void);
	void stop(void);
	void start(void);

protected:
	clock_t used;

};

END_TEG_NAMESPACE();

#endif  // DATA_TIME_H__
