DLUtils.h

Go to the documentation of this file.
00001 #ifndef DLUTILS_H
00002 #define DLUTILS_H
00003 
00004 #include "DLUtils.h"
00005 
00009 enum DLEndian {
00010    DL_LE, 
00011    DL_BE  
00012 };
00013 
00029 class DLUtils
00030 {
00031    public:
00036    DLUtils(void);
00037 
00041    ~DLUtils(void);
00042 
00060    static int roundInt(double val); 
00061 
00075    static double roundDouble(double value, int precision);
00076 
00085    static void reverseInt(int &iVal);
00093    static void reverseShort(short &sVal);
00094 
00105    static DLEndian testByteOrder()
00106       {
00107          short int word = 0x001;  // two byte
00108          char *byte = (char*) &word; // one bye variable gets first byte
00109          return (byte[0] ? DL_LE : DL_BE);  // if it's one, we have a little endian system
00110       };
00111 
00112    /***************************************************************************
00113     *  Given a filename with or without concatenated path, creates the root filename
00114     *  For example:  Input "out.tif" yields output "out"
00115     *  \param longFile "a filename"
00116     *  \return A filename if successful, NULL otherwise
00117     ***************************************************************************/
00118    static char * getRootName (char *longFile);
00119 
00120    /***************************************************************************
00121     *  Given a filename with or without concatenated path, creates the suffix
00122     *  For example:  Input "out.tif" yields output "tif"
00123     *  \param longFile "a filename"
00124     *  \return A filename if successful, NULL otherwise
00125     ***************************************************************************/
00126    static char * getSuffix (char *longFile);
00127 };
00128 
00129 
00130 #endif // DLUTILS_H

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007