Jpp  18.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JTRIGGER::JFrame_t< JElement_t, JAllocator_t > Class Template Reference

Data frame with end marker. More...

#include <JFrame_t.hh>

Inheritance diagram for JTRIGGER::JFrame_t< JElement_t, JAllocator_t >:
std::vector< JElement_t, JAllocator_t > JTRIGGER::JHitToolkit< JElement_t > JTRIGGER::JFrame< JElement_t, JAllocator_t > JTRIGGER::JSuperFrame1D< JElement_t, JAllocator_t >

Public Member Functions

 JFrame_t ()
 Default constructor. More...
 
 JFrame_t (const JFrame_t &frame)
 Copy constructor. More...
 
 JFrame_t (JFrame_t &&frame)
 Move constructor. More...
 
JFrame_toperator= (const JFrame_t &frame)
 Assignment operator. More...
 
JFrame_toperator= (JFrame_t &&frame)
 Move assignment operator. More...
 
bool hasEndMarker () const
 Check presence of end marker. More...
 
void putEndMarker ()
 Append end marker to data. More...
 
void reset ()
 Reset. More...
 

Detailed Description

template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
class JTRIGGER::JFrame_t< JElement_t, JAllocator_t >

Data frame with end marker.

The end marker is a special element that is used in JTOOLS::JMergeSort to speed up the sorting of data.
It is placed within the capacity of the container whilst its size is maintained.
Here, it is defined by an element of which the time is larger than any possible nominal value.
The end marker should manually be put using method putEndMarker() after modifications of the contents of the container.

Definition at line 27 of file JFrame_t.hh.

Constructor & Destructor Documentation

template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::JFrame_t ( )
inline

Default constructor.

Empty container with end marker.

Definition at line 37 of file JFrame_t.hh.

38  {
39  this->putEndMarker();
40  }
void putEndMarker()
Append end marker to data.
Definition: JFrame_t.hh:111
template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::JFrame_t ( const JFrame_t< JElement_t, JAllocator_t > &  frame)
inline

Copy constructor.

Parameters
frameframe

Definition at line 48 of file JFrame_t.hh.

48  :
49  std::vector<JElement_t, JAllocator_t>(frame.begin(), frame.end())
50  {
51  this->putEndMarker();
52  }
void putEndMarker()
Append end marker to data.
Definition: JFrame_t.hh:111
template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::JFrame_t ( JFrame_t< JElement_t, JAllocator_t > &&  frame)
inline

Move constructor.

Parameters
frameframe

Definition at line 60 of file JFrame_t.hh.

61  {
62  this->swap(frame);
63  this->putEndMarker();
64  }
void putEndMarker()
Append end marker to data.
Definition: JFrame_t.hh:111

Member Function Documentation

template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
JFrame_t& JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::operator= ( const JFrame_t< JElement_t, JAllocator_t > &  frame)
inline

Assignment operator.

Parameters
frameframe
Returns
this frame

Definition at line 73 of file JFrame_t.hh.

74  {
75  this->assign(frame.begin(), frame.end());
76  this->putEndMarker();
77 
78  return *this;
79  }
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
void putEndMarker()
Append end marker to data.
Definition: JFrame_t.hh:111
template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
JFrame_t& JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::operator= ( JFrame_t< JElement_t, JAllocator_t > &&  frame)
inline

Move assignment operator.

Parameters
frameframe
Returns
this frame

Definition at line 88 of file JFrame_t.hh.

89  {
90  this->swap(frame);
91  this->putEndMarker();
92 
93  return *this;
94  }
void putEndMarker()
Append end marker to data.
Definition: JFrame_t.hh:111
template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
bool JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::hasEndMarker ( ) const
inline

Check presence of end marker.

Returns
true if end marker present; else false

Definition at line 102 of file JFrame_t.hh.

103  {
104  return (this->capacity() > this->size() && this->getT(*(this->end())) == this->getT(this->getEndMarker()));
105  }
template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
void JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::putEndMarker ( )
inline

Append end marker to data.

Definition at line 111 of file JFrame_t.hh.

112  {
113  if (this->capacity() <= this->size()) {
114  this->reserve(this->size() + 1);
115  }
116 
117  *(this->end()) = this->getEndMarker();
118  }
template<class JElement_t, class JAllocator_t = std::allocator<JElement_t>>
void JTRIGGER::JFrame_t< JElement_t, JAllocator_t >::reset ( )
inline

Reset.

Clear container and put end marker.

Definition at line 126 of file JFrame_t.hh.

127  {
128  this->clear();
129  this->putEndMarker();
130  }
void putEndMarker()
Append end marker to data.
Definition: JFrame_t.hh:111

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