STIR 6.5.0
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.
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() [1/2]

stir::NumericType::NumericType ( Type t = UNKNOWN_TYPE)
inline

constructor, defaulting to unknown type

References id, and NumericType().

Referenced by NumericType(), NumericType(), operator==(), and stir::InterfileHeader::post_processing().

◆ NumericType() [2/2]

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.

References get_Interfile_info(), integer_type(), NumericType(), operator==(), signed_type(), and size_in_bytes().

Member Function Documentation

◆ operator==()

bool stir::NumericType::operator== ( NumericType type) const
inline

comparison operator

References NumericType().

Referenced by NumericType().

◆ size_in_bytes()

size_t stir::NumericType::size_in_bytes ( ) const

as reported by sizeof(), so it is really size_in_sizeof_char

References size_in_bytes().

Referenced by get_Interfile_info(), NumericType(), size_in_bytes(), and stir::write_basic_interfile_image_header().

◆ signed_type()

bool stir::NumericType::signed_type ( ) const

returns true for all built-in types, except unsigned types

References signed_type().

Referenced by NumericType(), signed_type(), and stir::write_basic_interfile_image_header().

◆ integer_type()

bool stir::NumericType::integer_type ( ) const

returns true for all built-in types, except float and double

References integer_type().

Referenced by integer_type(), NumericType(), and stir::write_basic_interfile_image_header().

◆ get_Interfile_info()

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

Member Data Documentation

◆ id

Type stir::NumericType::id

stores the current type

Referenced by stir::ecat::ecat7::make_ECAT7_main_header(), and NumericType().


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