Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
Timestamp< T > Class Template Reference

Auxiliary class to remove bit-flipped ARS data. More...

#include <Timestamp.hh>

Inheritance diagram for Timestamp< T >:
std::pair< T, T >

Public Types

typedef T const_iterator
 

Public Member Functions

 Timestamp (T __begin, T __end)
 Constructor.
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
bool empty () const
 

Detailed Description

template<class T>
class Timestamp< T >

Auxiliary class to remove bit-flipped ARS data.

The input data are reshuffeld such that the pair container contains:

  • begin of correct output data
  • end of correct output data

This class provides for the usual STL interface methods.

Definition at line 18 of file Timestamp.hh.

Member Typedef Documentation

◆ const_iterator

template<class T >
T Timestamp< T >::const_iterator

Definition at line 22 of file Timestamp.hh.

Constructor & Destructor Documentation

◆ Timestamp()

template<class T >
Timestamp< T >::Timestamp ( T __begin,
T __end )
inline

Constructor.

Parameters
__beginbegin of input data
__endend of input data

Definition at line 31 of file Timestamp.hh.

31 :
32 std::pair<T,T>(__begin, __end)
33 {
34 if (__begin != __end) {
35
36 const_iterator p0 = __begin;
37 const_iterator p1 = p0;
38
39 ++p1;
40
41 /*
42 * assure following start conditions
43 *
44 * 1. p0 /= 0
45 * 2. p1 > p0
46 */
47 while (p1 != __end && (p0->timestamp == 0 || p1->timestamp < p0->timestamp)) {
48 ++p0;
49 ++p1;
50 }
51
52 if (p1 != __end) {
53
54 this->first = p0;
55 /*
56 * assume following start conditions
57 *
58 * 1. p0 /= 0
59 * 2. p1 > p0
60 */
61 for (const_iterator p2 = p1; ++p2 != __end; ) {
62
63
64 if (p2->timestamp > p1->timestamp) {
65 /*
66 * p2
67 * /
68 * p1
69 * /
70 * p0
71 */
72 *(++p0) = *p1;
73 *(++p1) = *p2;
74
75 } else {
76
77 if (p2->timestamp < p0->timestamp) {
78 /*
79 * p1
80 * / \
81 * / \
82 * p0 \
83 * p2
84 *
85 */
86 } else {
87 /*
88 * p1
89 * / \
90 * / p2
91 * /
92 * p0
93 */
94 *p1 = *p2;
95 }
96 }
97 }
98
99 this->second = ++p1;
100
101 } else {
102
103 this->first = p0;
104 this->second = p1;
105 }
106 }
107 }
TPaveText * p1
T const_iterator
Definition Timestamp.hh:22

Member Function Documentation

◆ begin()

template<class T >
const_iterator Timestamp< T >::begin ( ) const
inline

Definition at line 109 of file Timestamp.hh.

109{ return this->first; }

◆ end()

template<class T >
const_iterator Timestamp< T >::end ( ) const
inline

Definition at line 110 of file Timestamp.hh.

110{ return this->second; }

◆ size()

template<class T >
size_t Timestamp< T >::size ( ) const
inline

Definition at line 112 of file Timestamp.hh.

112{ return std::distance(this->begin(), this->end()); }
const_iterator end() const
Definition Timestamp.hh:110
const_iterator begin() const
Definition Timestamp.hh:109

◆ empty()

template<class T >
bool Timestamp< T >::empty ( ) const
inline

Definition at line 113 of file Timestamp.hh.

113{ return this->begin() == this->end(); }

The documentation for this class was generated from the following file: