timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::utility::bit_flags< Nopts > Struct Template Reference

#include "timemory/utility/bit_flags.hpp"

+ Collaboration diagram for tim::utility::bit_flags< Nopts >:

Public Types

using base_type = bit_flags< Nopts >
 
using value_type = std::conditional_t<(Nopts<=8), uint8_t, std::conditional_t<(Nopts<=16), uint16_t, std::conditional_t<(Nopts<=32), uint32_t, uint64_t > > >
 

Public Member Functions

template<size_t Idx>
bool test () const
 
bool test (value_type idx) const
 
template<size_t Idx>
void set (bool v)
 
void set (value_type idx, bool v)
 
void reset ()
 
void set_state_value (value_type v)
 
value_type get_state_value () const
 

Detailed Description

template<size_t Nopts>
struct tim::utility::bit_flags< Nopts >

Definition at line 37 of file bit_flags.hpp.

Member Typedef Documentation

◆ base_type

template<size_t Nopts>
using tim::utility::bit_flags< Nopts >::base_type = bit_flags<Nopts>

Definition at line 40 of file bit_flags.hpp.

◆ value_type

template<size_t Nopts>
using tim::utility::bit_flags< Nopts >::value_type = std::conditional_t< (Nopts <= 8), uint8_t, std::conditional_t<(Nopts <= 16), uint16_t, std::conditional_t<(Nopts <= 32), uint32_t, uint64_t> >>

Definition at line 41 of file bit_flags.hpp.

Member Function Documentation

◆ get_state_value()

template<size_t Nopts>
value_type tim::utility::bit_flags< Nopts >::get_state_value ( ) const
inline

Definition at line 56 of file bit_flags.hpp.

56{ return m_state_value; }

◆ reset()

template<size_t Nopts>
void tim::utility::bit_flags< Nopts >::reset ( )
inline

Definition at line 54 of file bit_flags.hpp.

54{ m_state_value = 0; }

◆ set() [1/2]

template<size_t Nopts>
template<size_t Idx>
void tim::utility::bit_flags< Nopts >::set ( bool  v)

Definition at line 84 of file bit_flags.hpp.

85{
86 bool _curr = test<Idx>();
87 if(_curr != v)
88 {
89 if(!_curr)
90 m_state_value |= index<Idx>();
91 else
92 m_state_value &= (~index<Idx>());
93 }
94}

◆ set() [2/2]

template<size_t Nopts>
void tim::utility::bit_flags< Nopts >::set ( value_type  idx,
bool  v 
)

Definition at line 98 of file bit_flags.hpp.

99{
100 bool _curr = test(idx);
101 if(_curr != v)
102 {
103 if(!_curr)
104 m_state_value |= index(idx);
105 else
106 m_state_value &= (~index(idx));
107 }
108}

◆ set_state_value()

template<size_t Nopts>
void tim::utility::bit_flags< Nopts >::set_state_value ( value_type  v)
inline

Definition at line 55 of file bit_flags.hpp.

55{ m_state_value = v; }

◆ test() [1/2]

template<size_t Nopts>
template<size_t Idx>
bool tim::utility::bit_flags< Nopts >::test

Definition at line 69 of file bit_flags.hpp.

70{
71 return (m_state_value & index<Idx>());
72}

◆ test() [2/2]

template<size_t Nopts>
bool tim::utility::bit_flags< Nopts >::test ( value_type  idx) const

Definition at line 76 of file bit_flags.hpp.

77{
78 return (m_state_value & index(idx));
79}

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