ubuntu-location-service
..
An aggregating location service providing positioning and geocoding capabilities to applications.
|
A helper class to handle bounded integer values, with an optional domain for tagging domain-specific types. More...
#include <bounded_integer.h>
Public Member Functions | |
BoundedInteger () | |
Constructs an invalid instance. More... | |
BoundedInteger (int value) | |
Constructs an instance from a raw value. More... | |
BoundedInteger (const BoundedInteger< Tag, min, max, inv > &rhs) | |
Copy c'tor. More... | |
BoundedInteger< Tag, min, max, inv > & | operator= (const BoundedInteger< Tag, min, max, inv > &rhs) |
Assignment operator. More... | |
bool | operator== (const BoundedInteger< Tag, min, max, inv > &rhs) const |
Equality comparison operator. More... | |
operator int () const | |
Implicit casting operator to a raw integer value. More... | |
bool | is_valid () const |
is_valid checks whether the contained value is in [min, max]. More... | |
int | get () const |
Returns the raw integer value contained in this instance. More... | |
void | set (int new_value) |
Assigns a new raw integer value. More... | |
void | reset () |
Resets the instance to an invalid value. More... | |
Static Public Member Functions | |
static int | invalid () |
Returns the invalid value for the specified range. More... | |
static int | minimum () |
Access the minimum value of the integer. More... | |
static int | maximum () |
Access the maximum value of the integer. More... | |
static int | range () |
Returns max - min. More... | |
static BoundedInteger< Tag, min, max, inv > | from_percent (float percent) |
from_percent creates a new instance, mapping to the defined range of valid values. More... | |
A helper class to handle bounded integer values, with an optional domain for tagging domain-specific types.
Definition at line 37 of file bounded_integer.h.
|
inline |
Constructs an invalid instance.
Definition at line 91 of file bounded_integer.h.
|
inlineexplicit |
Constructs an instance from a raw value.
value | The raw value. |
std::runtime_error | if value is not in [min, max]. |
Definition at line 100 of file bounded_integer.h.
|
inline |
Copy c'tor.
rhs | The instance to copy from. |
Definition at line 112 of file bounded_integer.h.
|
inlinestatic |
from_percent creates a new instance, mapping to the defined range of valid values.
Definition at line 77 of file bounded_integer.h.
|
inline |
Returns the raw integer value contained in this instance.
std::runtime_error | if is_valid() returns false. |
Definition at line 159 of file bounded_integer.h.
|
inlinestatic |
Returns the invalid value for the specified range.
Definition at line 45 of file bounded_integer.h.
|
inline |
is_valid checks whether the contained value is in [min, max].
Definition at line 150 of file bounded_integer.h.
|
inlinestatic |
Access the maximum value of the integer.
Definition at line 61 of file bounded_integer.h.
|
inlinestatic |
Access the minimum value of the integer.
Definition at line 53 of file bounded_integer.h.
|
inline |
Implicit casting operator to a raw integer value.
Definition at line 141 of file bounded_integer.h.
|
inline |
Assignment operator.
rhs | The instance to assign from. |
Definition at line 121 of file bounded_integer.h.
|
inline |
Equality comparison operator.
rhs | The instance to compare to. |
Definition at line 132 of file bounded_integer.h.
|
inlinestatic |
Returns max - min.
Definition at line 69 of file bounded_integer.h.
|
inline |
Resets the instance to an invalid value.
Definition at line 180 of file bounded_integer.h.
|
inline |
Assigns a new raw integer value.
new_value | The new value. |
std::runtime_error | if new_value is not in [min, max]. |
Definition at line 169 of file bounded_integer.h.