SdFat
Public Member Functions | List of all members
BufferedPrint< WriteClass, BUF_DIM > Class Template Reference

Fast buffered print template. More...

#include <BufferedPrint.h>

Public Member Functions

void begin (WriteClass *wr)
 
 BufferedPrint (WriteClass *wr)
 
void flush ()
 
size_t print (double d, uint8_t prec=2)
 
size_t print (float f, uint8_t prec=2)
 
template<typename Type >
size_t print (Type v)
 
size_t printField (char c, char term)
 
size_t printField (const __FlashStringHelper *fsh, char term)
 
size_t printField (const char *str, char term)
 
size_t printField (double d, char term, uint8_t prec=2)
 
size_t printField (float f, char term, uint8_t prec=2)
 
template<typename Type >
size_t printField (Type n, char term)
 
size_t println ()
 
size_t println (double d, uint8_t prec=2)
 
size_t println (float f, uint8_t prec)
 
template<typename Type >
size_t println (Type v)
 
bool sync ()
 
size_t write (const void *src, size_t n)
 

Detailed Description

template<typename WriteClass, uint8_t BUF_DIM>
class BufferedPrint< WriteClass, BUF_DIM >

Fast buffered print template.

Constructor & Destructor Documentation

◆ BufferedPrint()

template<typename WriteClass , uint8_t BUF_DIM>
BufferedPrint< WriteClass, BUF_DIM >::BufferedPrint ( WriteClass *  wr)
inlineexplicit

BufferedPrint constructor.

Parameters
[in]wrPrint destination.

Member Function Documentation

◆ begin()

template<typename WriteClass , uint8_t BUF_DIM>
void BufferedPrint< WriteClass, BUF_DIM >::begin ( WriteClass *  wr)
inline

Initialize the BuffedPrint class.

Parameters
[in]wrPrint destination.

◆ flush()

template<typename WriteClass , uint8_t BUF_DIM>
void BufferedPrint< WriteClass, BUF_DIM >::flush ( )
inline

Flush the buffer - same as sync() with no status return.

◆ print() [1/3]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::print ( double  d,
uint8_t  prec = 2 
)
inline

Print a double.

Parameters
[in]dThe number to be printed.
[in]precNumber of digits after decimal point.
Returns
true for success or false if an error occurs.

◆ print() [2/3]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::print ( float  f,
uint8_t  prec = 2 
)
inline

Print a float.

Parameters
[in]fThe number to be printed.
[in]precNumber of digits after decimal point.
Returns
true for success or false if an error occurs.

◆ print() [3/3]

template<typename WriteClass , uint8_t BUF_DIM>
template<typename Type >
size_t BufferedPrint< WriteClass, BUF_DIM >::print ( Type  v)
inline

Print character, string, or number.

Parameters
[in]vitem to print.
Returns
true for success or false if an error occurs.

◆ printField() [1/6]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::printField ( char  c,
char  term 
)
inline

Print a character followed by a field terminator.

Parameters
[in]ccharacter to print.
[in]termThe field terminator. Use '\n' for CR LF.
Returns
true for success or false if an error occurs.

◆ printField() [2/6]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::printField ( const __FlashStringHelper *  fsh,
char  term 
)
inline

Print a string stored in AVR flash followed by a field terminator.

Parameters
[in]fshstring to print.
[in]termThe field terminator. Use '\n' for CR LF.
Returns
true for success or false if an error occurs.

◆ printField() [3/6]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::printField ( const char *  str,
char  term 
)
inline

Print a string followed by a field terminator.

Parameters
[in]strstring to print.
[in]termThe field terminator. Use '\n' for CR LF.
Returns
true for success or false if an error occurs.

◆ printField() [4/6]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::printField ( double  d,
char  term,
uint8_t  prec = 2 
)
inline

Print a double followed by a field terminator.

Parameters
[in]dThe number to be printed.
[in]termThe field terminator. Use '\n' for CR LF.
[in]precNumber of digits after decimal point.
Returns
true for success or false if an error occurs.

◆ printField() [5/6]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::printField ( float  f,
char  term,
uint8_t  prec = 2 
)
inline

Print a float followed by a field terminator.

Parameters
[in]fThe number to be printed.
[in]termThe field terminator. Use '\n' for CR LF.
[in]precNumber of digits after decimal point.
Returns
true for success or false if an error occurs.

◆ printField() [6/6]

template<typename WriteClass , uint8_t BUF_DIM>
template<typename Type >
size_t BufferedPrint< WriteClass, BUF_DIM >::printField ( Type  n,
char  term 
)
inline

Print an integer value for 8, 16, and 32 bit signed and unsigned types.

Parameters
[in]nThe value to print.
[in]termThe field terminator. Use '\n' for CR LF.
Returns
true for success or false if an error occurs.

◆ println() [1/4]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::println ( )
inline

Print CR LF.

Returns
true for success or false if an error occurs.

◆ println() [2/4]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::println ( double  d,
uint8_t  prec = 2 
)
inline

Print a double followed by CR LF.

Parameters
[in]dThe number to be printed.
[in]precNumber of digits after decimal point.
Returns
true for success or false if an error occurs.

◆ println() [3/4]

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::println ( float  f,
uint8_t  prec 
)
inline

Print a float followed by CR LF.

Parameters
[in]fThe number to be printed.
[in]precNumber of digits after decimal point.
Returns
true for success or false if an error occurs.

◆ println() [4/4]

template<typename WriteClass , uint8_t BUF_DIM>
template<typename Type >
size_t BufferedPrint< WriteClass, BUF_DIM >::println ( Type  v)
inline

Print character, string, or number followed by CR LF.

Parameters
[in]vitem to print.
Returns
true for success or false if an error occurs.

◆ sync()

template<typename WriteClass , uint8_t BUF_DIM>
bool BufferedPrint< WriteClass, BUF_DIM >::sync ( )
inline

Flush the buffer.

Returns
true for success or false if an error occurs.

◆ write()

template<typename WriteClass , uint8_t BUF_DIM>
size_t BufferedPrint< WriteClass, BUF_DIM >::write ( const void *  src,
size_t  n 
)
inline

Write data to an open file.

Parameters
[in]srcPointer to the location of the data to be written.
[in]nNumber of bytes to write.
Returns
For success write() returns the number of bytes written, always n.

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