MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions
MFM::LineTailByteSink< LINES, BYTES_PER_LINE > Class Template Reference

#include <LineTailByteSink.h>

Inheritance diagram for MFM::LineTailByteSink< LINES, BYTES_PER_LINE >:
MFM::ByteSink

Public Member Functions

 LineTailByteSink ()
 
virtual void WriteBytes (const u8 *data, const u32 len)
 
virtual s32 CanWrite ()
 
u32 GetBytesWritten () const
 
u32 GetLines () const
 
const char * GetZString (u32 whichLine)
 
void Trim (u32 lines)
 
void Reset ()
 
- Public Member Functions inherited from MFM::ByteSink
virtual void WriteByte (u8 ch)
 
virtual void WriteNewline ()
 
void Print (const char *str, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (const u8 *str, u32 len, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s32 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u32 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s64 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u64 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u32 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s32 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u64 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s64 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (ByteSerializable &byteSerializble, s32 argument=0)
 
void Println ()
 
void Println (u8 byte)
 
void Println (const char *str)
 
void Println (const u8 *str, u32 len)
 
void Println (s32 decimal)
 
void Println (u32 decimal)
 
void Println (u32 decimal, Format::Type code)
 
void Println (ByteSerializable &byteSerializable, s32 argument=0)
 
void Printf (const char *format,...)
 
void Vprintf (const char *format, va_list &ap)
 

Detailed Description

template<u32 LINES, u32 BYTES_PER_LINE>
class MFM::LineTailByteSink< LINES, BYTES_PER_LINE >

A ByteSink that holds up to LINES lines each of up to BYTES_PER_LINE bytes. Excess bytes written to any given line are discarded as by OverflowableCharBufferByteSink. Once more than LINES lines have been written, the oldest lines are silently discarded to make room.

Constructor & Destructor Documentation

template<u32 LINES, u32 BYTES_PER_LINE>
MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::LineTailByteSink ( )
inline

Constructs a new LineTailByteSink and calls Reset() on it.

Member Function Documentation

template<u32 LINES, u32 BYTES_PER_LINE>
virtual s32 MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::CanWrite ( )
inlinevirtual

Checks to see if bytes may be written to this LineTailByteSink . Since this is backed by an OverflowableCharBufferByteSink array, this may always be written to.

Returns
true .

Implements MFM::ByteSink.

template<u32 LINES, u32 BYTES_PER_LINE>
u32 MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::GetBytesWritten ( ) const
inline

Gets the number of bytes that have been written to this LineTailByteSink .

Returns
The number of bytes that have been written to this LineTailByteSink .
template<u32 LINES, u32 BYTES_PER_LINE>
u32 MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::GetLines ( ) const
inline

Gets the number of lines that have been encountered during the lifetime of this LineTailByteSink .

Returns
The number of lines that have been encountered by this LineTailByteSink, from 1 up to LINES .
template<u32 LINES, u32 BYTES_PER_LINE>
const char* MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::GetZString ( u32  whichLine)
inline

Get the contents of whichLine as a zero-terminated string. If there is (currently) no line whichLine, return NULL Gets the contents of a line held by this LineTailByteSink , where the line at index 0 is the oldest line .

Parameters
whichLinethe index of the line to get from this LineTailByteSink .
Returns
A pointer to the zero-terminated line at whichLine index in this LineTailByteSink .
template<u32 LINES, u32 BYTES_PER_LINE>
void MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::Reset ( )
inline

Clears this LineTailByteSink , as if it is newly constructed .

template<u32 LINES, u32 BYTES_PER_LINE>
void MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::Trim ( u32  lines)
inline

Discard the oldest lines lines, if there are that many, otherwise just do a Reset. Discards a number of old lines inside this LineTailByteSink .

Parameters
linesThe number of lines to discard from this LineTailByteSink . If this is more than the number of lines held , will call Reset() .
template<u32 LINES, u32 BYTES_PER_LINE>
virtual void MFM::LineTailByteSink< LINES, BYTES_PER_LINE >::WriteBytes ( const u8 *  data,
const u32  len 
)
inlinevirtual

Writes a series of bytes to this LineTailByteSink, keeping track of the lines encountered and discarding bytes encountered past the length of a line that is too long.

Parameters
dataA pointer to the bytes to write to this LineTailByteSink .
lenThe number of bytes wished to write to this LineTailByteSink . All len bytes are written before this method returns .

Implements MFM::ByteSink.


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