Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
Public Member Functions | Static Public Member Functions | List of all members
WriteFile Class Reference

Public Member Functions

void setFileType (WriteFileType newFileType)
 
void setEcho (bool newEcho)
 
void setEchoInterval (int newPeriod)
 
void setBufferSize (unsigned int newSize)
 
void setFormat (const char *newFormat)
 
void setHeader (const char *newHeader)
 
void setFooter (const char *newFooter)
 
void log (float value)
 
void log (const float *array, int length)
 
void init (const char *filename, bool overwrite=false)
 
int getOffset ()
 
float getBufferStatus ()
 

Static Public Member Functions

static int getNumInstances ()
 
static void writeAllHeaders ()
 
static void writeAllFooters ()
 
static void writeAllOutputs (bool flush)
 
static void startThread ()
 
static void stopThread ()
 
static void run (void *)
 
static char * generateUniqueFilename (const char *original)
 

Detailed Description

Examples:
logging-sensors/render.cpp.

Member Function Documentation

void WriteFile::setFileType ( WriteFileType  newFileType)

Set the type of file to write, can be either kText or kBinary. Binary files can be imported e.g. in Matlab: fid=fopen('out','r'); A = fread(fid, 'float');

Examples:
logging-sensors/render.cpp.
void WriteFile::setEcho ( bool  newEcho)

Set whether to echo the logged data to the console (according to the EchoInterval set with setEchoInterval()

void WriteFile::setEchoInterval ( int  newPeriod)

Set after how often to log data to the console. The unit of measurement is the number of calls to log().

Examples:
logging-sensors/render.cpp.
void WriteFile::setBufferSize ( unsigned int  newSize)

Set the size of the internal buffer.

A reasonable default value is chosen automatically. However if your often received a "crossed pointer" error, you may want to use this to increase the size of the buffer manually.

void WriteFile::setFormat ( const char *  newFormat)

Set the format that you want to use for your output.

Only f is allowed (with modifiers). When in binary mode, the specified format is used only for echoing to console.

Examples:
logging-sensors/render.cpp.
void WriteFile::setHeader ( const char *  newHeader)

Set one or more lines to be printed at the beginning of the file.

This is ignored in binary mode.

Examples:
logging-sensors/render.cpp.
void WriteFile::setFooter ( const char *  newFooter)

Set one or more lines to be printed at the end of the file.

This is ignored in binary mode.

Examples:
logging-sensors/render.cpp.
void WriteFile::log ( float  value)

Log one value to the file.

Examples:
logging-sensors/render.cpp.
void WriteFile::log ( const float *  array,
int  length 
)

Log multiple values to the file.

void WriteFile::init ( const char *  filename,
bool  overwrite = false 
)

Initialize the file to write to. This has to be called before any other method. If overwrite is false, existing files will not be overwritten and the filename will be automatically incremented.

Examples:
logging-sensors/render.cpp.
int WriteFile::getOffset ( )

Gets the distance between the write and read pointers of the buffer that holds data to be written to disk.

float WriteFile::getBufferStatus ( )

Inquiries the status of the buffer that holds data to be written to disk.

Returns
a value between 0 and 1, with 0 being buffer full (writing to disk not fast enough) and 1 being buffer empty (writing to disk is fast enough).
static char* WriteFile::generateUniqueFilename ( const char *  original)
static

Returns a unique filename by appending a number at the end of the original filename.

Returns
a pointer to the unique filename. This MUST be freed by the invoking function.

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