Interface Documentation
Version: invalid
Public Member Functions | Static Public Attributes | List of all members
flecsi::util::offset< COUNT_BITS > Class Template Reference

offset represents an offset range (a start index plus a count of elements) in a single uint64_t. The lower COUNT_BITS bits are used for the count and the remaining bits are used for the start index. More...

#include <offset.hh>

Public Member Functions

 offset (uint64_t start, uint32_t count)
 Construct a new offset range from a start index and a count. More...
 
 offset (const offset &prev, uint32_t count)
 Construct a new offset range from a previous offset range and a count. The start index of this offset range is the end index of the previous offset. More...
 
uint64_t start () const
 Get the start index of the offset range. More...
 
uint32_t count () const
 Get the count (number) of elements represented by this offset range. More...
 
uint64_t end () const
 Get the index pointing one element past the final element represented by this offset range. More...
 
void set_count (uint32_t count)
 Set the count of this offset range. More...
 
void set_offset (uint64_t start)
 Set the start index of this offset range. More...
 
std::pair< size_t, size_t > range () const
 Get the range (start index to end index, inclusive) represented by this offset range. More...
 

Static Public Attributes

static constexpr uint32_t count_mask = (1ul << COUNT_BITS) - 1
 Bitmask used to get the count bits, this is also the maximum value for the count value. More...
 
static constexpr uint64_t start_max = (1ul << (64 - COUNT_BITS)) - 1
 The maximum value of the start index value.
 

Detailed Description

template<size_t COUNT_BITS>
class flecsi::util::offset< COUNT_BITS >

offset represents an offset range (a start index plus a count of elements) in a single uint64_t. The lower COUNT_BITS bits are used for the count and the remaining bits are used for the start index.

Template Parameters
COUNT_BITSNumber of bits used for the count

Constructor & Destructor Documentation

◆ offset() [1/2]

template<size_t COUNT_BITS>
flecsi::util::offset< COUNT_BITS >::offset ( uint64_t  start,
uint32_t  count 
)
inline

Construct a new offset range from a start index and a count.

Parameters
startStart index of the offset range
countThe count (number) of elements

◆ offset() [2/2]

template<size_t COUNT_BITS>
flecsi::util::offset< COUNT_BITS >::offset ( const offset< COUNT_BITS > &  prev,
uint32_t  count 
)
inline

Construct a new offset range from a previous offset range and a count. The start index of this offset range is the end index of the previous offset.

Parameters
prevPrevious offset range, this offset starts immediately after the previous offset range.
countThe count (number) of elements

Member Function Documentation

◆ count()

template<size_t COUNT_BITS>
uint32_t flecsi::util::offset< COUNT_BITS >::count ( ) const
inline

Get the count (number) of elements represented by this offset range.

Returns
uint32_t Number of elements

◆ end()

template<size_t COUNT_BITS>
uint64_t flecsi::util::offset< COUNT_BITS >::end ( ) const
inline

Get the index pointing one element past the final element represented by this offset range.

Returns
uint64_t End index pointing to the first element past the last element in this offset range

◆ range()

template<size_t COUNT_BITS>
std::pair<size_t, size_t> flecsi::util::offset< COUNT_BITS >::range ( ) const
inline

Get the range (start index to end index, inclusive) represented by this offset range.

Returns
std::pair<size_t, size_t> Range of this offset range

◆ set_count()

template<size_t COUNT_BITS>
void flecsi::util::offset< COUNT_BITS >::set_count ( uint32_t  count)
inline

Set the count of this offset range.

Parameters
countNew count value

◆ set_offset()

template<size_t COUNT_BITS>
void flecsi::util::offset< COUNT_BITS >::set_offset ( uint64_t  start)
inline

Set the start index of this offset range.

Parameters
startNew start index value

◆ start()

template<size_t COUNT_BITS>
uint64_t flecsi::util::offset< COUNT_BITS >::start ( ) const
inline

Get the start index of the offset range.

Returns
uint64_t Start index

Member Data Documentation

◆ count_mask

template<size_t COUNT_BITS>
constexpr uint32_t flecsi::util::offset< COUNT_BITS >::count_mask = (1ul << COUNT_BITS) - 1
static

Bitmask used to get the count bits, this is also the maximum value for the count value.

Since we ensure that COUNT_BITS <= 32, this will always fit into a uint32_t.


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