Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

DCFutility.h File Reference

#include <iostream.h>
#include <string.h>
#include <algorithm.h>

Include dependency graph for DCFutility.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define DCF_DEFAULT_MPACKET   16384
#define DCF_DEFAULT_STRING   30
#define DCF_MAXINT   0x7FFFFFFF
#define DCF_MININT   0x80000000

Functions

void dcfdbfilename (const int, const string &, string &)
void dcflogfilename (const string &, string &)
void dcfmbfilename (const int, const int, const string &, string &)
void dcfsbfilename (const int, string &, string &)
void inttohex (int, char *, int=sizeof(int))
template<typename Data_t> int quantize (const double quantcoef, const Data_t data, int &idata)


Define Documentation

#define DCF_DEFAULT_MPACKET   16384
 

Definition at line 19 of file DCFutility.h.

Referenced by DCFsbostream< Data_t >.operator<<(), and DCFsbistream< Data_t >.operator>>().

#define DCF_DEFAULT_STRING   30
 

Definition at line 18 of file DCFutility.h.

#define DCF_MAXINT   0x7FFFFFFF
 

Definition at line 11 of file DCFutility.h.

Referenced by quantize().

#define DCF_MININT   0x80000000
 

Definition at line 15 of file DCFutility.h.

Referenced by quantize().


Function Documentation

void dcfdbfilename const  int,
const string &  ,
string & 
 

Definition at line 64 of file DCFutility.cpp.

00069 {
00070    char *ctmp = new char[2*2+1];
00071    inttohex( blocknum, ctmp, 2  );
00072    dbfilename = filenamebase + ".db" + ctmp + ".dcf";
00073 };

void dcflogfilename const string &  ,
string & 
 

Definition at line 76 of file DCFutility.cpp.

00080 {
00081    filenamelog = filenamebase + ".log.dcf";
00082 }

void dcfmbfilename const  int,
const  int,
const string &  ,
string & 
 

Definition at line 50 of file DCFutility.cpp.

00056 {
00057    char *ctmp1 = new char[2*2+1];
00058    char *ctmp2 = new char[2*1+1];
00059    inttohex( blocknum, ctmp1, 2  );
00060    inttohex( m, ctmp2, 1  );
00061    mbfilename = filenamebase + ".mb" + ctmp1 + "." + ctmp2 + ".dcf";
00062 }; 

void dcfsbfilename const  int,
string &  ,
string & 
 

Definition at line 39 of file DCFutility.cpp.

00044 {
00045    char *ctmp = new char[2*2+1]; 
00046    inttohex( superblocknum, ctmp, 2  );
00047    filenamesb = filenamebase + ".sb" + ctmp + ".dcf";
00048 };

void inttohex int  ,
char *  ,
int  = sizeof(int)
 

Definition at line 16 of file DCFutility.cpp.

00016                                              {
00017    const char* hexdigit="0123456789ABCDEF";
00018    char* pttmp=(char*)(&num);
00019    unsigned char c;
00020    int j=0;
00021 
00022    for(int i = 0; i < min( len, int(sizeof(int) ) ); i++ ) {
00023 #ifdef STORM_RS6000_AIX
00024       c=pttmp[ sizeof(int) - len + i ];
00025 #endif
00026 #ifdef STORM_x86_LINUX
00027       c=pttmp[ len - 1 - i ];
00028 #endif
00029 #ifdef STORM_SGI_IRIX
00030       c=pttmp[ sizeof(int) - len + i ];
00031 #endif
00032       ptc[j++] = hexdigit[ int( ( c & 0xF0 ) >> 4 ) ];
00033       ptc[j++] = hexdigit[ int( ( c & 0x0F ) ) ];
00034    }
00035 
00036    ptc[j]='\0';
00037 };

template<typename Data_t>
int quantize const double  quantcoef,
const Data_t  data,
int idata
 

Definition at line 35 of file DCFutility.h.

References DCF_MAXINT, and DCF_MININT.

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 };


Generated on Mon May 31 21:39:29 2004 for SR2k4 Assembler by doxygen 1.3.6