ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TTN::Buffer_t Class Reference

Reference to one of the halves provided by the DoubleBuffer_t. More...

#include <TargetBuffer_t.h>

Inheritance diagram for TTN::Buffer_t:
Collaboration diagram for TTN::Buffer_t:

Public Member Functions

 Buffer_t (std::vector< double > &buffer)
 
 Buffer_t (double *buffer, typename std::vector< double >::size_type max_idx, const std::vector< double > &full_vector)
 
double & operator[] (typename std::vector< double >::size_type idx)
 
double & upper_bound_at (typename std::vector< double >::size_type idx)
 
const double & operator[] (typename std::vector< double >::size_type idx) const
 
const double & upper_bound_at (typename std::vector< double >::size_type idx) const
 

Protected Member Functions

std::vector< double >::size_type optionalRangeCheck (typename std::vector< double >::size_type idx) const
 
std::vector< double >::size_type optionalRangeCheckUpperBound (typename std::vector< double >::size_type idx) const
 
void throwRangeError (typename std::vector< double >::size_type idx) const
 

Protected Attributes

double * m_ptr
 
std::vector< double >::size_type m_maxIndex
 
const double * m_bufferStart
 
const double * m_bufferEnd
 

Detailed Description

Reference to one of the halves provided by the DoubleBuffer_t.

This helper class provided read and write access. The base class of this helper class provides compile-time optional range checks.

Definition at line 124 of file TargetBuffer_t.h.

Constructor & Destructor Documentation

◆ Buffer_t() [1/2]

TTN::Buffer_t::Buffer_t ( std::vector< double > &  buffer)
inline

Definition at line 127 of file TargetBuffer_t.h.

127 : BufferBase_t<double,double, std::vector<double> >(buffer) {}

◆ Buffer_t() [2/2]

TTN::Buffer_t::Buffer_t ( double *  buffer,
typename std::vector< double >::size_type  max_idx,
const std::vector< double > &  full_vector 
)
inline

Definition at line 128 of file TargetBuffer_t.h.

129  : BufferBase_t<double,double,std::vector<double> >(buffer,max_idx,full_vector)
130  {}

Member Function Documentation

◆ operator[]() [1/2]

double& TTN::Buffer_t::operator[] ( typename std::vector< double >::size_type  idx)
inline

Definition at line 132 of file TargetBuffer_t.h.

132  {
133  return m_ptr[optionalRangeCheck(idx)];
134  }

◆ operator[]() [2/2]

const double & TTN::BufferBase_t< double , double , std::vector< double > >::operator[] ( typename std::vector< double >::size_type  idx) const
inlineinherited

Definition at line 79 of file TargetBuffer_t.h.

79  {
80  return m_ptr[optionalRangeCheck(idx)];
81  }

◆ optionalRangeCheck()

std::vector<double >::size_type TTN::BufferBase_t< double , double , std::vector< double > >::optionalRangeCheck ( typename std::vector< double >::size_type  idx) const
inlineprotectedinherited

Definition at line 98 of file TargetBuffer_t.h.

98  {
99  if (idx>=m_maxIndex || &(m_ptr[idx])<m_bufferStart || &(m_ptr[idx])>=m_bufferEnd) {
101  }
102  return idx;
103  }

◆ optionalRangeCheckUpperBound()

std::vector<double >::size_type TTN::BufferBase_t< double , double , std::vector< double > >::optionalRangeCheckUpperBound ( typename std::vector< double >::size_type  idx) const
inlineprotectedinherited

Definition at line 104 of file TargetBuffer_t.h.

104  {
105  // allow for idx==0
106  if (idx>0 && (idx-1>=m_maxIndex || &(m_ptr[idx-1])<m_bufferStart || &(m_ptr[idx-1])>=m_bufferEnd)) {
108  }
109  return idx;
110  }

◆ throwRangeError()

void TTN::BufferBase_t< double , double , std::vector< double > >::throwRangeError ( typename std::vector< double >::size_type  idx) const
protectedinherited

◆ upper_bound_at() [1/2]

double& TTN::Buffer_t::upper_bound_at ( typename std::vector< double >::size_type  idx)
inline

Definition at line 136 of file TargetBuffer_t.h.

136  {
138  }

◆ upper_bound_at() [2/2]

const double & TTN::BufferBase_t< double , double , std::vector< double > >::upper_bound_at ( typename std::vector< double >::size_type  idx) const
inlineinherited

Definition at line 83 of file TargetBuffer_t.h.

83  {
85  }

Member Data Documentation

◆ m_bufferEnd

const double * TTN::BufferBase_t< double , double , std::vector< double > >::m_bufferEnd
protectedinherited

Definition at line 115 of file TargetBuffer_t.h.

◆ m_bufferStart

const double * TTN::BufferBase_t< double , double , std::vector< double > >::m_bufferStart
protectedinherited

Definition at line 114 of file TargetBuffer_t.h.

◆ m_maxIndex

std::vector<double >::size_type TTN::BufferBase_t< double , double , std::vector< double > >::m_maxIndex
protectedinherited

Definition at line 113 of file TargetBuffer_t.h.

◆ m_ptr

double * TTN::BufferBase_t< double , double , std::vector< double > >::m_ptr
protectedinherited

Definition at line 88 of file TargetBuffer_t.h.


The documentation for this class was generated from the following file:
TTN::BufferBase_t< double, double, std::vector< double > >::optionalRangeCheck
std::vector< double >::size_type optionalRangeCheck(typename std::vector< double >::size_type idx) const
Definition: TargetBuffer_t.h:98
TTN::BufferBase_t< double, double, std::vector< double > >::m_bufferStart
const double * m_bufferStart
Definition: TargetBuffer_t.h:114
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
TTN::BufferBase_t< double, double, std::vector< double > >::m_ptr
double * m_ptr
Definition: TargetBuffer_t.h:88
TTN::BufferBase_t< double, double, std::vector< double > >::m_bufferEnd
const double * m_bufferEnd
Definition: TargetBuffer_t.h:115
TTN::BufferBase_t< double, double, std::vector< double > >::throwRangeError
void throwRangeError(typename std::vector< double >::size_type idx) const
TTN::BufferBase_t< double, double, std::vector< double > >::m_maxIndex
std::vector< double >::size_type m_maxIndex
Definition: TargetBuffer_t.h:113
TTN::BufferBase_t< double, double, std::vector< double > >::optionalRangeCheckUpperBound
std::vector< double >::size_type optionalRangeCheckUpperBound(typename std::vector< double >::size_type idx) const
Definition: TargetBuffer_t.h:104
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69