Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX > Struct Template Reference

This struct condenses N boolean values into roughly N bits, saving roughly 4x memory. NUM_ELEMS parameter takes in the number of boolean values. BASE_INDEX parameter takes in the index of the first value. The recommended way to use this struct is with an enum. See core::scoring::hbonds::graph::AtomInfo for an example. More...

#include <DenseBoolMap.hh>

Public Member Functions

 DenseBoolMap ()
 
void set (unsigned int const element, bool const setting)
 
template<unsigned int const element>
void set (bool const setting)
 templated equivalent to set( element, setting ). I personally like this one better because it does bounds-checking at compile time and not just in debug mode. Of course, this only works if you know the value for "element" when calling set(). More...
 
bool get (unsigned int const element) const
 
template<unsigned int const element>
constexpr bool get () const
 templated equivalent to get( element ). I personally like this one better because it does bounds-checking at compile time and not just in debug mode. Of course, this only works if you know the value for "element" when calling get(). More...
 

Static Public Member Functions

static constexpr unsigned int num_bytes ()
 
static constexpr unsigned int byte_for_element (unsigned int const element)
 
static constexpr unsigned char mask_for_element (unsigned int const element)
 

Private Attributes

std::array< unsigned char,(NUM_ELEMS+3)/4 > data_
 

Detailed Description

template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
struct utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >

This struct condenses N boolean values into roughly N bits, saving roughly 4x memory. NUM_ELEMS parameter takes in the number of boolean values. BASE_INDEX parameter takes in the index of the first value. The recommended way to use this struct is with an enum. See core::scoring::hbonds::graph::AtomInfo for an example.

Constructor & Destructor Documentation

template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::DenseBoolMap ( )
inline

Member Function Documentation

template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
static constexpr unsigned int utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::byte_for_element ( unsigned int const  element)
inlinestatic
template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
bool utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::get ( unsigned int const  element) const
inline
template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
template<unsigned int const element>
constexpr bool utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::get ( ) const
inline

templated equivalent to get( element ). I personally like this one better because it does bounds-checking at compile time and not just in debug mode. Of course, this only works if you know the value for "element" when calling get().

References utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::byte_for_element(), utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::data_, and utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::mask_for_element().

template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
static constexpr unsigned char utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::mask_for_element ( unsigned int const  element)
inlinestatic
template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
static constexpr unsigned int utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::num_bytes ( )
inlinestatic
template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
void utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::set ( unsigned int const  element,
bool const  setting 
)
inline
template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
template<unsigned int const element>
void utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::set ( bool const  setting)
inline

templated equivalent to set( element, setting ). I personally like this one better because it does bounds-checking at compile time and not just in debug mode. Of course, this only works if you know the value for "element" when calling set().

References utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::byte_for_element(), utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::data_, and utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::mask_for_element().

Member Data Documentation

template<unsigned int NUM_ELEMS, unsigned int BASE_INDEX>
std::array< unsigned char, ( NUM_ELEMS + 3 ) / 4 > utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::data_
private

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