mexopencv  3.4.1
MEX interface for OpenCV library
Classes | Macros
tmwtypes.h File Reference
#include <limits.h>
#include <stddef.h>

Go to the source code of this file.

Classes

struct  creal32_T
 
struct  creal64_T
 
struct  creal_T
 

Macros

#define tmwtypes_h
 
#define __TMWTYPES__
 
#define LOGICAL_IS_A_TYPE
 
#define SPARSE_GENERALIZATION
 
#define FLT_MANT_DIG   24
 
#define DBL_MANT_DIG   53
 
#define TMW_NAME_LENGTH_MAX   64
 Maximum length of a MATLAB identifier (function/variable/model) including the null-termination character. More...
 

Determine the number of bits for int, long, short, and char.

If one fails to be determined, set the number of bits to -1

#define TMW_BITS_PER_INT   -1
 
#define TMW_BITS_PER_LONG   -1
 
#define TMW_BITS_PER_SHRT   -1
 
#define TMW_BITS_PER_SCHAR   -1
 
#define TMW_CHAR_SIGNED   1
 

Format string modifiers for using size_t variables in printf statements.

#define FMT_SIZE_T   "l"
 
#define FMT_PTRDIFF_T   "l"
 

Define Complex Structures

#define CREAL32_T   creal32_T
 
#define CREAL64_T   creal64_T
 
#define CREAL_T   creal_T
 

Min and Max:

  • int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers
  • uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers
#define MAX_int8_T   ((int8_T)(127))
 127 More...
 
#define MIN_int8_T   ((int8_T)(-128))
 -128 More...
 
#define MAX_uint8_T   ((uint8_T)(255))
 255 More...
 
#define MIN_uint8_T   ((uint8_T)(0))
 127 More...
 
#define MAX_int16_T   ((int16_T)(32767))
 32767 More...
 
#define MIN_int16_T   ((int16_T)(-32768))
 -32768 More...
 
#define MAX_uint16_T   ((uint16_T)(65535))
 65535 More...
 
#define MIN_uint16_T   ((uint16_T)(0))
 127 More...
 
#define MAX_int32_T   ((int32_T)(2147483647))
 2147483647 More...
 
#define MIN_int32_T   ((int32_T)(-2147483647-1))
 -2147483648 More...
 
#define MAX_uint32_T   ((uint32_T)(0xFFFFFFFFU))
 4294967295 More...
 
#define MIN_uint32_T   ((uint32_T)(0))
 127 More...
 

Conversion between 64-bit integers and double

#define uint64_to_double(u)   ((double)(u))
 
#define double_to_uint64(d)
 

Typedefs

The uchar_T, ushort_T and ulong_T types are needed for compilers which do not allow defines to be specified, at the command line, with spaces in them.

typedef unsigned char uchar_T
 
typedef unsigned short ushort_T
 
typedef unsigned long ulong_T
 

UTF-16 character type

typedef UINT16_T CHAR16_T
 

Fixed width word size data types:

  • int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers
  • uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers
  • real32_T, real64_T - 32 and 64 bit floating point numbers

It is common for one or more of the integer types to be the same size. For example, on many embedded processors, both shorts and ints are 16 bits. On processors used for workstations, it is quite common for both int and long to be 32 bits.

When there is more than one choice for typdef'ing a portable type like int16_T or uint32_T, in concept, it should not matter which choice is made. However, some style guides and some code checking tools do identify and complain about seemingly irrelevant differences. For example, a code checking tool may complain about an implicit conversion from int to short even though both are 16 bits. To reduce these types of complaints, it is best to make int the preferred choice when more than one is available.

The following is used to emulate smaller integer types when only larger types are available. For example, compilers for TI C3x/C4x DSPs define char and short to be 32 bits, so 8 and 16 bits are not directly available. This target is commonly used with RTW rapid prototyping. Other DSPs define char to be 16 bits, so 8 bits is not directly available.

