LRAUV  revA
LinearApproximationLogWriter Class Reference

Defines a LogWriter that can perform lossy decimation on a stream of DataEntries, by outputting values that can be reconstructed via linear interpolation. More...

#include <LinearApproximationLogWriter.h>

Inheritance diagram for LinearApproximationLogWriter:
Collaboration diagram for LinearApproximationLogWriter:

Classes

class  VarData
 

Public Member Functions

 LinearApproximationLogWriter (LogWriter *outputTo, int varCount, char **varList, char **unitList, float *approxErrors, bool sendAtStartCycle, bool makeDirEntries=false)
 
virtual ~LinearApproximationLogWriter ()
 
virtual unsigned int writeHeader ()
 Write the log header, if any. More...
 
virtual void endCycle ()
 Do what needs to be done at the end of the cycle. More...
 
virtual void config (Logger &logger)
 Configure from a config file. More...
 
virtual unsigned int writeFooter ()
 Write the log footer, if any. More...
 
void resetDirectoryEntries ()
 
unsigned int forceWrite (DataEntry *dataEntry)
 
unsigned int forceWriteRow ()
 
- Public Member Functions inherited from TableLogWriter
 TableLogWriter (int varCount, char **varList, char **unitList, bool interpolate)
 Constructor. More...
 
 TableLogWriter (LogWriter *outputTo, int varCount, char **varList, char **unitList, bool interpolate)
 Constructor. More...
 
virtual ~TableLogWriter ()
 Destructor. More...
 
virtual unsigned int write (const LogEntry *entry, const Unit *unit=NULL)
 Write an entry to the text log. More...
 
virtual unsigned int writeAllInterpolated ()
 
virtual void resetInputs ()
 Reset cached input settings. 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...
 
void addParent ()
 
void removeParent ()
 
int getParentCount ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual bool isActive ()
 
virtual void lockWrites ()
 
virtual void unlockWrites ()
 

Private Member Functions

 LinearApproximationLogWriter (const LinearApproximationLogWriter &old)
 
void preInitialize ()
 
virtual unsigned int writeToColumn (const DataEntry *dataEntry, const int column)
 
virtual unsigned int writeRow ()
 
virtual unsigned int writeSyslog (const SyslogEntry *syslogEntry)
 
unsigned int sendOutput (DataEntry *dataEntry, int varIndex)
 

Private Attributes

float * approxErrors_
 
bool sendAtStartCycle_
 
bool makeDirEntries_
 
LinearApproximationLogWriter::VarData ** varData_
 
FlexArray< int * > nameWrites_
 
FlexArray< int * > forceWrites_
 
DataAccess ** dataAccesses_
 
bool * dataAccessHidden_
 
bool recentOutput_
 
EventEntry cycleStartEntry_
 

Friends

class Supervisor
 

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 TableLogWriter
 TableLogWriter (const TableLogWriter &old)
 
void initializeTableLogWriter ()
 
virtual void clearRow ()
 
const DataEntry ** newDataEntryRow ()
 
void deleteDataEntryRow (const DataEntry **dataEntryRow)
 
unsigned int writeInterpolated (const LogEntry *logEntry, const int column)
 
unsigned int writeDataEntryRow (unsigned int row)
 
DataEntryinterpolateDataEntry (const Timestamp &timestamp, const DataEntry *startEntry, const DataEntry *endEntry)
 
DataEntrynanDataEntry (const Timestamp &timestamp, const DataEntry *origEntry)
 
- Protected Member Functions inherited from LogWriter
 LogWriter ()
 Protected constructor for pure virtual class. More...
 
 LogWriter (OutStream &outStream)
 Protected constructor for pure virtual class. More...
 
- Protected Attributes inherited from TableLogWriter
LogWriteroutputTo_
 
int varCount_
 
char ** varList_
 
char ** unitList_
 
const Unit ** units_
 
unsigned short * uriCodes_
 
bool * isUniversal_
 
int * codeLookup_
 
bool interpolate_
 
FlexArray< const DataEntry ** > interpBuffer_
 
FlexArray< SyslogEntry * > interpSyslogs_
 
