GCC Middle and Back End API Reference
ana::integer_with_unit< Unit > Class Template Reference

#include <integer-with-unit.h>

Inheritance diagram for ana::integer_with_unit< Unit >:
Collaboration diagram for ana::integer_with_unit< Unit >:

Public Member Functions

 integer_with_unit ()
 integer_with_unit (int i)
 integer_with_unit (integer i)
const integer & get_integer () const
void dump_to_pp (pretty_printer *pp, units::role role=units::role::generic) const
void dump () const
std::unique_ptr< json::object > to_json () const
std::unique_ptr< diagnostics::markup::node > make_markup_node () const
bool is_zero_p () const
bool is_one_p () const
integer_with_unit< Unit > & operator+= (const integer_with_unit< Unit > &rhs)
integer_with_unit< Unit > & operator-= (const integer_with_unit< Unit > &rhs)
integer_with_unit< Unit > & operator++ ()
bool operator< (const integer_with_unit< Unit > &rhs) const
bool operator<= (const integer_with_unit< Unit > &rhs) const
bool operator> (const integer_with_unit< Unit > &rhs) const
bool operator>= (const integer_with_unit< Unit > &rhs) const
integer_with_unit< Unit > operator- () const
integer floor_div (const integer_with_unit< Unit > &other) const
integer_with_unit< Unit > floor_mod (const integer_with_unit< Unit > &other) const
long as_long () const
unsigned long as_unsigned_long () const

Static Public Member Functions

static int cmp (const integer_with_unit< Unit > &lhs, const integer_with_unit< Unit > &rhs)

Static Public Attributes

static constexpr const char * dump_type_name = Unit::dump_type_name

Private Attributes

integer m_integer

Detailed Description

template<typename Unit>
class ana::integer_with_unit< Unit >
A unit-safe arbitrary precision integer e.g. "32_bytes" or "5_bits".   

Constructor & Destructor Documentation

◆ integer_with_unit() [1/3]

◆ integer_with_unit() [2/3]

template<typename Unit>
ana::integer_with_unit< Unit >::integer_with_unit ( int i)
inlineexplicit

◆ integer_with_unit() [3/3]

template<typename Unit>
ana::integer_with_unit< Unit >::integer_with_unit ( integer i)
inlineexplicit

Member Function Documentation

◆ as_long()

template<typename Unit>
long ana::integer_with_unit< Unit >::as_long ( ) const
inline

◆ as_unsigned_long()

template<typename Unit>
unsigned long ana::integer_with_unit< Unit >::as_unsigned_long ( ) const
inline

◆ cmp()

template<typename Unit>
int ana::integer_with_unit< Unit >::cmp ( const integer_with_unit< Unit > & lhs,
const integer_with_unit< Unit > & rhs )
inlinestatic

◆ dump()

template<typename Unit>
void ana::integer_with_unit< Unit >::dump ( ) const

◆ dump_to_pp()

template<typename Unit>
void ana::integer_with_unit< Unit >::dump_to_pp ( pretty_printer * pp,
units::role role = units::role::generic ) const

◆ floor_div()

template<typename Unit>
integer ana::integer_with_unit< Unit >::floor_div ( const integer_with_unit< Unit > & other) const
inline

◆ floor_mod()

template<typename Unit>
integer_with_unit< Unit > ana::integer_with_unit< Unit >::floor_mod ( const integer_with_unit< Unit > & other) const
inline

◆ get_integer()

template<typename Unit>
const integer & ana::integer_with_unit< Unit >::get_integer ( ) const
inline

◆ is_one_p()

template<typename Unit>
bool ana::integer_with_unit< Unit >::is_one_p ( ) const
inline

◆ is_zero_p()

template<typename Unit>
bool ana::integer_with_unit< Unit >::is_zero_p ( ) const
inline

◆ make_markup_node()

template<typename Unit>
std::unique_ptr< diagnostics::markup::node > ana::integer_with_unit< Unit >::make_markup_node ( ) const

◆ operator++()

template<typename Unit>
integer_with_unit< Unit > & ana::integer_with_unit< Unit >::operator++ ( )
inline

◆ operator+=()

template<typename Unit>
integer_with_unit< Unit > & ana::integer_with_unit< Unit >::operator+= ( const integer_with_unit< Unit > & rhs)
inline

◆ operator-()

template<typename Unit>
integer_with_unit< Unit > ana::integer_with_unit< Unit >::operator- ( ) const
inline

◆ operator-=()

template<typename Unit>
integer_with_unit< Unit > & ana::integer_with_unit< Unit >::operator-= ( const integer_with_unit< Unit > & rhs)
inline

◆ operator<()

template<typename Unit>
bool ana::integer_with_unit< Unit >::operator< ( const integer_with_unit< Unit > & rhs) const
inline

◆ operator<=()

template<typename Unit>
bool ana::integer_with_unit< Unit >::operator<= ( const integer_with_unit< Unit > & rhs) const
inline

◆ operator>()

template<typename Unit>
bool ana::integer_with_unit< Unit >::operator> ( const integer_with_unit< Unit > & rhs) const
inline

◆ operator>=()

template<typename Unit>
bool ana::integer_with_unit< Unit >::operator>= ( const integer_with_unit< Unit > & rhs) const
inline

◆ to_json()

template<typename Unit>
std::unique_ptr< json::object > ana::integer_with_unit< Unit >::to_json ( ) const

Field Documentation

◆ dump_type_name

template<typename Unit>
const char* ana::integer_with_unit< Unit >::dump_type_name = Unit::dump_type_name
staticconstexpr

◆ m_integer

template<typename Unit>
integer ana::integer_with_unit< Unit >::m_integer
private

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