ArffFileSink Class Reference
[Input/Output]

Writes slices to a file in (Weka) ARFF format. More...

#include <ArffFileSink.h>

Inherits Marsyas::MarSystem.


Public Member Functions

 ArffFileSink (const ArffFileSink &a)
 ArffFileSink copy constructor.
 ArffFileSink (std::string name)
 ArffFileSink constructor.
MarSystemclone () const
 Implementation of the MarSystem::clone() method.
void myProcess (realvec &in, realvec &out)
 Implementation of the MarSystem::myProcess method.
 ~ArffFileSink ()
 ArffFileSink destructor.

Private Member Functions

void addControls ()
 Add specific controls needed by this MarSystem.
void closeOutput ()
 Helper function for closing the output (if needed).
void myUpdate (MarControlPtr sender)
 Reads changed controls and sets up variables if necessary.
void prepareOutput ()
 Preparation of the output stream (open file, write header if necessary).
void writeArffHeader ()
 Write ARFF header.

Private Attributes

MarControlPtr ctrl_decimationFactor_
 MarControl for setting the decimation factor for the data writing.
MarControlPtr ctrl_filename_
 MarControl for setting the filename of the file to write to.
MarControlPtr ctrl_floatPrecision_
 MarControl for setting the floating point precision.
mrs_natural decimationCounter
 Internal counter for handling the decimation.
mrs_natural decimationFactor_
 Local cache of the decimation factor for data writing.
mrs_string filename_
 Name of the file we are writing to.
mrs_natural floatPrecision_
 Local cache for the decimal precision to use in the floating point notation.
std::ofstream * os_
 The output stream to write the WEKA ARFF data to.


Detailed Description

Writes slices to a file in (Weka) ARFF format.

ArffFileSink writes the input realvec data it receives to a file in ARFF format (Attribute-Relation File Format). The ARFF format is relatively easy and consists of a simple header, describing the observation channels (called 'attributes' in ARFF), and a straightforward data body.

ARFF files are typically used with the Weka machine learning software.

ArffFileSink is basically a simple rewrite of WekaSink. The problem with WekaSink is that it contains a fair amount of assumptions about the usage and purpose of the generated Weka files, which limits the flexibility of WekaSink. Fixing this in WekaSink without breaking backwards compatibility would be very hard and messy.

See also:
WekaSink
Controls:

Definition at line 55 of file ArffFileSink.h.


Constructor & Destructor Documentation

ArffFileSink ( const ArffFileSink a  ) 

ArffFileSink copy constructor.

All member MarControlPtr have to be explicitly reassigned in the copy constructor.

Definition at line 44 of file ArffFileSink.cpp.

References ArffFileSink::ctrl_decimationFactor_, ArffFileSink::ctrl_filename_, ArffFileSink::ctrl_floatPrecision_, ArffFileSink::decimationCounter, ArffFileSink::filename_, and ArffFileSink::os_.


Member Function Documentation

void addControls (  )  [private]

Add specific controls needed by this MarSystem.

Add any specific controls needed by this MarSystem.

Reimplemented from MarSystem.

Definition at line 70 of file ArffFileSink.cpp.

References ArffFileSink::ctrl_decimationFactor_, ArffFileSink::ctrl_filename_, and ArffFileSink::ctrl_floatPrecision_.

Referenced by ArffFileSink::ArffFileSink().

void myUpdate ( MarControlPtr  sender  )  [private, virtual]

Reads changed controls and sets up variables if necessary.

Use the default MarSystem setup with equal input/output stream format.

Reimplemented from MarSystem.

Definition at line 79 of file ArffFileSink.cpp.

References ArffFileSink::ctrl_decimationFactor_, ArffFileSink::ctrl_floatPrecision_, ArffFileSink::decimationCounter, ArffFileSink::decimationFactor_, and ArffFileSink::floatPrecision_.

void prepareOutput (  )  [private]

Preparation of the output stream (open file, write header if necessary).

Prepare the output stream: open file and write header if needed.

Definition at line 109 of file ArffFileSink.cpp.

References ArffFileSink::closeOutput(), ArffFileSink::ctrl_filename_, ArffFileSink::filename_, ArffFileSink::os_, and ArffFileSink::writeArffHeader().

Referenced by ArffFileSink::myProcess().


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

Generated on Wed May 23 00:02:23 2012 for Marsyas by  doxygen 1.5.6