JeVoisBase  1.0
JeVois Smart Embedded Machine Vision Toolkit Base Modules
promote_trait< T1, T2 > Struct Template Reference

Promote from T1 and T2 to a type than can hold T1 * T2. More...

#include </lab/itti/jevois/software/jevoisbase/src/Components/RoadFinder/Promotions.H>

Public Types

enum  { willPromote = 0 }
 
typedef T1 TP
 

Detailed Description

template<class T1, class T2>
struct promote_trait< T1, T2 >

Promote from T1 and T2 to a type than can hold T1 * T2.

The idea here is to create a mechanism by which a given template type can be promoted to a more capable type (e.g., byte to float, or PixRGB<byte> to PixRGB<float>), typically to hold the result of some operation that may exceed the capacity of the original type (e.g., the result of adding two bytes may not fit within the range of possible values for byte). See http://www.oonumerics.org/blitz/traits.html for further details. The way to use this is as follows: if you have a template type T (which may be scalar or not) that you wish to promote to a more capable type that would have "similar characteristics" to another type TT, then use the type promote_trait<T,TT>::TP. For example: promote_trait<T,float>::TP is a float if T was a byte, and is a PixRGB<float> if T was a PixRGB<byte>

Basic promotion mechanism: given T1 and T2, TP provides the appropriate type to hold the result of an operation involving T1 and T2. Default is to promote to type T1, that is, no change (this is used when T2 is "weaker" than T1; when T2 is "stronger" that T1, the explicit specialized rules below are used).

Definition at line 75 of file Promotions.H.

Member Typedef Documentation

template<class T1, class T2>
typedef T1 promote_trait< T1, T2 >::TP

Definition at line 75 of file Promotions.H.

Member Enumeration Documentation

template<class T1, class T2>
anonymous enum
Enumerator
willPromote 

Definition at line 75 of file Promotions.H.


The documentation for this struct was generated from the following file: