/* * ParamFlow.hh * * Created on: Jan 18, 2013 * Author: f.casimir */ #ifndef PARAMFLOW_HH_ #define PARAMFLOW_HH_ #include #include namespace AMDA { namespace DDServerInterface { class VirtualInstrumentInterval; namespace VI { typedef class Packet* PacketPtr; /** * @class ParamFlow. * @brief Represent a flow of a couple time and data asked for one Parameter of a Virtual Instrument. * @details This flow is implement with a thread safe dequeue of Packet. * This class is a listener of the class VirtualInstrumentInterval. */ class ParamFlow { public: /** * @brief Constructor. */ ParamFlow(VirtualInstrumentInterval&); /** * @brief Constructor. */ virtual ~ParamFlow(); /** * @details Sometimes, when StartTime is smaller than GlobalStartTime VirtualInstrumentInterval recompute the TimeInt. * So this method returns VirtualInstrumentInterval::_timeInt. */ // const double& getTimeInt() const; /** * @brief This method waits for the arrival of a new pack. * @return Packet or null. */ PacketPtr get(); /** * @return the Packet already in the dequeue or null. */ PacketPtr tryGet() { return _packetList.tryToPop(nullptr); } /** * @brief Push Packet to the internal dequeue. */ void push(PacketPtr pPacket) { return _packetList.push(pPacket); } /** * @brief Identify at any time if a TimeInterval is not processed. * @note This value must be retrieved from VirtualInstrumentInterval instance. */ bool isTimeIntToProcessChanged (); /** * @brief true when therer is no more time intervals to process. */ bool isNoMoreTimeInt(); private: CThreadDeque _packetList; /*!< List of Packet */ VirtualInstrumentInterval& _vi; /*!< Reference to the VirtualInstrumentInterval */ }; typedef boost::shared_ptr ParamFlowSPtr; } /* namespace VI */ } /* namespace DDServerInterface */ } /* namespace AMDA */ #endif /* PARAMFLOW_HH_ */