Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Bounded Namespace Reference

Namespace for numeric types with well-defined upper and lower bounds, enforced by either truncation or aliasing as desired. More...


Compounds

struct  Bounded::Crop
class  Bounded::Float
class  Bounded::Integer
struct  Bounded::Wrap

Typedefs

typedef long LargeInt
 Encompassing integral type; the Bounded classes can only accept integral values up to those representable in this type. More...

typedef double LargeFloat
 Encompassing floating-point type; the Bounded classes can only accept floating-point values up to those representable in this type. More...

typedef double Magnitude
 Generic type for a real-valued magnitude on the scale 0 to 1.0. More...


Detailed Description

Namespace for numeric types with well-defined upper and lower bounds, enforced by either truncation or aliasing as desired.

An instance of these classes stores a single number, silently enforcing upper and lower bounds for construction, assignment, and copying from other types. Unlike the implicit aliasing of e.g. a char, the boundaries may be smaller than the maximum representable in that type (although for integers the default range is the full range available) and values outside the range can either be truncated (cropped) at the boundaries, or aliased (wrapped) into the valid range.

A design criterion is that the memory footprint of an instance of each class must be no larger than the size of its underlying type. As a result, no virtual functions can be used, since the size of the virtual function table is quite large compared to the size of e.g. a char. (Inheritance from a base type also seems to increase the class size in GCC, at least for chars, so that too should be avoided.)


Typedef Documentation

typedef double Bounded::LargeFloat
 

Encompassing floating-point type; the Bounded classes can only accept floating-point values up to those representable in this type.

Definition at line 61 of file boundednumber.h.

typedef long Bounded::LargeInt
 

Encompassing integral type; the Bounded classes can only accept integral values up to those representable in this type.

Definition at line 56 of file boundednumber.h.

typedef double Bounded::Magnitude
 

Generic type for a real-valued magnitude on the scale 0 to 1.0.

Larger or smaller values are acceptable (boundaries are not enforced) but are not always meaningful.

Definition at line 68 of file boundednumber.h.


Generated at Mon Aug 21 00:31:29 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000