libStatGen Software 1
Loading...
Searching...
No Matches
IFILE_Test Class Reference
Inheritance diagram for IFILE_Test:
Collaboration diagram for IFILE_Test:

Public Member Functions

void test ()
 
- Public Member Functions inherited from InputFile
 InputFile ()
 Default constructor.
 
 ~InputFile ()
 Destructor.
 
 InputFile (const char *filename, const char *mode, InputFile::ifileCompression compressionMode=InputFile::DEFAULT)
 Constructor for opening a file.
 
void bufferReads (unsigned int bufferSize=DEFAULT_BUFFER_SIZE)
 Set the buffer size for reading from files so that bufferSize bytes are read at a time and stored until accessed by another read call.
 
void disableBuffering ()
 Disable read buffering.
 
int ifclose ()
 Close the file.
 
int ifread (void *buffer, unsigned int size)
 Read size bytes from the file into the buffer.
 
int readTilChar (const std::string &stopChars, std::string &stringRef)
 Read until the specified characters, returning which character was found causing the stop, -1 returned for EOF, storing the other read characters into the specified string.
 
int readTilChar (const std::string &stopChars)
 Read until the specified characters, returning which character was found causing the stop, -1 returned for EOF, dropping all read chars.
 
int discardLine ()
 Read until the end of the line, discarding the characters, returning -1 returned for EOF and returning 0 if the end of the line was found.
 
int readLine (std::string &line)
 Read, appending the characters into the specified string until new line or EOF is found, returning -1 if EOF is found first and 0 if new line is found first.
 
int readTilTab (std::string &field)
 Read, appending the characters into the specified string until tab, new line, or EOF is found, returning -1 if EOF is found first, 0 if new line is found first, or 1 if a tab is found first.
 
int ifgetc ()
 Get a character from the file.
 
bool ifgetline (void *voidBuffer, size_t max)
 Get a line from the file.
 
void ifrewind ()
 Reset to the beginning of the file.
 
int ifeof () const
 Check to see if we have reached the EOF.
 
unsigned int ifwrite (const void *buffer, unsigned int size)
 Write the specified buffer into the file.
 
bool isOpen () const
 Returns whether or not the file was successfully opened.
 
int64_t iftell ()
 Get current position in the file.
 
bool ifseek (int64_t offset, int origin)
 Seek to the specified offset from the origin.
 
const char * getFileName () const
 Get the filename that is currently opened.
 
void setAttemptRecovery (bool flag=false)
 Enable (default) or disable recovery.
 
bool attemptRecoverySync (bool(*checkSignature)(void *data), int length)
 
bool openFile (const char *filename, const char *mode, InputFile::ifileCompression compressionMode)
 

Static Public Attributes

static const int TEST_FILE_SIZE = 37
 
static const int BGZF_TEST_FILE_SIZE = 93
 
static const std::string TEST_FILE_CONTENTS = "ABCDabcd1234\nEFGefg567\nhijklHIJKL8910"
 

Additional Inherited Members

- Public Types inherited from InputFile
enum  ifileCompression { DEFAULT , UNCOMPRESSED , GZIP , BGZF }
 Compression to use when writing a file & decompression used when reading a file from stdin. More...
 
- Protected Member Functions inherited from InputFile
int readFromFile (void *buffer, unsigned int size)
 
- Protected Attributes inherited from InputFile
FileTypemyFileTypePtr
 
unsigned int myAllocatedBufferSize
 
char * myFileBuffer
 
int myBufferIndex
 
int myCurrentBufferSize
 
std::string myFileName
 
- Static Protected Attributes inherited from InputFile
static const unsigned int DEFAULT_BUFFER_SIZE = 65536
 

Detailed Description

Definition at line 21 of file InputFileTest.h.

Member Function Documentation

◆ test()

void IFILE_Test::test ( )

Definition at line 47 of file InputFileTest.cpp.

48{
49 std::cout << "\nUncompressedFileType Tests:" << std::endl;
50 testAll("txt");
51
52#ifdef __ZLIB_AVAILABLE__
53 std::cout << "\nGzipFileType Tests:" << std::endl;
54 testAll("gz");
55
56 std::cout << "\nBgzfFileType Tests:" << std::endl;
57 testAll("bam");
58
59 std::cout << "\n.glf file Tests:" << std::endl;
60 testAll("glf");
61#endif
62}

Member Data Documentation

◆ BGZF_TEST_FILE_SIZE

const int IFILE_Test::BGZF_TEST_FILE_SIZE = 93
static

Definition at line 27 of file InputFileTest.h.

◆ TEST_FILE_CONTENTS

const std::string IFILE_Test::TEST_FILE_CONTENTS = "ABCDabcd1234\nEFGefg567\nhijklHIJKL8910"
static

Definition at line 28 of file InputFileTest.h.

◆ TEST_FILE_SIZE

const int IFILE_Test::TEST_FILE_SIZE = 37
static

Definition at line 26 of file InputFileTest.h.


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