Shellminator V3.0.1
Simple Terminal
Loading...
Searching...
No Matches
ShellminatorBufferedPrinter Class Reference

ShellminatorBufferedPrinter object. More...

#include <Shellminator-BufferedPrinter.hpp>

Inheritance diagram for ShellminatorBufferedPrinter:
Collaboration diagram for ShellminatorBufferedPrinter:

Public Member Functions

 ShellminatorBufferedPrinter ()
 Empty constructor. More...
 
 ShellminatorBufferedPrinter (Stream *channel_p, uint8_t *buffer_p, int bufferSize_p)
 Stream specific constructor. More...
 
int available () override
 Available bytes in the channel. More...
 
int read () override
 Read one byte form the channel. More...
 
int peek () override
 Peek the firtst byte from the channel. More...
 
void flush () override
 Flush the channel. More...
 
size_t write (uint8_t b) override
 Write one byte to the channel. More...
 
size_t write (const uint8_t *data, size_t size) override
 

Private Member Functions

void clearBuffer ()
 Clear the internal buffer. More...
 

Private Attributes

Stream * channel = NULL
 
uint8_t * buffer = NULL
 
int bufferPointer = 0
 
int bufferSize = 0
 

Friends

class ShellminatorBufferedPrinterUT
 

Detailed Description

ShellminatorBufferedPrinter object.

It can be used to accelerate the rendering process on the host terminal interface. Terminal emulators usually works faster, when the data arrives in one large piece. Otherwise some annoying effect can be observed like flickering or cursor jumping. This object aims to fix this problem. It is a simple buffered printer.

Definition at line 60 of file Shellminator-BufferedPrinter.hpp.

Constructor & Destructor Documentation

◆ ShellminatorBufferedPrinter() [1/2]

ShellminatorBufferedPrinter::ShellminatorBufferedPrinter ( )

Empty constructor.

This is a simple, empty constructor.

Definition at line 36 of file Shellminator-BufferedPrinter.cpp.

◆ ShellminatorBufferedPrinter() [2/2]

ShellminatorBufferedPrinter::ShellminatorBufferedPrinter ( Stream *  channel_p,
uint8_t *  buffer_p,
int  bufferSize_p 
)

Stream specific constructor.

With this constructor, you can specify the Stream object.

Parameters
channel_pPointer to a Stream object. This object will be used as output.

Definition at line 44 of file Shellminator-BufferedPrinter.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ available()

int ShellminatorBufferedPrinter::available ( )
override

Available bytes in the channel.

Returns
The available bytes in the channel.

Definition at line 55 of file Shellminator-BufferedPrinter.cpp.

◆ clearBuffer()

void ShellminatorBufferedPrinter::clearBuffer ( )
private

Clear the internal buffer.

This value sets all of the elements in the internal buffer to '\0'.

Note
It only works, if the memory allocation is done.

Definition at line 67 of file Shellminator-BufferedPrinter.cpp.

Here is the caller graph for this function:

◆ flush()

void ShellminatorBufferedPrinter::flush ( )
override

Flush the channel.

Definition at line 75 of file Shellminator-BufferedPrinter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peek()

int ShellminatorBufferedPrinter::peek ( )
override

Peek the firtst byte from the channel.

Returns
Read and return one byte form the channel. The byte will NOT be removed from the channel.

Definition at line 63 of file Shellminator-BufferedPrinter.cpp.

◆ read()

int ShellminatorBufferedPrinter::read ( )
override

Read one byte form the channel.

Returns
Read and return one byte form the channel. The byte will be removed from the channel.

Definition at line 59 of file Shellminator-BufferedPrinter.cpp.

◆ write() [1/2]

size_t ShellminatorBufferedPrinter::write ( const uint8_t *  data,
size_t  size 
)
override

Definition at line 121 of file Shellminator-BufferedPrinter.cpp.

Here is the call graph for this function:

◆ write() [2/2]

size_t ShellminatorBufferedPrinter::write ( uint8_t  b)
override

Write one byte to the channel.

Parameters
bThe value that has to be written to the channel.
Returns
The number of bytes that has been successfully written to the channel. Because it is the base class, it returns 0.

Definition at line 93 of file Shellminator-BufferedPrinter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ShellminatorBufferedPrinterUT

friend class ShellminatorBufferedPrinterUT
friend

Definition at line 118 of file Shellminator-BufferedPrinter.hpp.

Member Data Documentation

◆ buffer

uint8_t* ShellminatorBufferedPrinter::buffer = NULL
private

Definition at line 112 of file Shellminator-BufferedPrinter.hpp.

◆ bufferPointer

int ShellminatorBufferedPrinter::bufferPointer = 0
private

Definition at line 113 of file Shellminator-BufferedPrinter.hpp.

◆ bufferSize

int ShellminatorBufferedPrinter::bufferSize = 0
private

Definition at line 115 of file Shellminator-BufferedPrinter.hpp.

◆ channel

Stream* ShellminatorBufferedPrinter::channel = NULL
private

Definition at line 110 of file Shellminator-BufferedPrinter.hpp.