-
Notifications
You must be signed in to change notification settings - Fork 1
/
Sequence.cc
61 lines (51 loc) · 1.63 KB
/
Sequence.cc
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
#include "pdsdata/xtc/Sequence.hh"
namespace Pds {
enum {v_cntrl = 0, k_cntrl = 8};
enum {v_service = 0, k_service = 4};
enum {v_seqtype = 4, k_seqtype = 2};
enum {v_extend = 7, k_extend = 1};
enum {m_cntrl = ((1 << k_cntrl) -1), s_cntrl = (m_cntrl << v_cntrl)};
enum {m_service = ((1 << k_service)-1), s_service = (m_service << v_service)};
enum {m_seqtype = ((1 << k_seqtype)-1), s_seqtype = (m_seqtype << v_seqtype)};
enum {m_extend = ((1 << k_extend )-1), s_extend = (m_extend << v_extend)};
}
Pds::Sequence::Sequence(const Pds::Sequence& input) :
_clock(input._clock),
_stamp(input._stamp)
{}
Pds::Sequence::Sequence(const ClockTime& clock, const TimeStamp& stamp) :
_clock(clock),
_stamp(stamp)
{}
Pds::Sequence::Sequence(Type type,
TransitionId::Value service,
const ClockTime& clock,
const TimeStamp& stamp) :
_clock(clock),
_stamp(stamp,
((type & m_seqtype) << v_seqtype) |
((service & m_service) << v_service))
{}
Pds::Sequence::Type Pds::Sequence::type() const
{
return Type((_stamp.control() >> v_seqtype) & m_seqtype);
}
Pds::TransitionId::Value Pds::Sequence::service() const
{
return TransitionId::Value((_stamp.control() >> v_service) & m_service);
}
bool Pds::Sequence::isExtended() const
{
return _stamp.control() & s_extend;
}
bool Pds::Sequence::isEvent() const
{
return ((_stamp.control() & s_service) >> v_service) ==
TransitionId::L1Accept;
}
Pds::Sequence& Pds::Sequence::operator=(const Pds::Sequence& input)
{
_clock = input._clock;
_stamp = input._stamp;
return *this;
}