LRAUV  revA
FileLogReader.h
Go to the documentation of this file.
1 
10 #ifndef FILELOGREADER_H_
11 #define FILELOGREADER_H_
12 
13 #include "LogReader.h"
14 
15 #include "io/FileInStream.h"
16 
26 class FileLogReader : public LogReader
27 {
28 public:
29 
35  FileLogReader( const Str& filebase, LogReader* logReader );
36 
38  virtual ~FileLogReader();
39 
41  virtual bool valid( void )
42  {
43  return isReadable();
44  };
45 
47  virtual unsigned int read();
48 
50  unsigned int getEntriesRead( void )
51  {
52  return entriesRead_;
53  };
54 
56  Str nextFilename();
57 
59  bool isReadable( void )
60  {
61  return fileStream_.isReadable();
62  };
63 
64  static void SetPriorityList( FlexArray<const char*>* priorityList )
65  {
66  PriorityList_ = priorityList;
67  }
68 
69 private:
70  // Note that the copy constructor below is private and not given a body.
71  // Any attempt to call it will return a compiler error.
72  FileLogReader( const FileLogReader& old ); // disallow copy constructor
73 
74  // Using .bak extensions and PriorityList_ entries, open the indicated file,
75  // returning the actual filename opened.
76  Str matchAndOpen( const Str& filename );
77 
80 
82  FILE* file_;
83 
86 
88  unsigned int entriesRead_;
89 
92 
94  unsigned int nextFilenum_;
95 
97 
98 };
99 
100 #endif /*FILELOGREADER_H_*/
FILE * file_
The input file handle.
Definition: FileLogReader.h:82
unsigned int entriesRead_
Total entries read.
Definition: FileLogReader.h:88
FileLogReader(const Str &filebase, LogReader *logReader)
Constructor.
Definition: FileLogReader.cpp:23
Str nextFilename()
Uses nextFilenum_ to determine the next filename.
Definition: FileLogReader.cpp:143
Base class for a generalized set of "log data destinations," including to files (text or binary)...
Definition: LogReader.h:21
Str matchAndOpen(const Str &filename)
Definition: FileLogReader.cpp:99
virtual unsigned int read()
Read.
Definition: FileLogReader.cpp:64
bool isReadable()
indicates whether the stream can actually be read from.
Definition: FileInStream.h:57
LogReader * logReader_
The LogReader that does the actual writing.
Definition: FileLogReader.h:91
Wraps a c FILE* handle with an InStream class.
Definition: FileInStream.h:26
static void SetPriorityList(FlexArray< const char * > *priorityList)
Definition: FileLogReader.h:64
Wraps around another LogReader to read LogEntries to a file.
Definition: FileLogReader.h:26
virtual bool valid(void)
Is the LogReader valid?
Definition: FileLogReader.h:41
bool isReadable(void)
Keep track of whether the stream is open.
Definition: FileLogReader.h:59
Contains the FileInStream class declaration.
Contains the LogReader class definition.
Replacement for standard template class string.
Definition: Str.h:12
Str filebase_
Name of the file being read.
Definition: FileLogReader.h:79
static FlexArray< const char * > * PriorityList_
Definition: FileLogReader.h:96
virtual ~FileLogReader()
Destructor, closes file if open.
Definition: FileLogReader.cpp:53
FileInStream fileStream_
The input file stream.
Definition: FileLogReader.h:85
unsigned int nextFilenum_
Number of the next split file.
Definition: FileLogReader.h:94
unsigned int getEntriesRead(void)
Accessors.
Definition: FileLogReader.h:50