Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

round.h

Go to the documentation of this file.
00001 #include <cmath>
00002 
00003 using std::floor;
00004 
00005 namespace Sct {
00006 
00007     
00008 inline unsigned char roundToUChar(float value) {
00009     if (value < 0) return 0;
00010     else if (value>255) return 255;
00011     else return(unsigned char)floor(value+0.5f);
00012 }
00013 
00014 inline unsigned char roundToUChar(double value) {
00015     if (value < 0) return 0;
00016     else if (value>255) return 255;
00017     else return(unsigned char)floor(value+0.5);
00018 }
00019 
00020 }
00021 

Generated on Mon Dec 15 19:36:14 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3