OpenMPTL - Helper Library
C++ Microprocessor Template Library
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
mptl::terminal< Tp, _terminal_echo > Class Template Reference

Simple vt100-like terminal. More...

#include <terminal.hpp>

Public Types

using stream_device_type = Tp
 
using char_type = typename stream_device_type::fifo_type::char_type
 
using tx_stream_type = fifo_stream< typename stream_device_type::fifo_type, stream_device_type >
 
using resources = typename stream_device_type::resources
 

Public Member Functions

 terminal ()
 
void open () const
 
void close ()
 
template<typename cmd_hooks >
void process_input (void)
 

Public Attributes

tx_stream_type tx_stream
 

Static Public Attributes

static constexpr bool terminal_echo = _terminal_echo
 
static constexpr const char * newline = "\r\n"
 
static constexpr const char * prompt = "# "
 
static constexpr std::size_t cmd_buf_size = 80
 

Detailed Description

template<typename Tp, bool _terminal_echo = true>
class mptl::terminal< Tp, _terminal_echo >

Parses and executes commands from mptl::terminal_hook_list<...>, and accepts simple single-word commands (see process_input()).

Operates on mptl::fifo_stream<> for input/output, and provides a very basic stream interface from poorman::ostream<>:

mptl::terminal<...> term;
term.tx_stream << "hello, var=" << myvar << poorman::endl;

Template arguments:

Member Typedef Documentation

◆ char_type

template<typename Tp , bool _terminal_echo = true>
using mptl::terminal< Tp, _terminal_echo >::char_type = typename stream_device_type::fifo_type::char_type

◆ resources

template<typename Tp , bool _terminal_echo = true>
using mptl::terminal< Tp, _terminal_echo >::resources = typename stream_device_type::resources

◆ stream_device_type

template<typename Tp , bool _terminal_echo = true>
using mptl::terminal< Tp, _terminal_echo >::stream_device_type = Tp

◆ tx_stream_type

template<typename Tp , bool _terminal_echo = true>
using mptl::terminal< Tp, _terminal_echo >::tx_stream_type = fifo_stream< typename stream_device_type::fifo_type, stream_device_type >

Constructor & Destructor Documentation

◆ terminal()

template<typename Tp , bool _terminal_echo = true>
mptl::terminal< Tp, _terminal_echo >::terminal ( )
inline

Member Function Documentation

◆ close()

template<typename Tp , bool _terminal_echo = true>
void mptl::terminal< Tp, _terminal_echo >::close ( )
inline

◆ open()

template<typename Tp , bool _terminal_echo = true>
void mptl::terminal< Tp, _terminal_echo >::open ( ) const
inline

◆ process_input()

template<typename Tp , bool _terminal_echo = true>
template<typename cmd_hooks >
void mptl::terminal< Tp, _terminal_echo >::process_input ( void  )
inline

Member Data Documentation

◆ cmd_buf_size

template<typename Tp , bool _terminal_echo = true>
constexpr std::size_t mptl::terminal< Tp, _terminal_echo >::cmd_buf_size = 80
static

◆ newline

template<typename Tp , bool _terminal_echo = true>
constexpr const char* mptl::terminal< Tp, _terminal_echo >::newline = "\r\n"
static

◆ prompt

template<typename Tp , bool _terminal_echo = true>
constexpr const char* mptl::terminal< Tp, _terminal_echo >::prompt = "# "
static

◆ terminal_echo

template<typename Tp , bool _terminal_echo = true>
constexpr bool mptl::terminal< Tp, _terminal_echo >::terminal_echo = _terminal_echo
static

◆ tx_stream

template<typename Tp , bool _terminal_echo = true>
tx_stream_type mptl::terminal< Tp, _terminal_echo >::tx_stream

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