/*
 * (c) 2005 Research Group Dr. Fuhrmann, University of Karlsruhe, Germany
 * All rights reserved.
 *
 * Author:
 *         Stefan Denk <denk@ira.uka.de>
 *         Kendy Kutzner <kutzner@ira.uka.de>
 *
 * $Id: aggr_dest.h,v 1.4 2006/01/05 10:31:45 denk Exp $
 *
 */

#ifndef _AGGR_DEST_H_
#define _AGGR_DEST_H_

#include "vtchannel.h"

/** One possible aggregation target.
 * For each aggregation target there will be a virtual tree inside the igor.
 * In the local plugin all information will be aggregated per aggregation target.
 */
class aggr_dest {
	private:
		/** Broadcasting time of that block.
		 * When the block we are talking about was broadcasted.
		 * Units of _minute is in seconds since the unix epoch.
		 * If it is not a full minute, rounding should (but currently doesn't) occur.
		 */
		time_t _minute;
		/** The originator of the block.
		 * The channel which sent the block.
		 */
		vtchannel _channel;
	public:
		/** Initialize a aggr_dest object.
		 * Guess what!
		 */
		aggr_dest() {_minute=0;};
		/// Construct it from a given time and cChannel object
		aggr_dest(time_t start, const cChannel *);
		/** Convert a aggr_dest object to a std::string.
		 * Currently uses the vdr-internal cChannel::Name() method.
		 * @return A new string is returned.
		 */
		string tostring() const;
		/** Removes a string representing a aggregation destination.
		 * Modifies the string.
		 * @param s A pointer to the string to be read. This string will be modified.
		 * @return bool true iff successful.
		 */
		bool fromstring(string *s);
		/// Compare two objects.
		bool operator<(const aggr_dest &other) const;
};


#endif // _AGGR_DEST_H_
