TimeInterval.hh 1.98 KB
/*
 * TimeInterval.h
 *
 *  Created on: 5 août 2013
 *      Author: CS
 */

#ifndef TIMEINTERVAL_H_
#define TIMEINTERVAL_H_

#include <string>
#include <vector>
#include <map>

namespace TimeTableCatalog {

/**
 * Time Table interval.
 */
class TimeInterval {
public:

	TimeInterval(double pstartTime, double pstopTime, int pindex = 0, std::string pttPath = "", std::string pttName = "", int pttTotalIntervals = 0);

	virtual ~TimeInterval();
	TimeInterval(const TimeInterval& pCopy);

	friend bool operator <(const TimeInterval& lhs, const TimeInterval& rhs) {
		return (lhs._startTime < rhs._startTime? true : false);
	}

	friend bool operator ==(const TimeInterval& lhs, const TimeInterval& rhs) {
		return (lhs._startTime == rhs._startTime && lhs._stopTime == rhs._stopTime ? true : false);
	}

	friend std::ostream& operator <<(std::ostream& os, const TimeInterval& interval);

	/**
	 * Adds a parameter data to the interval
	 */
	void addParameterData (const std::string &paramKey, const std::vector<std::string> &paramValues);

	/**
	 * Retrieve value associated with a parameter key
	 */
	std::vector<std::string> & getParameterData (const std::string &paramKey);

	std::map<std::string, std::vector<std::string>> getAllParameterData() const;

	/**
	 * Retrievenumber of parameter data associated with the interval
	 */
	int getParameterDataCount ();

	/**
	 * Interval start time
	 */
	double _startTime;

	/**
	 * Interval stop time
	 */
	double _stopTime;

	/**
	 * Interval index - Set only during the load of a TT to retrieve original index
	 */
	int _index;

	/**
	 * Interval TT origin path
	 */
	std::string _ttPath;

	/**
	 * Interval TT origin name
	 */
	std::string _ttName;

	/**
	 * Nb intervals in TT origin
	 */
	int _ttTotalIntervals;

private :
	/**
	 * Additional parameters data, these data must be described in the catalog
	 * they are not used in time tables
	 */
	std::map<std::string, std::vector<std::string>> _parametersData;

};

} /* namespace TimeTableCatalog */
#endif /* TIMEINTERVAL_H_ */