From 499fe538a25b954b8447bdaf832961bbd48e2526 Mon Sep 17 00:00:00 2001 From: Christian Berger Date: Sun, 3 Mar 2019 20:05:13 +0100 Subject: [PATCH] * Updated libcluon Signed-off-by: Christian Berger --- cluon-complete-v0.0.121.hpp | 214 ++++++++++++++++++++++++++++++++++-- 1 file changed, 202 insertions(+), 12 deletions(-) diff --git a/cluon-complete-v0.0.121.hpp b/cluon-complete-v0.0.121.hpp index 0d1ead7..192b627 100644 --- a/cluon-complete-v0.0.121.hpp +++ b/cluon-complete-v0.0.121.hpp @@ -1,6 +1,6 @@ // This is an auto-generated header-only single-file distribution of libcluon. -// Date: Thu, 07 Feb 2019 22:42:31 +0100 -// Version: 0.0.120 +// Date: Sun, 03 Mar 2019 20:03:13 +0100 +// Version: 0.0.121 // // // Implementation of N4562 std::experimental::any (merged into C++17) for C++11 compilers. @@ -5120,6 +5120,194 @@ struct isTripletForwardVisitable { }; #endif + +/* + * THIS IS AN AUTO-GENERATED FILE. DO NOT MODIFY AS CHANGES MIGHT BE OVERWRITTEN! + */ + +#ifndef VISITABLE_TYPE_TRAIT +#define VISITABLE_TYPE_TRAIT +#include +#include +#include + +template +struct visitorSelector { + template + static void impl(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, Visitor &visitor) { + visitor.visit(fieldIdentifier, std::move(typeName), std::move(name), value); + } +}; + +template<> +struct visitorSelector { + template + static void impl(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, Visitor &visitor) { + visitor.visit(fieldIdentifier, std::move(typeName), std::move(name), value); + } +}; + +template +struct isVisitable { + static const bool value = false; +}; + +template +void doVisit(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, Visitor &visitor) { + visitorSelector::value >::impl(fieldIdentifier, std::move(typeName), std::move(name), value, visitor); +} +#endif + +#ifndef TRIPLET_FORWARD_VISITABLE_TYPE_TRAIT +#define TRIPLET_FORWARD_VISITABLE_TYPE_TRAIT +#include +#include +#include + +template +struct tripletForwardVisitorSelector { + template + static void impl(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, PreVisitor &&preVisit, Visitor &&visit, PostVisitor &&postVisit) { + (void)preVisit; + (void)postVisit; + std::forward(visit)(fieldIdentifier, std::move(typeName), std::move(name), value); + } +}; + +template<> +struct tripletForwardVisitorSelector { + template + static void impl(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, PreVisitor &&preVisit, Visitor &&visit, PostVisitor &&postVisit) { + (void)fieldIdentifier; + (void)typeName; + (void)name; + // Apply preVisit, visit, and postVisit on value. + value.accept(preVisit, visit, postVisit); + } +}; + +template +struct isTripletForwardVisitable { + static const bool value = false; +}; + +template< typename T, class PreVisitor, class Visitor, class PostVisitor> +void doTripletForwardVisit(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, PreVisitor &&preVisit, Visitor &&visit, PostVisitor &&postVisit) { + tripletForwardVisitorSelector::value >::impl(fieldIdentifier, std::move(typeName), std::move(name), value, std::move(preVisit), std::move(visit), std::move(postVisit)); // NOLINT +} +#endif + + +#ifndef CLUON_DATA_RECORDERCOMMAND_HPP +#define CLUON_DATA_RECORDERCOMMAND_HPP + +#ifdef WIN32 + // Export symbols if compile flags "LIB_SHARED" and "LIB_EXPORTS" are set on Windows. + #ifdef LIB_SHARED + #ifdef LIB_EXPORTS + #define LIB_API __declspec(dllexport) + #else + #define LIB_API __declspec(dllimport) + #endif + #else + // Disable definition if linking statically. + #define LIB_API + #endif +#else + // Disable definition for non-Win32 systems. + #define LIB_API +#endif + +#include +#include +namespace cluon { namespace data { +using namespace std::string_literals; // NOLINT +class LIB_API RecorderCommand { + private: + static constexpr const char* TheShortName = "RecorderCommand"; + static constexpr const char* TheLongName = "cluon.data.RecorderCommand"; + + public: + inline static int32_t ID() { + return 11; + } + inline static const std::string ShortName() { + return TheShortName; + } + inline static const std::string LongName() { + return TheLongName; + } + + public: + RecorderCommand() = default; + RecorderCommand(const RecorderCommand&) = default; + RecorderCommand& operator=(const RecorderCommand&) = default; + RecorderCommand(RecorderCommand&&) = default; + RecorderCommand& operator=(RecorderCommand&&) = default; + ~RecorderCommand() = default; + + public: + + inline RecorderCommand& command(const uint8_t &v) noexcept { + m_command = v; + return *this; + } + inline uint8_t command() const noexcept { + return m_command; + } + + + public: + template + inline void accept(uint32_t fieldId, Visitor &visitor) { + (void)fieldId; + (void)visitor; +// visitor.preVisit(ID(), ShortName(), LongName()); + + if (1 == fieldId) { + doVisit(1, std::move("uint8_t"s), std::move("command"s), m_command, visitor); + return; + } + +// visitor.postVisit(); + } + + template + inline void accept(Visitor &visitor) { + visitor.preVisit(ID(), ShortName(), LongName()); + + doVisit(1, std::move("uint8_t"s), std::move("command"s), m_command, visitor); + + visitor.postVisit(); + } + + template + inline void accept(PreVisitor &&preVisit, Visitor &&visit, PostVisitor &&postVisit) { + (void)visit; // Prevent warnings from empty messages. + std::forward(preVisit)(ID(), ShortName(), LongName()); + + doTripletForwardVisit(1, std::move("uint8_t"s), std::move("command"s), m_command, preVisit, visit, postVisit); + + std::forward(postVisit)(); + } + + private: + + uint8_t m_command{ 0 }; // field identifier = 1. + +}; +}} + +template<> +struct isVisitable { + static const bool value = true; +}; +template<> +struct isTripletForwardVisitable { + static const bool value = true; +}; +#endif + /* * MIT License * @@ -17543,21 +17731,23 @@ inline int32_t cluon_livefeed(int32_t argc, char **argv) { // Update mapping for tupel (dataType, senderStamp) --> Envelope. auto entry = mapOfLastEnvelopes[envelope.dataType()]; if (0 != entry.count(envelope.senderStamp())) { - lastTimeStamp = cluon::time::toMicroseconds(entry[envelope.senderStamp()].sampleTimeStamp()); + lastTimeStamp = cluon::time::toMicroseconds(entry[envelope.senderStamp()].sampleTimeStamp()); // LCOV_EXCL_LINE + } + currentTimeStamp = cluon::time::toMicroseconds(envelope.sampleTimeStamp()); // LCOV_EXCL_LINE + if (currentTimeStamp != lastTimeStamp) { + entry[envelope.senderStamp()] = envelope; // LCOV_EXCL_LINE + mapOfLastEnvelopes[envelope.dataType()] = entry; // LCOV_EXCL_LINE } - currentTimeStamp = cluon::time::toMicroseconds(envelope.sampleTimeStamp()); - entry[envelope.senderStamp()] = envelope; - mapOfLastEnvelopes[envelope.dataType()] = entry; } - { + if (currentTimeStamp != lastTimeStamp) { // Update mapping for tupel (dataType, senderStamp) --> deltaToLastEnvelope. auto entry = mapOfUpdateRates[envelope.dataType()]; float average{0}; if (0 != entry.count(envelope.senderStamp())) { - average = entry[envelope.senderStamp()]; - float freq = (static_cast(currentTimeStamp - lastTimeStamp))/(1000.0f*1000.0f); - average = (1.0f/freq)*0.1f + 0.9f*average; + average = entry[envelope.senderStamp()]; // LCOV_EXCL_LINE + float freq = (static_cast(currentTimeStamp - lastTimeStamp))/(1000.0f*1000.0f); // LCOV_EXCL_LINE + average = (1.0f/freq)*0.1f + 0.9f*average; // LCOV_EXCL_LINE } entry[envelope.senderStamp()] = average; mapOfUpdateRates[envelope.dataType()] = entry; @@ -17794,8 +17984,8 @@ inline int32_t cluon_rec2csv(int32_t argc, char **argv) { // Keep track of buffer sizes. if (mapOfEntriesSizes[KEY] > TEN_MB) { - std::cerr << argv[0] << ": Buffer for '" << KEY << "' has consumed " << mapOfEntriesSizes[KEY] << "/" << TEN_MB << " bytes; dumping data to disk."<< std::endl; - fileWriter(); + std::cerr << argv[0] << ": Buffer for '" << KEY << "' has consumed " << mapOfEntriesSizes[KEY] << "/" << TEN_MB << " bytes; dumping data to disk."<< std::endl; // LCOV_EXCL_LINE + fileWriter(); // LCOV_EXCL_LINE } } }