MAV'RIC
Public Types | Public Member Functions | Protected Attributes
Console< Writeable > Class Template Reference

Class template to write to any write-able module in human-readable format. More...

#include <console.hpp>

Collaboration diagram for Console< Writeable >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Console< Writeable > &(* ConsoleManipulator )(Console< Writeable > &)

Public Member Functions

 Console (Writeable &stream)
 Constructor.
bool write (const uint8_t *data, uint32_t size)
 Write buffer to the console.
bool write (const char *text)
 Write text to the console.
bool writeln (const char *text)
 Write text to the console, append newline ('
') and flush the stream.
bool write (bool value)
 Write bool to the console ("true"/"false")
template<typename T >
bool write (T number)
 Write integer number to the console.
bool write (float number, uint8_t after_digits=3)
 Write floating point to the console (wrapper for write_floating(..))
bool write (double number, uint8_t after_digits=3)
 Write floating point to the console (wrapper for write_floating(..))
template<typename T >
bool write_floating (T number, uint8_t after_digits=3)
 Write floating point to the console.
void flush ()
 Flushes the buffer of the console.
void newline ()
 write newline character to stream
template<typename T >
Console< Writeable > & operator<< (const T &data)
 operator to print like cout: console << "hello"; calls write(data)
Console< Writeable > & operator<< (ConsoleManipulator manip)
 applies the function pointed to by the argument and executes it with this as argument operator overload to work with endl function pointer
Writeable * get_stream ()
 Returns a pointer to writeable.

Protected Attributes

Writeable & stream_

Detailed Description

template<typename Writeable>
class Console< Writeable >

Class template to write to any write-able module in human-readable format.


Member Function Documentation

template<typename Writeable >
void Console< Writeable >::flush ( void  )

Flushes the buffer of the console.

Returns:
success
template<typename Writeable >
Writeable * Console< Writeable >::get_stream ( )

Returns a pointer to writeable.

Returns:
writeable

Here is the caller graph for this function:

template<typename Writeable >
void Console< Writeable >::newline ( )

write newline character to stream

Returns:
success
template<typename Writeable >
template<typename T >
Console< Writeable > & Console< Writeable >::operator<< ( const T &  data)

operator to print like cout: console << "hello"; calls write(data)

Parameters:
datadata to be printed
Returns:
success
template<typename Writeable >
Console< Writeable > & Console< Writeable >::operator<< ( ConsoleManipulator  manip)

applies the function pointed to by the argument and executes it with this as argument operator overload to work with endl function pointer

Parameters:
pointerto the function to be executed
Returns:
return itself (*this)
template<typename Writeable >
bool Console< Writeable >::write ( const uint8_t *  data,
uint32_t  size 
)

Write buffer to the console.

Parameters:
dataThe buffer to write.
sizeThe number of bytes to write.
Returns:
success
template<typename Writeable >
bool Console< Writeable >::write ( const char *  text)

Write text to the console.

Parameters:
textText to write to console
Returns:
success
template<typename Writeable >
bool Console< Writeable >::write ( bool  value)

Write bool to the console ("true"/"false")

Parameters:
valueboolean value to be evaluated
Returns:
success
template<typename Writeable >
template<typename T >
bool Console< Writeable >::write ( number)

Write integer number to the console.

Parameters:
numberinteger number (uintX_t/intX_t)
Returns:
success
template<typename Writeable >
bool Console< Writeable >::write ( float  number,
uint8_t  after_digits = 3 
)

Write floating point to the console (wrapper for write_floating(..))

Parameters:
number
Returns:
success
Parameters:
number
after_digitsdigits after decimal point
Returns:
success
template<typename Writeable >
bool Console< Writeable >::write ( double  number,
uint8_t  after_digits = 3 
)

Write floating point to the console (wrapper for write_floating(..))

Parameters:
number
after_digitsdigits after decimal point
Returns:
success
template<typename Writeable >
template<typename T >
bool Console< Writeable >::write_floating ( num,
uint8_t  after_digits = 3 
)

Write floating point to the console.

Parameters:
numberfloating point number (float/double)
after_digitsnumber of digits after decimal point
Returns:
success
template<typename Writeable >
bool Console< Writeable >::writeln ( const char *  text)

Write text to the console, append newline ('
') and flush the stream.

Parameters:
textText to write to console
Returns:
success

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines