ATLAS Offline Software
Loading...
Searching...
No Matches
PhaseII::DataRange Struct Reference

Type describing a range of elements living in a one of N containers. More...

#include <PhaseIIInDetRawDataContainer.h>

Collaboration diagram for PhaseII::DataRange:

Public Types

using RangeBeginIndex_t = std::uint32_t
using RangeSize_t = std::uint16_t
using ContainerIndex_t = std::uint16_t

Public Member Functions

 DataRange ()
 DataRange (std::uint64_t compact_range)
 DataRange (unsigned int begin_val, unsigned int n, unsigned int idx)
 DataRange (std::uint32_t begin_val, std::uint16_t n, std::uint16_t idx)
std::uint64_t makeCompact () const
void setSize (RangeSize_t new_size)
std::uint16_t containerIndex () const
unsigned int beginIndex () const
unsigned int endIndex () const
std::uint16_t size () const
bool empty () const

Static Public Member Functions

template<typename T_ElementIndex, typename T_ContainerIndex>
static DataRange makeDataRange (T_ElementIndex begin_index, T_ElementIndex end_index, T_ContainerIndex container_index)

Public Attributes

union { 
   struct Range
      RangeBeginIndex_t   m_beginIndex {} 
 the index of the first element in the range in the container defined by the container index More...
      RangeSize_t   m_n {} 
 the number of elements in this range. More...
      ContainerIndex_t   m_containerIndex {} 
 the index which identifies the the container within a container collection More...
   }   m_range
   std::uint64_t   m_compactRange 
m_payload

Detailed Description

Type describing a range of elements living in a one of N containers.

The types of the index of the first element, number of elements, and container index are chosen such that the resulting struct does not exceed 64 bits to allow for an atomic update of a range. @TODO make members private ?

Definition at line 38 of file PhaseIIInDetRawDataContainer.h.

Member Typedef Documentation

◆ ContainerIndex_t

using PhaseII::DataRange::ContainerIndex_t = std::uint16_t

Definition at line 41 of file PhaseIIInDetRawDataContainer.h.

◆ RangeBeginIndex_t

Definition at line 39 of file PhaseIIInDetRawDataContainer.h.

◆ RangeSize_t

using PhaseII::DataRange::RangeSize_t = std::uint16_t

Definition at line 40 of file PhaseIIInDetRawDataContainer.h.

Constructor & Destructor Documentation

◆ DataRange() [1/4]

PhaseII::DataRange::DataRange ( )
inline

Definition at line 53 of file PhaseIIInDetRawDataContainer.h.

53: m_payload{.m_compactRange = std::uint64_t{} }{}
union PhaseII::DataRange::@115366361000146103022305316242135000036157260104 m_payload

◆ DataRange() [2/4]

PhaseII::DataRange::DataRange ( std::uint64_t compact_range)
inline

Definition at line 54 of file PhaseIIInDetRawDataContainer.h.

54: m_payload{.m_compactRange = compact_range }{}

◆ DataRange() [3/4]

PhaseII::DataRange::DataRange ( unsigned int begin_val,
unsigned int n,
unsigned int idx )
inline

Definition at line 55 of file PhaseIIInDetRawDataContainer.h.

56 : m_payload{ .m_range = {static_cast<std::uint32_t>(begin_val), static_cast<std::uint16_t>(n), static_cast<std::uint16_t>(idx)} }
57 {
58 assert(begin_val<std::numeric_limits<std::uint32_t>::max());
59 assert(n<std::numeric_limits<std::uint16_t>::max());
60 assert(idx<std::numeric_limits<std::uint16_t>::max());
61 }

◆ DataRange() [4/4]

PhaseII::DataRange::DataRange ( std::uint32_t begin_val,
std::uint16_t n,
std::uint16_t idx )
inline

Definition at line 62 of file PhaseIIInDetRawDataContainer.h.

