LRAUV  revA
BinaryLogWriter Class Reference

Defines a LogWriter specific to writing binary values to a stream See FileLogWriter for output to the filesystem. More...

#include <BinaryLogWriter.h>

Inheritance diagram for BinaryLogWriter:
Collaboration diagram for BinaryLogWriter:

Public Member Functions

 BinaryLogWriter (bool withDirectory=false)
 Default Constructor Assumes that the stream will be assigned later via setOutStream() More...
 
 BinaryLogWriter (OutStream &stream, bool withDirectory=false)
 Constructor, takes an OutStream. More...
 
virtual ~BinaryLogWriter ()
 Destructor. More...
 
virtual unsigned int writeHeader ()
 Start the binary log. More...
 
virtual unsigned int write (const LogEntry *entry, const Unit *unit=NULL)
 Write an entry to the log. More...
 
virtual void resetTimeBase ()
 Calling this resets the time base to "zero". More...
 
- Public Member Functions inherited from LogWriter
virtual ~LogWriter ()
 Destructor. More...
 
virtual void setOutStream (OutStream &outStream)
 Sets the OutStream. More...
 
virtual bool isValid ()
 Return true if logStream_ is available. More...
 
virtual void endCycle ()
 Do what needs to be done at the end of the cycle. More...
 
virtual unsigned int writeFooter ()
 Write the log footer, if any. More...
 
virtual void config (Logger &logger)
 Configure from a config file. More...
 
virtual void resetInputs ()
 Reset cached input settings. More...
 
void addParent ()
 
void removeParent ()
 
int getParentCount ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual bool isActive ()
 
virtual void lockWrites ()
 
virtual void unlockWrites ()
 

Protected Attributes

Timestamp timeBase_
 Start of the cycle time. More...
 
bool withDirectory_
 
- Protected Attributes inherited from LogWriter
OutStreamlogStream_
 Stores an OutStream. More...
 
bool wroteHeader_
 
bool wroteFooter_
 
Mutex writeMutex_
 
int parentCount_
 
bool active_
 

Additional Inherited Members

- Public Types inherited from LogWriter
enum  ServiceType {
  NO_SERVICE = -1, SERVICE_COURIER, SERVICE_EXPRESS, SERVICE_PRIORITY,
  SERVICE_NORMAL, SERVICE_BULK, SERVICE_COUNT, SERVICE_MULTI
}
 
- Static Public Member Functions inherited from LogWriter
static ServiceType Str2ServiceType (const char *const serviceTypeStr, int len=-1)
 
static const char * ServiceType2Str (LogWriter::ServiceType serviceType)
 
static size_t ServiceType2Strlen (LogWriter::ServiceType serviceType)
 
- Static Public Attributes inherited from LogWriter
static const char *const SERVICE_TYPE_STRS [SERVICE_COUNT]
 
static size_t const SERVICE_TYPE_STRLEN [SERVICE_COUNT]
 
- Protected Member Functions inherited from LogWriter
 LogWriter ()
 Protected constructor for pure virtual class. More...
 
 LogWriter (OutStream &outStream)
 Protected constructor for pure virtual class. More...
 

Detailed Description

Defines a LogWriter specific to writing binary values to a stream See FileLogWriter for output to the filesystem.

Constructor & Destructor Documentation

BinaryLogWriter::BinaryLogWriter ( bool  withDirectory = false)

Default Constructor Assumes that the stream will be assigned later via setOutStream()

Parameters
withDirectoryIf true, include DirectoryEntry entries.
BinaryLogWriter::BinaryLogWriter ( OutStream stream,
bool  withDirectory = false 
)

Constructor, takes an OutStream.

Parameters
streamAn OutStream for output.
withDirectoryIf true, include DirectoryEntry entries.
BinaryLogWriter::~BinaryLogWriter ( )
virtual

Destructor.

Member Function Documentation

virtual void BinaryLogWriter::resetTimeBase ( )
inlinevirtual

Calling this resets the time base to "zero".

References Timestamp::NOT_SET_TIME, and timeBase_.

Referenced by Supervisor::RestartLogs().

unsigned int BinaryLogWriter::write ( const LogEntry entry,
const Unit unit = NULL 
)
virtual

Write an entry to the log.

This does not actually change units, since binary logs are always in the base unit.

Parameters
entryThe LogEntry to write/serialize
unitoptional unit to express the value in
Returns
Returns number of bytes written

Implements LogWriter.

References LogWriter::logStream_, timeBase_, LogEntry::write(), and LogWriter::writeMutex_.

unsigned int BinaryLogWriter::writeHeader ( )
virtual

Start the binary log.

Reimplemented from LogWriter.

Reimplemented in DirectoryLogWriter.

References OutStream::isWritable(), LogWriter::logStream_, timeBase_, withDirectory_, and DirectoryEntry::write().

Referenced by DirectoryLogWriter::writeHeader().

Member Data Documentation

Timestamp BinaryLogWriter::timeBase_
protected

Start of the cycle time.

Referenced by resetTimeBase(), write(), and writeHeader().

bool BinaryLogWriter::withDirectory_
protected

Referenced by writeHeader().


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