STIR  6.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
stir::NumericType Class Reference

provides names for some numeric types and methods for finding their properties. More...

#include "stir/NumericType.h"

Public Types

enum  Type {
  BIT, SCHAR, UCHAR, SHORT,
  USHORT, INT, UINT, LONG,
  ULONG, FLOAT, DOUBLE, UNKNOWN_TYPE
}
 An enum for the supported types.
 

Public Member Functions

 NumericType (Type t=UNKNOWN_TYPE)
 constructor, defaulting to unknown type
 
 NumericType (const std::string &number_format, const std::size_t size_in_bytes)
 A constructor to work from named types a la Interfile. More...
 
bool operator== (NumericType type) const
 comparison operator
 
bool operator!= (NumericType type) const
 
std::size_t size_in_bytes () const
 as reported by sizeof(), so it is really size_in_sizeof_char
 
std::size_t size_in_bits () const
 
bool signed_type () const
 returns true for all built-in types, except unsigned types
 
bool integer_type () const
 returns true for all built-in types, except float and double
 
void get_Interfile_info (std::string &number_format, std::size_t &size_in_bytes) const
 returns the names and size a la Interfile. see NumericType(const string&,const std::size_t)
 

Public Attributes

Type id
 stores the current type
 

Detailed Description

provides names for some numeric types and methods for finding their properties.

Warning
CHAR itself is missing (there's only signed and unsigned versions). This is because this class is only used where you have to know if the type is signed.

Constructor & Destructor Documentation

◆ NumericType()

stir::NumericType::NumericType ( const std::string &  number_format,
const std::size_t  size_in_bytes 
)

A constructor to work from named types a la Interfile.

Possible values for number_format are bit, signed integer, unsigned integer, float Exact types are determined via the size_in_bytes parameter.


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