Skip to content

Commit

Permalink
* Updated libcluon
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berger <[email protected]>
  • Loading branch information
chrberger committed Mar 3, 2019
1 parent 74a7da8 commit 499fe53
Showing 1 changed file with 202 additions and 12 deletions.
214 changes: 202 additions & 12 deletions cluon-complete-v0.0.121.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -5120,6 +5120,194 @@ struct isTripletForwardVisitable<cluon::data::PlayerStatus> {
};
#endif


/*
* THIS IS AN AUTO-GENERATED FILE. DO NOT MODIFY AS CHANGES MIGHT BE OVERWRITTEN!
*/

#ifndef VISITABLE_TYPE_TRAIT
#define VISITABLE_TYPE_TRAIT
#include <cstdint>
#include <string>
#include <utility>

template<bool b>
struct visitorSelector {
template<typename T, class Visitor>
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<true> {
template<typename T, class Visitor>
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<typename T>
struct isVisitable {
static const bool value = false;
};

template<typename T, class Visitor>
void doVisit(uint32_t fieldIdentifier, std::string &&typeName, std::string &&name, T &value, Visitor &visitor) {
visitorSelector<isVisitable<T>::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 <cstdint>
#include <string>
#include <utility>

template<bool b>
struct tripletForwardVisitorSelector {
template<typename T, class PreVisitor, class Visitor, class PostVisitor>
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<Visitor>(visit)(fieldIdentifier, std::move(typeName), std::move(name), value);
}
};

template<>
struct tripletForwardVisitorSelector<true> {
template<typename T, class PreVisitor, class Visitor, class PostVisitor>
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<typename T>
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<isTripletForwardVisitable<T>::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 <string>
#include <utility>
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<class Visitor>
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<class Visitor>
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<class PreVisitor, class Visitor, class PostVisitor>
inline void accept(PreVisitor &&preVisit, Visitor &&visit, PostVisitor &&postVisit) {
(void)visit; // Prevent warnings from empty messages.
std::forward<PreVisitor>(preVisit)(ID(), ShortName(), LongName());

doTripletForwardVisit(1, std::move("uint8_t"s), std::move("command"s), m_command, preVisit, visit, postVisit);

std::forward<PostVisitor>(postVisit)();
}

private:

uint8_t m_command{ 0 }; // field identifier = 1.

};
}}

template<>
struct isVisitable<cluon::data::RecorderCommand> {
static const bool value = true;
};
template<>
struct isTripletForwardVisitable<cluon::data::RecorderCommand> {
static const bool value = true;
};
#endif

/*
* MIT License
*
Expand Down Expand Up @@ -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<float>(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<float>(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;
Expand Down Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit 499fe53

Please sign in to comment.