LRAUV  revA
LinearApproxLogWriter 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 <LinearApproxLogWriter.h>

Inheritance diagram for LinearApproxLogWriter:
Collaboration diagram for LinearApproxLogWriter:

Classes

class  VarData
 

Public Member Functions

 LinearApproxLogWriter (LogWriter &outputTo, const Str &varName, DataValue *approxErrorValue, bool makeDirEntries, Logger &logger)
 
virtual ~LinearApproxLogWriter ()
 
virtual unsigned int write (const LogEntry *entry, const Unit *unit=NULL)
 Write an entry to the text log. More...
 
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...
 
virtual void setParameter (DataValue *approxError, Logger &logger)
 
virtual unsigned int flush ()
 
- Public Member Functions inherited from DecimationLogWriter
 DecimationLogWriter (LogWriter &outputTo, DecimationType decimationType)
 Constructor. More...
 
virtual ~DecimationLogWriter ()
 Destructor. More...
 
DecimationType getDecimationType () const
 
- 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 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 ()
 

Private Member Functions

 LinearApproxLogWriter (const LinearApproxLogWriter &old)
 
unsigned int sendOutput (DataEntry *dataEntry)
 

Private Attributes

const Str varName_
 
DataValueapproxErrorValue_
 
LinearApproxLogWriter::VarDatavarData_
 
EventEntry cycleStartEntry_
 
Timestamp lastTime_
 

Friends

class Supervisor
 

Additional Inherited Members

- Public Types inherited from DecimationLogWriter
enum  DecimationType {
  UNDEFINED_DECIMATION = -1, NO_DECIMATION, ALL_DATA, LINEAR_APPROXIMATION,
  MOST_RECENT, DECIMATION_COUNT, DECIMATION_MULTI
}
 
- 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 DecimationLogWriter
static const char * DecimationType2Str (DecimationLogWriter::DecimationType decimationType)
 
static DecimationType Str2DecimationType (const char *const typeStr, int len=-1)
 
- 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 DecimationLogWriter
static const char *const DECIMATION_TYPE_STRS [DECIMATION_COUNT]
 
static const size_t DECIMATION_TYPE_STRLEN [DECIMATION_COUNT]
 
- 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...
 
- Protected Attributes inherited from DecimationLogWriter
LogWriteroutputTo_
 Stores an LogWriter. More...
 
DecimationType decimationType_
 Stores the decimationType. More...
 
- Protected Attributes inherited from LogWriter
OutStreamlogStream_
 Stores an OutStream. More...
 
bool wroteHeader_
 
bool wroteFooter_
 
Mutex writeMutex_
 
int parentCount_
 
bool active_
 

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

LinearApproxLogWriter::LinearApproxLogWriter ( LogWriter outputTo,
const Str varName,
DataValue approxErrorValue,
bool  makeDirEntries,
Logger logger 
)
LinearApproxLogWriter::~LinearApproxLogWriter ( )
virtual
LinearApproxLogWriter::LinearApproxLogWriter ( const LinearApproxLogWriter old)
private

Member Function Documentation

virtual void LinearApproxLogWriter::config ( Logger logger)
inlinevirtual

Configure from a config file.

Reimplemented from LogWriter.

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

virtual void LinearApproxLogWriter::endCycle ( )
inlinevirtual

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

Reimplemented from LogWriter.

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

unsigned int LinearApproxLogWriter::sendOutput ( DataEntry dataEntry)
private

References DecimationLogWriter::outputTo_, and LogWriter::write().

Referenced by flush(), and write().

void LinearApproxLogWriter::setParameter ( DataValue approxError,
Logger logger 
)
virtual
unsigned int LinearApproxLogWriter::writeFooter ( )
virtual

Write the log footer, if any.

Reimplemented from LogWriter.

References flush().

Referenced by ~LinearApproxLogWriter().

unsigned int LinearApproxLogWriter::writeHeader ( )
virtual

Write the log header, if any.

Reimplemented from LogWriter.

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

Friends And Related Function Documentation

friend class Supervisor
friend

Member Data Documentation

DataValue* LinearApproxLogWriter::approxErrorValue_
private
EventEntry LinearApproxLogWriter::cycleStartEntry_
private
Timestamp LinearApproxLogWriter::lastTime_
private
LinearApproxLogWriter::VarData* LinearApproxLogWriter::varData_
private
const Str LinearApproxLogWriter::varName_
private

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