DUDS
Distributed Update of Data from Something
duds::data::LargeIntWrapper< I, M > Struct Template Reference

Wraps an integer to allow the Boost multiprecision library to provide insertion and extraction operators, and to provide Boost serialization support that will produce the same result, while using either a native integer type or a Boost multiprecision type. More...

#include <Int128.hpp>

Public Member Functions

 LargeIntWrapper ()=default
 
 LargeIntWrapper (const LargeIntWrapper &liw)=default
 
constexpr LargeIntWrapper (const I &v)
 
bool operator!= (LargeIntWrapper const &b) const
 
LargeIntWrapper operator% (LargeIntWrapper const &b) const
 
LargeIntWrapperoperator%= (LargeIntWrapper const &b)
 
LargeIntWrapper operator* (LargeIntWrapper const &b) const
 
LargeIntWrapperoperator*= (LargeIntWrapper const &b)
 
LargeIntWrapper operator+ (LargeIntWrapper const &b) const
 
LargeIntWrapperoperator+= (LargeIntWrapper const &b)
 
LargeIntWrapper operator- (LargeIntWrapper const &b) const
 
LargeIntWrapperoperator-= (LargeIntWrapper const &b)
 
LargeIntWrapper operator/ (LargeIntWrapper const &b) const
 
LargeIntWrapperoperator/= (LargeIntWrapper const &b)
 
bool operator< (LargeIntWrapper const &b) const
 
bool operator<= (LargeIntWrapper const &b) const
 
LargeIntWrapperoperator= (LargeIntWrapper const &b)
 
LargeIntWrapperoperator= (I const &b)
 
bool operator== (LargeIntWrapper const &b) const
 
bool operator> (LargeIntWrapper const &b) const
 
bool operator>= (LargeIntWrapper const &b) const
 

Public Attributes

value
 

Private Member Functions

 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 
template<class A >
void load (A &a, const unsigned int)
 
template<class A >
void save (A &a, const unsigned int) const
 Serialize the unit data. More...
 

Friends

class boost::serialization::access
 Serialization support. More...
 
std::ostream & operator<< (std::ostream &os, LargeIntWrapper const &b)
 
std::istream & operator>> (std::istream &is, LargeIntWrapper &b)
 

Detailed Description

template<class I, class M>
struct duds::data::LargeIntWrapper< I, M >

Wraps an integer to allow the Boost multiprecision library to provide insertion and extraction operators, and to provide Boost serialization support that will produce the same result, while using either a native integer type or a Boost multiprecision type.

This is intended to allow the use of gcc's __int128 type on 64-bit targets and boost::multiprecision::int128_t on 32-bit targets, while allowing the integer in serialized form to be exchanged between the targets. For larger integers, it makes more sense to use something like Boost multiprecision on all targets.

Template Parameters
IThe underlying integer type used for storage.
MThe Boost multiprecision type used for stream I/O. This parameter may be the same as I.
Author
Jeff Jackowski

Definition at line 85 of file Int128.hpp.

Constructor & Destructor Documentation

◆ LargeIntWrapper() [1/3]

template<class I , class M >
duds::data::LargeIntWrapper< I, M >::LargeIntWrapper ( )
default

◆ LargeIntWrapper() [2/3]

template<class I , class M >
duds::data::LargeIntWrapper< I, M >::LargeIntWrapper ( const LargeIntWrapper< I, M > &  liw)
default

◆ LargeIntWrapper() [3/3]

template<class I , class M >
constexpr duds::data::LargeIntWrapper< I, M >::LargeIntWrapper ( const I &  v)
inline

Definition at line 97 of file Int128.hpp.

Member Function Documentation

◆ BOOST_SERIALIZATION_SPLIT_MEMBER()

template<class I , class M >
duds::data::LargeIntWrapper< I, M >::BOOST_SERIALIZATION_SPLIT_MEMBER ( )
private

◆ load()

template<class I , class M >
template<class A >
void duds::data::LargeIntWrapper< I, M >::load ( A &  a,
const unsigned  int 
)
inlineprivate

