many helper functions

This commit is contained in:
amannb 2011-10-25 11:47:23 -07:00 committed by Bernhard Amann
parent 3654060246
commit d7a3b85fcd
6 changed files with 245 additions and 31 deletions

View file

@ -18,12 +18,17 @@ public:
bool Init(string arg_source, int num_fields, const LogField* const* fields);
void Finish();
bool Update();
protected:
// Methods that have to be overwritten by the individual readers
virtual bool DoInit(string arg_source, int num_fields, const LogField* const * fields) = 0;
virtual void DoFinish() = 0;
// update file contents to logmgr
virtual bool DoUpdate() = 0;
// Reports an error to the user.
void Error(const char *msg);
@ -31,6 +36,9 @@ protected:
// The following methods return the information as passed to Init().
const string Source() const { return source; }
// A thread-safe version of fmt(). (stolen from logwriter)
const char* Fmt(const char* format, ...);
private:
friend class InputMgr;
@ -44,6 +52,10 @@ private:
bool disabled;
bool Disabled() { return disabled; }
// For implementing Fmt().
char* buf;
unsigned int buf_len;
};