24#ifndef COMM_BUFFERS_H_
25#define COMM_BUFFERS_H_
33typedef unsigned __int8 uint8_t;
42 void Put(
const std::string line);
48 bool Get(std::string& line);
51 std::deque<std::string> m_buffer;
67 LineBuffer() : m_line_count(0), m_last_ch(
'\n') {}
70 std::vector<uint8_t> m_buff;
93 std::deque<std::string> m_lines;
94 std::vector<uint8_t> m_line;
95 enum class State { PrefixWait, Data, CsDigit1, CsDigit2 } m_state;
Assembles input characters to lines.
void Put(uint8_t ch)
Add a single character.
std::vector< uint8_t > GetLine()
Retrieve a line from buffer, return empty line if none available.
bool HasLine() const
Return true if a line is available to be returned by GetLine().
Assemble characters to NMEA0183 sentences.
bool HasSentence() const
Return true if a sentence is available to be returned by GetSentence()
std::string GetSentence()
Retrieve a sentence from buffer.
void Put(uint8_t ch)
Add a single character, possibly making a sentence available.
Synchronized buffer for outbound, line oriented data.
void Put(const std::string line)
Insert line in buffer.
bool Get(std::string &line)
Retrieve a line in buffer.