Types.hh

00001 /**********************************************************************
00002  * blaRAY -- photon mapper/raytracer
00003  * (C) 2008 by Tomasz bla Fortuna <bla@thera.be>, <bla@af.gliwice.pl>
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation, either version 3 of the License, or
00008  * any later version.
00009  *
00010  * See Docs/LICENSE
00011  *********************/
00012 
00013 #ifndef _TYPES_H_
00014 #define _TYPES_H_
00015 
00016 #include <iostream>
00017 #include "General/Debug.hh"
00018 
00056 template<typename T>
00057 
00058 struct explicit_t {
00059 private:
00061         template<typename V> explicit_t(const V &t);
00062 
00064         T value;
00065 public:
00066 
00068         explicit_t(const T &c) : value(c) {}
00069         explicit_t() {};
00073         operator T& () { return value; }
00074 
00077         operator const T& () const { return value; }
00078 };
00079 
00080 #if (DEBUG == 1)
00081 #       define e_t(t) explicit_t<t>
00082 #else
00083 #       define e_t(t) t
00084 #endif
00085 
00087 typedef e_t(int)                Int;
00088 typedef e_t(double)             Double;
00089 typedef e_t(char)               Char;
00090 typedef e_t(bool)               Bool;
00091 typedef e_t(short)              Short;
00092 typedef e_t(unsigned int)       UInt;
00093 typedef e_t(unsigned short)     UShort;
00094 typedef e_t(unsigned char)      UChar;
00095 typedef e_t(double)             Double;
00096 typedef void                    Void;
00099 #endif

Generated on Wed Mar 12 00:34:58 2008 for blaRAY by  doxygen 1.5.5