Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::date_time::wrapping_int< int_type_, wrap_val > Class Template Reference

A wrapping integer used to support time durations (WARNING: only instantiate with a signed type) More...

#include <wrapping_int.hpp>

Public Types

typedef int_type_ int_type
 

Public Member Functions

 wrapping_int (int_type v)
 Add, return true if wrapped. More...
 
int_type as_int () const
 Explicit converion method. More...
 
 operator int_type () const
 
template<typename IntT >
IntT add (IntT v)
 Add, return number of wraps performed. More...
 
template<typename IntT >
IntT subtract (IntT v)
 Subtract will return '+d' if wrapping under took place ('d' is the number of wraps) More...
 

Static Public Member Functions

static int_type wrap_value ()
 

Detailed Description

template<typename int_type_, int_type_ wrap_val>
class boost::date_time::wrapping_int< int_type_, wrap_val >

A wrapping integer used to support time durations (WARNING: only instantiate with a signed type)

In composite date and time types this type is used to wrap at the day boundary. Ex: A wrapping_int<short, 10> will roll over after nine, and roll under below zero. This gives a range of [0,9]

NOTE: it is strongly recommended that wrapping_int2 be used instead of wrapping_int as wrapping_int is to be depricated at some point soon.

Also Note that warnings will occur if instantiated with an unsigned type. Only a signed type should be used!

Member Typedef Documentation

template<typename int_type_ , int_type_ wrap_val>
typedef int_type_ boost::date_time::wrapping_int< int_type_, wrap_val >::int_type

Constructor & Destructor Documentation

template<typename int_type_ , int_type_ wrap_val>
boost::date_time::wrapping_int< int_type_, wrap_val >::wrapping_int ( int_type  v)
inline

Add, return true if wrapped.

Member Function Documentation

template<typename int_type_ , int_type_ wrap_val>
template<typename IntT >
IntT boost::date_time::wrapping_int< int_type_, wrap_val >::add ( IntT  v)
inline

Add, return number of wraps performed.

The sign of the returned value will indicate which direction the wraps went. Ex: add a negative number and wrapping under could occur, this would be indicated by a negative return value. If wrapping over took place, a positive value would be returned

template<typename int_type_ , int_type_ wrap_val>
int_type boost::date_time::wrapping_int< int_type_, wrap_val >::as_int ( ) const
inline

Explicit converion method.

template<typename int_type_ , int_type_ wrap_val>
boost::date_time::wrapping_int< int_type_, wrap_val >::operator int_type ( ) const
inline
template<typename int_type_ , int_type_ wrap_val>
template<typename IntT >
IntT boost::date_time::wrapping_int< int_type_, wrap_val >::subtract ( IntT  v)
inline

Subtract will return '+d' if wrapping under took place ('d' is the number of wraps)

The sign of the returned value will indicate which direction the wraps went (positive indicates wrap under, negative indicates wrap over). Ex: subtract a negative number and wrapping over could occur, this would be indicated by a negative return value. If wrapping under took place, a positive value would be returned.

template<typename int_type_ , int_type_ wrap_val>
static int_type boost::date_time::wrapping_int< int_type_, wrap_val >::wrap_value ( )
inlinestatic

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