FreePOOMA  2.4.1
Classes
DomainTraits.int.h File Reference

DomainTraits<int> is a specialization of the general DomainTraits class, for the case of integers. More...

#include "Domain/DomainTraits.h"
Include dependency graph for DomainTraits.int.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  DomainTraits< char >
struct  DomainTraits< unsigned char >
struct  DomainTraits< short >
struct  DomainTraits< unsigned short >
struct  DomainTraits< int >
struct  DomainTraits< unsigned int >
struct  DomainTraits< long >
struct  DomainTraits< unsigned long >

Detailed Description

DomainTraits<int> is a specialization of the general DomainTraits class, for the case of integers.

Integers can often be used in combination with other domain types, and the traits class defines how they interact with those other domains. Generally, an int gets promoted to a Loc or Interval, based on the context, but in some cases the int is used directly.

This also defines the same kind of traits for long, char and short. Both are treated just as if they were int's for Domain purposes. The same is true for the unsigned versions of these integral types.

DomainTraits<int> stores the characteristics of integers when they are used to specify domains in expressions and object constructors. An int behaves differently in different situations; for example, when used to construct a new, separate domain object, an int acts just like a Loc<1> object. When used to construct an Array, an int acts just like an Interval<1> object, for an interval [0 ... intval - 1].

Since we do not ever have int as a domain "type", just in constructors and subset objects, then we need only define the bare minimum of info in this traits class.

Identical traits are defined for long, char and short. Both integral types are treated just as if they were ints; they get converted to Interval or Loc objects in almost all cases. The same is true to unsigned versions.