From 6697e2eb7208c0c22c27ac12e8c2298c8f85e1ca Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Mon, 26 Aug 2024 10:41:57 +0200 Subject: [PATCH] Protobuf: Remove include dependency on generated header This allows easier reuse of ProtobufFormat. Signed-off-by: Niklas Eiling --- include/villas/formats/protobuf.hpp | 8 -------- lib/formats/protobuf.cpp | 5 ++++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/villas/formats/protobuf.hpp b/include/villas/formats/protobuf.hpp index 9b33bee5d..ee7e3804a 100644 --- a/include/villas/formats/protobuf.hpp +++ b/include/villas/formats/protobuf.hpp @@ -7,13 +7,8 @@ #pragma once -#include - #include -// Generated message descriptors by protoc -#include - namespace villas { namespace node { @@ -22,9 +17,6 @@ struct Sample; class ProtobufFormat : public BinaryFormat { -protected: - enum SignalType detect(const Villas__Node__Value *val); - public: using BinaryFormat::BinaryFormat; diff --git a/lib/formats/protobuf.cpp b/lib/formats/protobuf.cpp index 5000fbb9c..c34913bcc 100644 --- a/lib/formats/protobuf.cpp +++ b/lib/formats/protobuf.cpp @@ -11,9 +11,12 @@ #include #include +// Generated message descriptors by protoc +#include + using namespace villas::node; -enum SignalType ProtobufFormat::detect(const Villas__Node__Value *val) { +static enum SignalType detect(const Villas__Node__Value *val) { switch (val->value_case) { case VILLAS__NODE__VALUE__VALUE_F: return SignalType::FLOAT;