HOG2
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
DiskBitFile Class Reference

#include <DiskBitFile.h>

Public Member Functions

 DiskBitFile (const char *pre)
 
 ~DiskBitFile ()
 
void Init (const std::vector< bucketData > &buckets)
 
void WriteFileDepth (int bucket, int64_t offset, uint8_t value)
 
int ReadFileDepth (int bucket, int64_t offset)
 
void CloseReadWriteFile ()
 
uint8_t * ReadChunk (int bucket, int64_t offset, int numEntries, uint8_t *data)
 
void CloseReadFile ()
 
uint64_t GetBytesRead () const
 
uint64_t GetBytesWritten () const
 

Private Member Functions

void FlushCache ()
 
const char * getBucketFileName (int bucket, int subBucket)
 

Private Attributes

FILE * outputFile
 
int outputBucket
 
int outputSubBucket
 
int64_t cacheOffset
 
bool fileOpen
 
FILE * chunkFile
 
int64_t fileOffset
 
int64_t currBucket
 
int64_t currSubBucket
 
int64_t theCacheSize
 
int64_t cacheFilePosition
 
bool cacheChanged
 
uint8_t cache [cacheSize]
 
uint64_t bytesRead
 
uint64_t bytesWritten
 
char bucketFileName [255]
 
char prefix [64]
 

Static Private Attributes

const static int subBucketBits = 30
 
const static int64_t cacheSize = 1ull<<22
 

Detailed Description

Definition at line 23 of file DiskBitFile.h.

Constructor & Destructor Documentation

◆ DiskBitFile()

DiskBitFile::DiskBitFile ( const char *  pre)

◆ ~DiskBitFile()

DiskBitFile::~DiskBitFile ( )

Definition at line 35 of file DiskBitFile.cpp.

References CloseReadFile(), and CloseReadWriteFile().

Member Function Documentation

◆ CloseReadFile()

void DiskBitFile::CloseReadFile ( )

Definition at line 197 of file DiskBitFile.cpp.

References chunkFile, and fileOpen.

Referenced by ~DiskBitFile().

◆ CloseReadWriteFile()

void DiskBitFile::CloseReadWriteFile ( )

◆ FlushCache()

void DiskBitFile::FlushCache ( )
private

◆ getBucketFileName()

const char * DiskBitFile::getBucketFileName ( int  bucket,
int  subBucket 
)
private

Definition at line 311 of file DiskBitFile.cpp.

References BITS, bucketFileName, and prefix.

Referenced by Init(), ReadChunk(), ReadFileDepth(), and WriteFileDepth().

◆ GetBytesRead()

uint64_t DiskBitFile::GetBytesRead ( ) const
inline

Definition at line 38 of file DiskBitFile.h.

References bytesRead.

◆ GetBytesWritten()

uint64_t DiskBitFile::GetBytesWritten ( ) const
inline

Definition at line 39 of file DiskBitFile.h.

References bytesWritten.

◆ Init()

void DiskBitFile::Init ( const std::vector< bucketData > &  buckets)

Definition at line 275 of file DiskBitFile.cpp.

References BITS, currSubBucket, getBucketFileName(), min(), and subBucketBits.

◆ ReadChunk()

uint8_t * DiskBitFile::ReadChunk ( int  bucket,
int64_t  offset,
int  numEntries,
uint8_t *  data 
)

◆ ReadFileDepth()

int DiskBitFile::ReadFileDepth ( int  bucket,
int64_t  offset 
)

◆ WriteFileDepth()

void DiskBitFile::WriteFileDepth ( int  bucket,
int64_t  offset,
uint8_t  value 
)

Member Data Documentation

◆ bucketFileName

char DiskBitFile::bucketFileName[255]
private

Definition at line 65 of file DiskBitFile.h.

Referenced by getBucketFileName().

◆ bytesRead

uint64_t DiskBitFile::bytesRead
private

Definition at line 64 of file DiskBitFile.h.

Referenced by DiskBitFile(), GetBytesRead(), ReadChunk(), and ReadFileDepth().

◆ bytesWritten

uint64_t DiskBitFile::bytesWritten
private

Definition at line 64 of file DiskBitFile.h.

Referenced by DiskBitFile(), FlushCache(), and GetBytesWritten().

◆ cache

uint8_t DiskBitFile::cache[cacheSize]
private

Definition at line 62 of file DiskBitFile.h.

Referenced by FlushCache(), ReadFileDepth(), and WriteFileDepth().

◆ cacheChanged

bool DiskBitFile::cacheChanged
private

Definition at line 61 of file DiskBitFile.h.

Referenced by DiskBitFile(), FlushCache(), and WriteFileDepth().

◆ cacheFilePosition

int64_t DiskBitFile::cacheFilePosition
private

◆ cacheOffset

int64_t DiskBitFile::cacheOffset
private

◆ cacheSize

const static int64_t DiskBitFile::cacheSize = 1ull<<22
staticprivate

Definition at line 58 of file DiskBitFile.h.

Referenced by ReadFileDepth().

◆ chunkFile

FILE* DiskBitFile::chunkFile
private

Definition at line 52 of file DiskBitFile.h.

Referenced by CloseReadFile(), DiskBitFile(), and ReadChunk().

◆ currBucket

int64_t DiskBitFile::currBucket
private

Definition at line 54 of file DiskBitFile.h.

Referenced by DiskBitFile(), and ReadChunk().

◆ currSubBucket

int64_t DiskBitFile::currSubBucket
private

Definition at line 55 of file DiskBitFile.h.

Referenced by DiskBitFile(), Init(), and ReadChunk().

◆ fileOffset

int64_t DiskBitFile::fileOffset
private

Definition at line 53 of file DiskBitFile.h.

Referenced by DiskBitFile(), and ReadChunk().

◆ fileOpen

bool DiskBitFile::fileOpen
private

Definition at line 51 of file DiskBitFile.h.

Referenced by CloseReadFile(), DiskBitFile(), and ReadChunk().

◆ outputBucket

int DiskBitFile::outputBucket
private

Definition at line 46 of file DiskBitFile.h.

Referenced by CloseReadWriteFile(), DiskBitFile(), ReadFileDepth(), and WriteFileDepth().

◆ outputFile

FILE* DiskBitFile::outputFile
private

◆ outputSubBucket

int DiskBitFile::outputSubBucket
private

Definition at line 47 of file DiskBitFile.h.

Referenced by CloseReadWriteFile(), DiskBitFile(), ReadFileDepth(), and WriteFileDepth().

◆ prefix

char DiskBitFile::prefix[64]
private

Definition at line 66 of file DiskBitFile.h.

Referenced by DiskBitFile(), and getBucketFileName().

◆ subBucketBits

const static int DiskBitFile::subBucketBits = 30
staticprivate

Definition at line 57 of file DiskBitFile.h.

Referenced by Init(), ReadChunk(), ReadFileDepth(), and WriteFileDepth().

◆ theCacheSize

int64_t DiskBitFile::theCacheSize
private

Definition at line 59 of file DiskBitFile.h.

Referenced by DiskBitFile(), FlushCache(), ReadFileDepth(), and WriteFileDepth().


The documentation for this class was generated from the following files: