LRAUV  revA
SplitFileLogWriter.h
Go to the documentation of this file.
1 
10 #ifndef SPLITFILELOGWRITER_H_
11 #define SPLITFILELOGWRITER_H_
12 
13 #include "FileLogWriter.h"
14 
21 {
22 public:
30  SplitFileLogWriter( const Str& filebase, LogWriter* logWriter, FileEncoder* fileEncoder = NULL, int nextFilenum = 0 );
31 
40  SplitFileLogWriter( const Str& filebase, unsigned int capacity, LogWriter* logWriter, FileEncoder* fileEncoder = NULL, int nextFilenum = 0 );
41 
50  SplitFileLogWriter( const Str& filebase, const Timespan& span, LogWriter* logWriter, FileEncoder* fileEncoder = NULL, int nextFilenum = 0 );
51 
53  virtual ~SplitFileLogWriter();
54 
56  virtual unsigned int write( const LogEntry *entry, const Unit* unit = NULL );
57 
58  /*virtual void config( Logger& logger );*/
59 
62  virtual void split( bool andReopen = true, int nextFilenum = -1 );
63 
65  virtual void resetFileBase( const Str& filebase, int nextFilenum = 0 );
66 
67 protected:
68 
70  virtual Str nextFilename( int nextFilenum = -1 );
71 
72 private:
73  // Note that the copy constructor below is private and not given a body.
74  // Any attempt to call it will return a compiler error.
75  SplitFileLogWriter( const SplitFileLogWriter& old ); // disallow copy constructor
76 
78 
79  const unsigned int capacity_;
80 
81  unsigned int nextFilenum_;
82 
83  const Timespan span_;
84 
86 
87 };
88 
89 #endif /*SPLITFILELOGWRITER_H_*/
Str filebase_
Definition: SplitFileLogWriter.h:77
Wraps around another LogWriter to write LogEntries to a file.
Definition: FileLogWriter.h:28
virtual unsigned int write(const LogEntry *entry, const Unit *unit=NULL)
Write.
Definition: SplitFileLogWriter.cpp:81
Base class for a generalized set of "log data destinations," including to files (text or binary)...
Definition: LogWriter.h:25
Timestamp splitTime_
Definition: SplitFileLogWriter.h:85
Timespan class, represents a delta of time.
Definition: Timestamp.h:248
const Timespan span_
Definition: SplitFileLogWriter.h:83
unsigned int nextFilenum_
Definition: SplitFileLogWriter.h:81
One "entry" in a LogQueue.
Definition: LogEntry.h:33
virtual void split(bool andReopen=true, int nextFilenum=-1)
Split the file.
Definition: SplitFileLogWriter.cpp:131
virtual Str nextFilename(int nextFilenum=-1)
Uses nextFilenum_ to determine the next filename.
Definition: SplitFileLogWriter.cpp:159
Replacement for standard template class string.
Definition: Str.h:12
const unsigned int capacity_
Definition: SplitFileLogWriter.h:79
virtual ~SplitFileLogWriter()
Destructor, closes file if open.
Definition: SplitFileLogWriter.cpp:75
SplitFileLogWriter(const Str &filebase, LogWriter *logWriter, FileEncoder *fileEncoder=NULL, int nextFilenum=0)
Constructor for manual split.
Definition: SplitFileLogWriter.cpp:28
Writes LogEntries to files that are split over time or capacity.
Definition: SplitFileLogWriter.h:20
Contains the FileLogWriter class definition.
virtual void resetFileBase(const Str &filebase, int nextFilenum=0)
Change file destination.
Definition: SplitFileLogWriter.cpp:148
This is a rather abstract class that can be implemented by classes that encode a (closed) file...
Definition: FileEncoder.h:20
Code that represents an engineering unit.
Definition: Unit.h:24
Represents absolute times.
Definition: Timestamp.h:31