#define REAL32_T   float
 
#define REAL64_T   double
 
typedef REAL32_T real32_T
 
typedef REAL64_T real64_T
 

General or logical data types where the word size is not guaranteed.

  • real_T - possible settings include real32_T or real64_T
  • time_T - possible settings include real64_T or uint32_T
  • boolean_T
  • char_T
  • int_T
  • uint_T
  • byte_T
#define REAL_T   real64_T
 
#define TIME_T   real_T
 
#define BOOLEAN_T   unsigned int
 
#define CHARACTER_T   char
 
#define INTEGER_T   int
 
#define UINTEGER_T   unsigned
 
#define BYTE_T   unsigned char
 
typedef REAL_T real_T
 
typedef TIME_T time_T
 
typedef BOOLEAN_T boolean_T
 
typedef CHARACTER_T char_T
 
typedef INTEGER_T int_T
 
typedef UINTEGER_T uint_T
 
typedef BYTE_T byte_T
 

boolean

#define _bool_T
 
#define false   (0)
 
#define true   (1)
 
typedef boolean_T bool
 

Maximum values for indices and dimensions

#define MWSIZE_MAX   2147483647UL
 unsigned pointer-width integer More...
 
#define MWINDEX_MAX   2147483647UL
 unsigned pointer-width integer More...
 
#define MWSINDEX_MAX   2147483647L
 unsigned pointer-width integer More...
 
#define MWSINDEX_MIN   -2147483647L
 unsigned pointer-width integer More...
 
#define MWSIZE_MIN   0UL
 unsigned pointer-width integer More...
 
#define MWINDEX_MIN   0UL
 unsigned pointer-width integer More...
 
typedef size_t mwSize
 unsigned pointer-width integer More...
 
typedef size_t mwIndex
 unsigned pointer-width integer More...
 
typedef ptrdiff_t mwSignedIndex
 a signed pointer-width integer More...
 

Detailed Description

Data types for use with MATLAB/SIMULINK and the Real-Time Workshop.

When compiling stand-alone model code, data types can be overridden via compiler switches.

Define NO_FLOATS to eliminate reference to real_T, etc.

_

When used with Real Time Workshop generated code, this header file can be used with a variety of compilers.

The compiler could be for an 8 bit embedded processor that only had 8 bits per integer and 16 bits per long. In that example, a 32 bit integer size is not even available. This header file should be robust to that.

For the case of an 8 bit processor, the preprocessor may be limited to 16 bit math like its target. That limitation would mean that 32 bit comparisons can't be done accurately. To increase robustness to this, comparisons are done against smaller values first. An inaccurate 32 bit comparison isn't attempted if the 16 bit comparison has already succeeded.

Limitations on preprocessor math can also be stricter than for the target. There are known cases where a compiler targeting processors with 64 bit longs can't do accurate preprocessor comparisons on more than 32 bits.

Definition in file tmwtypes.h.

Macro Definition Documentation

◆ __TMWTYPES__

#define __TMWTYPES__

Definition at line 49 of file tmwtypes.h.

◆ _bool_T

#define _bool_T

Definition at line 809 of file tmwtypes.h.

◆ BOOLEAN_T

#define BOOLEAN_T   unsigned int

Definition at line 537 of file tmwtypes.h.

◆ BYTE_T

#define BYTE_T   unsigned char

Definition at line 562 of file tmwtypes.h.

◆ CHARACTER_T

#define CHARACTER_T   char

Definition at line 544 of file tmwtypes.h.

◆ CREAL32_T

#define CREAL32_T   creal32_T

Definition at line 583 of file tmwtypes.h.

◆ CREAL64_T

#define CREAL64_T   creal64_T

Definition at line 592 of file tmwtypes.h.

◆ CREAL_T

#define CREAL_T   creal_T

Definition at line 601 of file tmwtypes.h.

◆ DBL_MANT_DIG

