wip: log protocol collapse v1

we do not currently plan to have a v2 anytime soon. Lets just merge the v1
namespace into the main one.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/851/head
Gergely Nagy 4 years ago
parent 3716ea4ab2
commit ab12556f8b
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -49,12 +49,9 @@ namespace kaleidoscope {
namespace simulator { namespace simulator {
namespace log_protocol { namespace log_protocol {
namespace v1 {
class Parser; class Parser;
class CompressionConsumer;
}
class Consumer_; class Consumer_;
class CompressionConsumer;
class LogProtocol { class LogProtocol {
@ -89,8 +86,8 @@ class LogProtocol {
uint8_t output_document_type_ = DocumentType::compressed; uint8_t output_document_type_ = DocumentType::compressed;
bool quote_lines_ = false; bool quote_lines_ = false;
friend class v1::Parser; friend class Parser;
friend class v1::CompressionConsumer; friend class CompressionConsumer;
}; };
} // namespace log_protocol } // namespace log_protocol

@ -79,7 +79,6 @@
namespace kaleidoscope { namespace kaleidoscope {
namespace simulator { namespace simulator {
namespace log_protocol { namespace log_protocol {
namespace v1 {
#define PROTOCOL_V1_COMMANDS(OP, SEP, TERM_SEP) \ #define PROTOCOL_V1_COMMANDS(OP, SEP, TERM_SEP) \
OP(none, 0)SEP \ OP(none, 0)SEP \
@ -113,7 +112,6 @@ constexpr uint8_t protocol_version = 1;
constexpr char comment_symbol = '#'; constexpr char comment_symbol = '#';
} // namespace v1
} // namespace log_protocol } // namespace log_protocol
} // namespace simulator } // namespace simulator
} // namespace kaleidoscope } // namespace kaleidoscope

@ -19,7 +19,7 @@
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD #ifdef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/simulator/LogProtocol.h" #include "kaleidoscope/simulator/LogProtocol.h"
#include "kaleidoscope/simulator/log_protocol/v1/Parser.h" #include "kaleidoscope/simulator/log_protocol/Parser.h"
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
@ -69,7 +69,7 @@ void LogProtocol::parse(std::istream &in, Consumer_ &consumer) {
switch (protocol_version_) { switch (protocol_version_) {
case 1: { case 1: {
LOG_PROTOCOL_DEBUG("Delegating to v1 parser") LOG_PROTOCOL_DEBUG("Delegating to v1 parser")
v1::Parser delegate_parser(*this, document_type_, line_id_); Parser delegate_parser(*this, document_type_, line_id_);
delegate_parser.parse(in, consumer); delegate_parser.parse(in, consumer);
} }
} }
@ -105,7 +105,7 @@ void LogProtocol::compress(std::istream &in, std::ostream &out) {
LOG_PROTOCOL_DEBUG("Delegating to v1 parser") LOG_PROTOCOL_DEBUG("Delegating to v1 parser")
LOG_PROTOCOL_DEBUG("debug: " << debug_) LOG_PROTOCOL_DEBUG("debug: " << debug_)
LOG_PROTOCOL_DEBUG("output document type: " << (int)output_document_type_) LOG_PROTOCOL_DEBUG("output document type: " << (int)output_document_type_)
v1::Parser delegate_parser(*this, document_type_, line_id_); Parser delegate_parser(*this, document_type_, line_id_);
delegate_parser.compress(in, out); delegate_parser.compress(in, out);
} }
} }

@ -19,8 +19,8 @@
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD #ifdef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/simulator/log_protocol/Consumer_.h" #include "kaleidoscope/simulator/log_protocol/Consumer_.h"
#include "kaleidoscope/simulator/log_protocol/v1/Parser.h" #include "kaleidoscope/simulator/log_protocol/Parser.h"
#include "kaleidoscope/simulator/log_protocol/v1/Grammar.h" #include "kaleidoscope/simulator/log_protocol/Grammar.h"
#include <vector> #include <vector>
#include <map> #include <map>
@ -38,7 +38,6 @@
namespace kaleidoscope { namespace kaleidoscope {
namespace simulator { namespace simulator {
namespace log_protocol { namespace log_protocol {
namespace v1 {
#define COMMA , #define COMMA ,
@ -650,7 +649,6 @@ void Parser::compress(std::istream &in, std::ostream &out) {
this->parse(in, cc); this->parse(in, cc);
} }
} // namespace V1
} // namespace log_protocol } // namespace log_protocol
} // namespace simulator } // namespace simulator
} // namespace kaleidoscope } // namespace kaleidoscope

@ -20,7 +20,7 @@
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD #ifdef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/simulator/log_protocol/v1/Grammar.h" #include "kaleidoscope/simulator/log_protocol/Grammar.h"
#include <string> #include <string>
#include <istream> #include <istream>
@ -31,13 +31,9 @@ namespace log_protocol {
class Consumer_; class Consumer_;
namespace v1 {
class Parser { class Parser {
public: public:
static constexpr uint8_t protocol_version = log_protocol::protocol_version;
static constexpr uint8_t protocol_version = log_protocol::v1::protocol_version;
Parser(const LogProtocol &protocol, uint8_t input_document_type, int start_line_id) Parser(const LogProtocol &protocol, uint8_t input_document_type, int start_line_id)
: protocol_{protocol}, : protocol_{protocol},
@ -81,7 +77,6 @@ class Parser {
friend class CompressionConsumer; friend class CompressionConsumer;
}; };
} // namespace V1
} // namespace log_protocol } // namespace log_protocol
} // namespace simulator } // namespace simulator
} // namespace kaleidoscope } // namespace kaleidoscope
Loading…
Cancel
Save