Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JFrame_t.hh
Go to the documentation of this file.
1#ifndef __JTRIGGER__JFRAME_T__
2#define __JTRIGGER__JFRAME_T__
3
4#include <vector>
5
7
8
9/**
10 * \author mdejong
11 */
12
13namespace JTRIGGER {}
14namespace JPP { using namespace JTRIGGER; }
15
16namespace JTRIGGER {
17
18 /**
19 * Data frame with end marker.
20 *
21 * The end marker is a special element that is used in JTOOLS::JMergeSort to speed up the sorting of data.\n
22 * It is placed within the capacity of the container whilst its size is maintained.\n
23 * Here, it is defined by an element of which the time is larger than any possible nominal value.\n
24 * The end marker should manually be put using method putEndMarker() after modifications of the contents of the container.
25 */
26 template<class JElement_t, class JAllocator_t = std::allocator<JElement_t> >
27 class JFrame_t :
28 public std::vector<JElement_t, JAllocator_t>,
29 public JHitToolkit<JElement_t>
30 {
31 public:
32 /**
33 * Default constructor.
34 *
35 * Empty container with end marker.
36 */
38 {
39 this->putEndMarker();
40 }
41
42
43 /**
44 * Copy constructor.
45 *
46 * \param frame frame
47 */
48 JFrame_t(const JFrame_t& frame) :
49 std::vector<JElement_t, JAllocator_t>(frame.begin(), frame.end())
50 {
51 this->putEndMarker();
52 }
53
54
55 /**
56 * Move constructor.
57 *
58 * \param frame frame
59 */
61 {
62 this->swap(frame);
63 this->putEndMarker();
64 }
65
66
67 /**
68 * Assignment operator.
69 *
70 * \param frame frame
71 * \return this frame
72 */
74 {
75 this->assign(frame.begin(), frame.end());
76 this->putEndMarker();
77
78 return *this;
79 }
80
81
82 /**
83 * Move assignment operator.
84 *
85 * \param frame frame
86 * \return this frame
87 */
89 {
90 this->swap(frame);
91 this->putEndMarker();
92
93 return *this;
94 }
95
96
97 /**
98 * Check presence of end marker.
99 *
100 * \return true if end marker present; else false
101 */
102 bool hasEndMarker() const
103 {
104 return (this->capacity() > this->size() && this->getT(*(this->end())) == this->getT(this->getEndMarker()));
105 }
106
107
108 /**
109 * Append end marker to data.
110 */
112 {
113 if (this->capacity() <= this->size()) {
114 this->reserve(this->size() + 1);
115 }
116
117 *(this->end()) = this->getEndMarker();
118 }
119
120
121 /**
122 * Reset.
123 *
124 * Clear container and put end marker.
125 */
126 void reset()
127 {
128 this->clear();
129 this->putEndMarker();
130 }
131 };
132}
133
134#endif
Tools for handling different hit types.
Data frame with end marker.
Definition JFrame_t.hh:30
JFrame_t & operator=(const JFrame_t &frame)
Assignment operator.
Definition JFrame_t.hh:73
JFrame_t(const JFrame_t &frame)
Copy constructor.
Definition JFrame_t.hh:48
JFrame_t(JFrame_t &&frame)
Move constructor.
Definition JFrame_t.hh:60
void reset()
Reset.
Definition JFrame_t.hh:126
bool hasEndMarker() const
Check presence of end marker.
Definition JFrame_t.hh:102
JFrame_t()
Default constructor.
Definition JFrame_t.hh:37
void putEndMarker()
Append end marker to data.
Definition JFrame_t.hh:111
JFrame_t & operator=(JFrame_t &&frame)
Move assignment operator.
Definition JFrame_t.hh:88
JAssignSequence< typename JContainer_t::value_type > assign(JContainer_t &out)
Helper method to assign sequence of Comma Separated Values to output container.
Definition JCSV.hh:129
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.
Template definition of hit toolkit.