FlexArray< Timestamp * > interpTimes_
 
FlexArray< const True * > readerColumn_
 
Timestamp lastTime_
 
bool initializedTableLogWriter_
 
unsigned int slateElementURICount_
 
bool deleteLists_
 
- Protected Attributes inherited from LogWriter
OutStreamlogStream_
 Stores an OutStream. More...
 
bool wroteHeader_
 
bool wroteFooter_
 
Mutex writeMutex_
 
int parentCount_
 
bool active_
 
- Static Protected Attributes inherited from TableLogWriter
static True True_
 

Detailed Description

Defines a LogWriter that can perform lossy decimation on a stream of DataEntries, by outputting values that can be reconstructed via linear interpolation.

The resulting output will have no more error than the specified error limits (using the DataValue's absDiff() function to calculate differences – important in the case of Location values). See:
K. Konstantinides and B. K. Natarajan, “An architecture for lossy compression of waveforms using piecewise linear approximation,” IEEE Trans. Signal Processing, vol. 42, no. 9, pp. 2449-2454, Sept. 1994. (http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=317866)

See TextLogWriter for conversion to text See FileLogWriter for output to the filesystem.

Constructor & Destructor Documentation

LinearApproximationLogWriter::LinearApproximationLogWriter ( LogWriter outputTo,
int  varCount,
char **  varList,
char **  unitList,
float *  approxErrors,
bool  sendAtStartCycle,
bool  makeDirEntries = false 
)

References preInitialize().

LinearApproximationLogWriter::~LinearApproximationLogWriter ( )
virtual
LinearApproximationLogWriter::LinearApproximationLogWriter ( const LinearApproximationLogWriter old)
private

Member Function Documentation

virtual void LinearApproximationLogWriter::config ( Logger logger)
inlinevirtual

Configure from a config file.

Reimplemented from LogWriter.

References LogWriter::config(), and TableLogWriter::outputTo_.

virtual void LinearApproximationLogWriter::endCycle ( )
inlinevirtual

Do what needs to be done at the end of the cycle.

Reimplemented from LogWriter.

References LogWriter::endCycle(), and TableLogWriter::outputTo_.

unsigned int LinearApproximationLogWriter::forceWriteRow ( )
void LinearApproximationLogWriter::preInitialize ( )
private
void LinearApproximationLogWriter::resetDirectoryEntries ( )
unsigned int LinearApproximationLogWriter::writeFooter ( )
virtual

Write the log footer, if any.

Reimplemented from TableLogWriter.

References forceWriteRow().

Referenced by Supervisor::RestartLogs(), and ~LinearApproximationLogWriter().

unsigned int LinearApproximationLogWriter::writeHeader ( )
virtual

Write the log header, if any.

Reimplemented from TableLogWriter.

References TableLogWriter::outputTo_, and LogWriter::writeHeader().

Referenced by Supervisor::RestartLogs().

unsigned int LinearApproximationLogWriter::writeRow ( )
privatevirtual
unsigned int LinearApproximationLogWriter::writeSyslog ( const SyslogEntry syslogEntry)
privatevirtual
unsigned int LinearApproximationLogWriter::writeToColumn ( const DataEntry dataEntry,
const int  column 
)
privatevirtual

Friends And Related Function Documentation

friend class Supervisor
friend

Member Data Documentation

float* LinearApproximationLogWriter::approxErrors_
private
EventEntry LinearApproximationLogWriter::cycleStartEntry_
private

Referenced by writeRow().

DataAccess** LinearApproximationLogWriter::dataAccesses_
private
bool* LinearApproximationLogWriter::dataAccessHidden_
private
FlexArray< int* > LinearApproximationLogWriter::forceWrites_
private
bool LinearApproximationLogWriter::makeDirEntries_
private

Referenced by forceWrite(), sendOutput(), and writeSyslog().

FlexArray< int* > LinearApproximationLogWriter::nameWrites_
private
bool LinearApproximationLogWriter::recentOutput_
private
bool LinearApproximationLogWriter::sendAtStartCycle_
private

Referenced by writeRow().

LinearApproximationLogWriter::VarData** LinearApproximationLogWriter::varData_
private

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