iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

Macros designed to facilitate the use of GenericImage and the design of generic code.

See Also
GenericImage class and concepts


#define NRT_GENERICIMAGE_PIXTYPE_WARN(genimage, PixType)

Macro Definition Documentation


Issue a warning if an nrt::GenericImage does not contain the specified nrt::Image<PixType>, i.e., an expensive pixel-by-pixel conversion will be necessary to convert the GenericImage to Image<PixType>

Definition at line 55 of file GenericImageMacros.H.


Declare the GenericImage version of a function that takes one Image and returns an Image. Standard promotion syntax applies, so if your original function looks like:

template <typename promo, class PixType, typename DestType = typename promote<PixType, promo>::type>
Image<DestType> func(Image<PixType> const & src);

and you then write:

you will essentially have written:

template <typename promo>
nrt::GenericImage func(GenericImage const & src);

You can then use NRT_DEFINE_GENERICIMAGE_UNARY_FUNCTION(func) to actually define your function as a GenericImage unary visitor.

Definition at line 86 of file GenericImageMacros.H.


Define the GenericImage version of a function that takes one Image and returns an Image. Use this in the same namespace as you used NRT_DECLARE_GENERICIMAGE_UNARY_FUNCTION(func). This defines a visitor and defines the body of a function previously declared with NRT_DECLARE_GENERICIMAGE_UNARY_FUNCTION(func). The visitor is applied to the source GenericImage using the apply_visitor() function of GenericImage. Inside the visitor, the template operator() function gets called during visitation, with as PixType the pixel type of the Image actually contained in the GenericImage, and in there we call your original function on the passed Image<PixType>. Your original function then returns an Image<DestType>, which we stuff into a GenericImage and return. For this to work, of course both PixType and DestType should be listed as valid types in the boost::variant definition inside GenericImage; so if you are writing a function that you will typically use with "exotic" pixel types, either don't attempt to write a GenericImage version of it at all, or negotiate with the NRT developer team to have your exotic pixel types added to the internals of GenericImage.

Definition at line 103 of file GenericImageMacros.H.