#define DBL_MANT_DIG   53

Definition at line 74 of file tmwtypes.h.

◆ double_to_uint64

#define double_to_uint64 (   d)
Value:
( ((d) > 0xffffffffffffffffULL) ? \
(unsigned long long) 0xffffffffffffffffULL : \
((d) < 0) ? (unsigned long long) 0 : (unsigned long long)(d) )

Definition at line 794 of file tmwtypes.h.

◆ false

#define false   (0)

Definition at line 814 of file tmwtypes.h.

◆ FLT_MANT_DIG

#define FLT_MANT_DIG   24

Definition at line 73 of file tmwtypes.h.

◆ FMT_PTRDIFF_T

#define FMT_PTRDIFF_T   "l"

Definition at line 486 of file tmwtypes.h.

◆ FMT_SIZE_T

#define FMT_SIZE_T   "l"

Definition at line 472 of file tmwtypes.h.

◆ INTEGER_T

#define INTEGER_T   int

Definition at line 550 of file tmwtypes.h.

◆ LOGICAL_IS_A_TYPE

#define LOGICAL_IS_A_TYPE

Definition at line 59 of file tmwtypes.h.

◆ MAX_int16_T

#define MAX_int16_T   ((int16_T)(32767))

32767

Definition at line 697 of file tmwtypes.h.

◆ MAX_int32_T

#define MAX_int32_T   ((int32_T)(2147483647))

2147483647

Definition at line 702 of file tmwtypes.h.

◆ MAX_int8_T

#define MAX_int8_T   ((int8_T)(127))

127

Definition at line 692 of file tmwtypes.h.

◆ MAX_uint16_T

#define MAX_uint16_T   ((uint16_T)(65535))

65535

Definition at line 699 of file tmwtypes.h.

◆ MAX_uint32_T

#define MAX_uint32_T   ((uint32_T)(0xFFFFFFFFU))

4294967295

Definition at line 704 of file tmwtypes.h.

◆ MAX_uint8_T

#define MAX_uint8_T   ((uint8_T)(255))

255

Definition at line 694 of file tmwtypes.h.

◆ MIN_int16_T

#define MIN_int16_T   ((int16_T)(-32768))

-32768

Definition at line 698 of file tmwtypes.h.

◆ MIN_int32_T

#define MIN_int32_T   ((int32_T)(-2147483647-1))

-2147483648

Definition at line 703 of file tmwtypes.h.

◆ MIN_int8_T

#define MIN_int8_T   ((int8_T)(-128))

-128

Definition at line 693 of file tmwtypes.h.

◆ MIN_uint16_T

#define MIN_uint16_T   ((uint16_T)(0))

127

Definition at line 700 of file tmwtypes.h.

◆ MIN_uint32_T

#define MIN_uint32_T   ((uint32_T)(0))

127

Definition at line 705 of file tmwtypes.h.

◆ MIN_uint8_T

#define MIN_uint8_T   ((uint8_T)(0))

127

Definition at line 695 of file tmwtypes.h.

◆ MWINDEX_MAX

#define MWINDEX_MAX   2147483647UL

unsigned pointer-width integer

Definition at line 869 of file tmwtypes.h.

◆ MWINDEX_MIN

#define MWINDEX_MIN   0UL

unsigned pointer-width integer

Definition at line 874 of file tmwtypes.h.

◆ MWSINDEX_MAX

#define MWSINDEX_MAX   2147483647L

unsigned pointer-width integer

Definition at line 870 of file tmwtypes.h.

◆ MWSINDEX_MIN

#define MWSINDEX_MIN   -2147483647L

unsigned pointer-width integer

Definition at line 871 of file tmwtypes.h.

◆ MWSIZE_MAX

#define MWSIZE_MAX   2147483647UL

unsigned pointer-width integer

Definition at line 868 of file tmwtypes.h.

◆ MWSIZE_MIN

#define MWSIZE_MIN   0UL

unsigned pointer-width integer

Definition at line 873 of file tmwtypes.h.

◆ REAL32_T

#define REAL32_T   float

Definition at line 342 of file tmwtypes.h.

◆ REAL64_T

#define REAL64_T   double

Definition at line 356 of file tmwtypes.h.

◆ REAL_T

#define REAL_T   real64_T

Definition at line 511 of file tmwtypes.h.

◆ SPARSE_GENERALIZATION

#define SPARSE_GENERALIZATION

Definition at line 60 of file tmwtypes.h.

◆ TIME_T

#define TIME_T   real_T

Definition at line 524 of file tmwtypes.h.

◆ TMW_BITS_PER_INT

#define TMW_BITS_PER_INT   -1

Definition at line 120 of file tmwtypes.h.

◆ TMW_BITS_PER_LONG

#define TMW_BITS_PER_LONG   -1

Definition at line 132 of file tmwtypes.h.

◆ TMW_BITS_PER_SCHAR

#define TMW_BITS_PER_SCHAR   -1

Definition at line 156 of file tmwtypes.h.

◆ TMW_BITS_PER_SHRT

#define TMW_BITS_PER_SHRT   -1

Definition at line 144 of file tmwtypes.h.

◆ TMW_CHAR_SIGNED

#define TMW_CHAR_SIGNED   1

Definition at line 162 of file tmwtypes.h.

◆ TMW_NAME_LENGTH_MAX

#define TMW_NAME_LENGTH_MAX   64

Maximum length of a MATLAB identifier (function/variable/model) including the null-termination character.

Definition at line 841 of file tmwtypes.h.

◆ tmwtypes_h

#define tmwtypes_h

Definition at line 46 of file tmwtypes.h.

◆ true

#define true   (1)

Definition at line 817 of file tmwtypes.h.

◆ uint64_to_double

#define uint64_to_double (   u)    ((double)(u))

Definition at line 790 of file tmwtypes.h.

◆ UINTEGER_T

#define UINTEGER_T   unsigned

Definition at line 556 of file tmwtypes.h.

Typedef Documentation

◆ bool

typedef boolean_T bool

Definition at line 811 of file tmwtypes.h.

◆ boolean_T

Definition at line 540 of file tmwtypes.h.

◆ byte_T

typedef BYTE_T byte_T

Definition at line 564 of file tmwtypes.h.

◆ CHAR16_T

typedef UINT16_T CHAR16_T

Definition at line 890 of file tmwtypes.h.

◆ char_T

Definition at line 546 of file tmwtypes.h.

◆ int_T

typedef INTEGER_T int_T

Definition at line 552 of file tmwtypes.h.

◆ mwIndex

typedef size_t mwIndex

unsigned pointer-width integer

Definition at line 857 of file tmwtypes.h.

◆ mwSignedIndex

typedef ptrdiff_t mwSignedIndex

a signed pointer-width integer

Definition at line 858 of file tmwtypes.h.

◆ mwSize

typedef size_t mwSize

unsigned pointer-width integer

Definition at line 856 of file tmwtypes.h.

◆ real32_T

typedef REAL32_T real32_T

Definition at line 349 of file tmwtypes.h.

◆ real64_T

typedef REAL64_T real64_T

Definition at line 363 of file tmwtypes.h.

◆ real_T

typedef REAL_T real_T

Definition at line 519 of file tmwtypes.h.

◆ time_T

typedef TIME_T time_T

Definition at line 528 of file tmwtypes.h.

◆ uchar_T

typedef unsigned char uchar_T

Definition at line 97 of file tmwtypes.h.

◆ uint_T

typedef UINTEGER_T uint_T

Definition at line 558 of file tmwtypes.h.

◆ ulong_T

typedef unsigned long ulong_T

Definition at line 99 of file tmwtypes.h.

◆ ushort_T

typedef unsigned short ushort_T

Definition at line 98 of file tmwtypes.h.