63 : m_payload{ .m_range= {begin_val, n, idx} }
64 {
65 }

Member Function Documentation

◆ beginIndex()

unsigned int PhaseII::DataRange::beginIndex ( ) const
inline

Definition at line 73 of file PhaseIIInDetRawDataContainer.h.

73{ return m_payload.m_range.m_beginIndex;}

◆ containerIndex()

std::uint16_t PhaseII::DataRange::containerIndex ( ) const
inline

Definition at line 72 of file PhaseIIInDetRawDataContainer.h.

72{ return m_payload.m_range.m_containerIndex; }

◆ empty()

bool PhaseII::DataRange::empty ( ) const
inline

Definition at line 76 of file PhaseIIInDetRawDataContainer.h.

76{ return m_payload.m_range.m_n==0u; }
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ endIndex()

unsigned int PhaseII::DataRange::endIndex ( ) const
inline

Definition at line 74 of file PhaseIIInDetRawDataContainer.h.

74{ return m_payload.m_range.m_beginIndex + m_payload.m_range.m_n; }

◆ makeCompact()

std::uint64_t PhaseII::DataRange::makeCompact ( ) const
inline

Definition at line 66 of file PhaseIIInDetRawDataContainer.h.

66 {
67 static_assert( sizeof(m_payload.m_range) == sizeof(std::uint64_t));
68 return m_payload.m_compactRange;
69 }

◆ makeDataRange()

template<typename T_ElementIndex, typename T_ContainerIndex>
DataRange PhaseII::DataRange::makeDataRange ( T_ElementIndex begin_index,
T_ElementIndex end_index,
T_ContainerIndex container_index )
inlinestatic

Definition at line 78 of file PhaseIIInDetRawDataContainer.h.

80 {
81 // ensure that the inputs are within the allowed range in (debug build only!)
82 // @TODO check some of these always during runtime ?
83 // Replace this convenience method into a constructor ? But an exception could be thrown here.
84 assert( end_index >= begin_index ) ;
85 assert( static_cast<std::uint32_t>(begin_index) == begin_index);
86 assert( static_cast<std::size_t>(end_index - begin_index) < std::numeric_limits<std::uint16_t>::max());
87 assert( static_cast<std::uint16_t>(container_index) == container_index);
88 return DataRange(static_cast<std::uint32_t>(begin_index),
89 static_cast<std::uint16_t>(end_index - begin_index),
90 static_cast<std::uint16_t>(container_index));
91 }

◆ setSize()

void PhaseII::DataRange::setSize ( RangeSize_t new_size)
inline

Definition at line 71 of file PhaseIIInDetRawDataContainer.h.

71{ m_payload.m_range.m_n=new_size; }

◆ size()

std::uint16_t PhaseII::DataRange::size ( ) const
inline

Definition at line 75 of file PhaseIIInDetRawDataContainer.h.

75{ return m_payload.m_range.m_n; }

Member Data Documentation

◆ m_beginIndex

RangeBeginIndex_t PhaseII::DataRange::m_beginIndex {}

the index of the first element in the range in the container defined by the container index

Definition at line 46 of file PhaseIIInDetRawDataContainer.h.

46{};

◆ m_compactRange

std::uint64_t PhaseII::DataRange::m_compactRange

Definition at line 50 of file PhaseIIInDetRawDataContainer.h.

◆ m_containerIndex

ContainerIndex_t PhaseII::DataRange::m_containerIndex {}

the index which identifies the the container within a container collection

Definition at line 48 of file PhaseIIInDetRawDataContainer.h.

48{};

◆ m_n

RangeSize_t PhaseII::DataRange::m_n {}

the number of elements in this range.

Definition at line 47 of file PhaseIIInDetRawDataContainer.h.

47{};

◆ [union]

union { ... } PhaseII::DataRange::m_payload

◆ [struct]

struct { ... } ::Range PhaseII::DataRange::m_range

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