Packet.hh 1.37 KB
/*
 * Packet.hh
 *
 *  Created on: Jan 17, 2013
 *      Author: f.casimir
 */

#ifndef PACKET_HH_
#define PACKET_HH_

#include <boost/shared_ptr.hpp>

#include "DD.hh"

namespace AMDA {
	namespace DDServerInterface {
		namespace VI {
			/**
			 * @class Packet
			 * @brief Container of one bloc of time and one block of data get from DDServer.
			 * @details When a call to GetData is done the the data retrieved are shared between listener.
			 * For this we use pointers boost::shared_ptr.
			 */
			class Packet {
			public:
				typedef boost::shared_ptr<DD_data_t>  DDDataSPtr;
				Packet() : time(), data(), nodata(true), startTime(0), stopTime(0) {}
				/**
				 * @brief Constructor.
				 */
				Packet(Packet::DDDataSPtr pTime,Packet::DDDataSPtr pData) : time(pTime), data(pData), nodata(false), startTime(0), stopTime(0) {}
				/**
				 * @brief Copy constructor.
				 */
				Packet(const Packet& pPacket) : time(pPacket.time), data(pPacket.data), nodata(false), startTime(0), stopTime(0) {}
				/**
				 * @brief Destructor.
				 */
				virtual ~Packet() {}

				DDDataSPtr time; /*!< Shared pointer on one block data of time */
				DDDataSPtr data; /*!< Shared pointer on one block data of an unknown data type */
				bool nodata;
				double startTime;
				double stopTime;
			};

		} /* namespace VI */
	} /* namespace DDServerInterface */
} /* namespace AMDA */
#endif /* PACKET_HH_ */