BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
fc::safe< T > Struct Template Reference

#include <safe.hpp>

Public Member Functions

template<typename O >
 safe (O o)
 
 safe ()
 
 safe (const safe &o)
 
safe operator- () const
 
safeoperator+= (const safe &b)
 
safeoperator-= (const safe &b)
 
safeoperator*= (const safe &b)
 
safeoperator/= (const safe &b)
 
safeoperator%= (const safe &b)
 
safeoperator++ ()
 
safe operator++ (int)
 
safeoperator-- ()
 
safe operator-- (int)
 

Static Public Member Functions

static constexpr safe min ()
 
static constexpr safe max ()
 

Public Attributes

value = 0
 

Friends

safe operator+ (const safe &a, const safe &b)
 
safe operator- (const safe &a, const safe &b)
 
safe operator* (const safe &a, const safe &b)
 
safe operator/ (const safe &a, const safe &b)
 
safe operator% (const safe &a, const safe &b)
 
bool operator== (const safe &a, const safe &b)
 
bool operator== (const safe &a, const T &b)
 
bool operator== (const T &a, const safe &b)
 
bool operator< (const safe &a, const safe &b)
 
bool operator< (const safe &a, const T &b)
 
bool operator< (const T &a, const safe &b)
 
bool operator> (const safe &a, const safe &b)
 
bool operator> (const safe &a, const T &b)
 
bool operator> (const T &a, const safe &b)
 
bool operator!= (const safe &a, const safe &b)
 
bool operator!= (const safe &a, const T &b)
 
bool operator!= (const T &a, const safe &b)
 
bool operator<= (const safe &a, const safe &b)
 
bool operator<= (const safe &a, const T &b)
 
bool operator<= (const T &a, const safe &b)
 
bool operator>= (const safe &a, const safe &b)
 
bool operator>= (const safe &a, const T &b)
 
bool operator>= (const T &a, const safe &b)
 

Detailed Description

template<typename T>
struct fc::safe< T >

This type is designed to provide automatic checks for integer overflow and default initialization. It will throw an exception on overflow conditions.

It can only be used on built-in types.

Implemented using spec from: https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow

Definition at line 20 of file safe.hpp.

Constructor & Destructor Documentation

template<typename T>
template<typename O >
fc::safe< T >::safe ( o)
inline

Definition at line 25 of file safe.hpp.

template<typename T>
fc::safe< T >::safe ( )
inline

Definition at line 26 of file safe.hpp.

template<typename T>
fc::safe< T >::safe ( const safe< T > &  o)
inline

Definition at line 27 of file safe.hpp.

Member Function Documentation

template<typename T>
static constexpr safe fc::safe< T >::max ( )
inlinestatic

Definition at line 33 of file safe.hpp.

template<typename T>
static constexpr safe fc::safe< T >::min ( )
inlinestatic

Definition at line 29 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator%= ( const safe< T > &  b)
inline

Definition at line 118 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator*= ( const safe< T > &  b)
inline

Definition at line 108 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator++ ( )
inline

Definition at line 124 of file safe.hpp.

template<typename T>
safe fc::safe< T >::operator++ ( int  )
inline

Definition at line 129 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator+= ( const safe< T > &  b)
inline

Definition at line 98 of file safe.hpp.

template<typename T>
safe fc::safe< T >::operator- ( ) const
inline

Definition at line 92 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator-- ( )
inline

Definition at line 136 of file safe.hpp.

template<typename T>
safe fc::safe< T >::operator-- ( int  )
inline

Definition at line 141 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator-= ( const safe< T > &  b)
inline

Definition at line 103 of file safe.hpp.

template<typename T>
safe& fc::safe< T >::operator/= ( const safe< T > &  b)
inline

Definition at line 113 of file safe.hpp.

Friends And Related Function Documentation

template<typename T>
bool operator!= ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 187 of file safe.hpp.

template<typename T>
bool operator!= ( const safe< T > &  a,
const T &  b 
)
friend

Definition at line 191 of file safe.hpp.

template<typename T>
bool operator!= ( const T &  a,
const safe< T > &  b 
)
friend

Definition at line 195 of file safe.hpp.

template<typename T>
safe operator% ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 85 of file safe.hpp.

template<typename T>
safe operator* ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 51 of file safe.hpp.

template<typename T>
safe operator+ ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 38 of file safe.hpp.

template<typename T>
safe operator- ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 44 of file safe.hpp.

template<typename T>
safe operator/ ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 79 of file safe.hpp.

template<typename T>
bool operator< ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 161 of file safe.hpp.

template<typename T>
bool operator< ( const safe< T > &  a,
const T &  b 
)
friend

Definition at line 165 of file safe.hpp.

template<typename T>
bool operator< ( const T &  a,
const safe< T > &  b 
)
friend

Definition at line 169 of file safe.hpp.

template<typename T>
bool operator<= ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 200 of file safe.hpp.

template<typename T>
bool operator<= ( const safe< T > &  a,
const T &  b 
)
friend

Definition at line 204 of file safe.hpp.

template<typename T>
bool operator<= ( const T &  a,
const safe< T > &  b 
)
friend

Definition at line 208 of file safe.hpp.

template<typename T>
bool operator== ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 148 of file safe.hpp.

template<typename T>
bool operator== ( const safe< T > &  a,
const T &  b 
)
friend

Definition at line 152 of file safe.hpp.

template<typename T>
bool operator== ( const T &  a,
const safe< T > &  b 
)
friend

Definition at line 156 of file safe.hpp.

template<typename T>
bool operator> ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 174 of file safe.hpp.

template<typename T>
bool operator> ( const safe< T > &  a,
const T &  b 
)
friend

Definition at line 178 of file safe.hpp.

template<typename T>
bool operator> ( const T &  a,
const safe< T > &  b 
)
friend

Definition at line 182 of file safe.hpp.

template<typename T>
bool operator>= ( const safe< T > &  a,
const safe< T > &  b 
)
friend

Definition at line 213 of file safe.hpp.

template<typename T>
bool operator>= ( const safe< T > &  a,
const T &  b 
)
friend

Definition at line 217 of file safe.hpp.

template<typename T>
bool operator>= ( const T &  a,
const safe< T > &  b 
)
friend

Definition at line 221 of file safe.hpp.

Member Data Documentation

template<typename T>
T fc::safe< T >::value = 0

Definition at line 22 of file safe.hpp.


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