00001
00002
00003
00004
00005
00006
00007 #ifndef DCFUTILITY_H
00008 #define DCFUTILITY_H
00009
00010 #ifndef DCF_MAXINT
00011 #define DCF_MAXINT 0x7FFFFFFF
00012 #endif
00013
00014 #ifndef DCF_MININT
00015 #define DCF_MININT 0x80000000
00016 #endif
00017
00018 #define DCF_DEFAULT_STRING 30
00019 #define DCF_DEFAULT_MPACKET 16384
00020
00021 #ifdef USE_STD
00022 #include <iostream>
00023 #include <string>
00024 #include <algorithm>
00025 using namespace std;
00026 #else
00027 #include <iostream.h>
00028 #include <string.h>
00029 #include <algorithm.h>
00030 #endif
00031
00032
00033
00034 template <typename Data_t>
00035 int quantize( const double quantcoef, const Data_t data, int& idata )
00036 {
00037 Data_t tmp;
00038
00039 if ( quantcoef == 0 ) {
00040 idata=int(data);
00041 return -1;
00042 }
00043
00044 if ( tmp > double( DCF_MAXINT ) ) {
00045 idata = DCF_MAXINT;
00046 return 1;
00047 }
00048
00049 if ( tmp < -double(DCF_MININT) ) {
00050 idata = DCF_MININT;
00051 return 1;
00052 }
00053
00054 idata=int(tmp/quantcoef);
00055 return 0;
00056 };
00057
00058 void inttohex( int, char*, int = sizeof(int) );
00059
00060 void dcfsbfilename( const int, string&, string& );
00061
00062 void dcfmbfilename( const int, const int, const string&, string&);
00063
00064 void dcfdbfilename( const int, const string&, string& );
00065
00066 void dcflogfilename( const string&, string& );
00067
00068 #endif
00069