ParamFlow.hh
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* ParamFlow.hh
*
* Created on: Jan 18, 2013
* Author: f.casimir
*/
#ifndef PARAMFLOW_HH_
#define PARAMFLOW_HH_
#include <boost/shared_ptr.hpp>
#include <CThreadDeque.hh>
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<PacketPtr> _packetList; /*!< List of Packet */
VirtualInstrumentInterval& _vi; /*!< Reference to the VirtualInstrumentInterval */
};
typedef boost::shared_ptr<ParamFlow> ParamFlowSPtr;
} /* namespace VI */
} /* namespace DDServerInterface */
} /* namespace AMDA */
#endif /* PARAMFLOW_HH_ */