Definition at line 191 of file Int128.hpp.

◆ operator!=()

template<class I , class M >
bool duds::data::LargeIntWrapper< I, M >::operator!= ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 122 of file Int128.hpp.

◆ operator%()

template<class I , class M >
LargeIntWrapper duds::data::LargeIntWrapper< I, M >::operator% ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 149 of file Int128.hpp.

◆ operator%=()

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator%= ( LargeIntWrapper< I, M > const &  b)
inline

Definition at line 164 of file Int128.hpp.

◆ operator*()

template<class I , class M >
LargeIntWrapper duds::data::LargeIntWrapper< I, M >::operator* ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 143 of file Int128.hpp.

◆ operator*=()

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator*= ( LargeIntWrapper< I, M > const &  b)
inline

Definition at line 158 of file Int128.hpp.

◆ operator+()

template<class I , class M >
LargeIntWrapper duds::data::LargeIntWrapper< I, M >::operator+ ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 137 of file Int128.hpp.

◆ operator+=()

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator+= ( LargeIntWrapper< I, M > const &  b)
inline

Definition at line 152 of file Int128.hpp.

◆ operator-()

template<class I , class M >
LargeIntWrapper duds::data::LargeIntWrapper< I, M >::operator- ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 140 of file Int128.hpp.

◆ operator-=()

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator-= ( LargeIntWrapper< I, M > const &  b)
inline

Definition at line 155 of file Int128.hpp.

◆ operator/()

template<class I , class M >
LargeIntWrapper duds::data::LargeIntWrapper< I, M >::operator/ ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 146 of file Int128.hpp.

◆ operator/=()

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator/= ( LargeIntWrapper< I, M > const &  b)
inline

Definition at line 161 of file Int128.hpp.

◆ operator<()

template<class I , class M >
bool duds::data::LargeIntWrapper< I, M >::operator< ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 128 of file Int128.hpp.

◆ operator<=()

template<class I , class M >
bool duds::data::LargeIntWrapper< I, M >::operator<= ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 134 of file Int128.hpp.

◆ operator=() [1/2]

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator= ( LargeIntWrapper< I, M > const &  b)
inline

Definition at line 103 of file Int128.hpp.

◆ operator=() [2/2]

template<class I , class M >
LargeIntWrapper& duds::data::LargeIntWrapper< I, M >::operator= ( I const &  b)
inline

Definition at line 115 of file Int128.hpp.

◆ operator==()

template<class I , class M >
bool duds::data::LargeIntWrapper< I, M >::operator== ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 119 of file Int128.hpp.

◆ operator>()

template<class I , class M >
bool duds::data::LargeIntWrapper< I, M >::operator> ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 125 of file Int128.hpp.

◆ operator>=()

template<class I , class M >
bool duds::data::LargeIntWrapper< I, M >::operator>= ( LargeIntWrapper< I, M > const &  b) const
inline

Definition at line 131 of file Int128.hpp.

◆ save()

template<class I , class M >
template<class A >
void duds::data::LargeIntWrapper< I, M >::save ( A &  a,
const unsigned  int 
) const
inlineprivate

Serialize the unit data.

Warning
The archive (type A) must handle endianness. Some, like text formats, do. Not sure about others.

Definition at line 184 of file Int128.hpp.

Friends And Related Function Documentation

◆ boost::serialization::access

template<class I , class M >
friend class boost::serialization::access
friend

Serialization support.

Definition at line 177 of file Int128.hpp.

◆ operator<<

template<class I , class M >
std::ostream& operator<< ( std::ostream &  os,
LargeIntWrapper< I, M > const &  b 
)
friend

Definition at line 170 of file Int128.hpp.

◆ operator>>

template<class I , class M >
std::istream& operator>> ( std::istream &  is,
LargeIntWrapper< I, M > &  b 
)
friend

Definition at line 167 of file Int128.hpp.

Member Data Documentation

◆ value


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