libstp
Robotics library for Botball
Loading...
Searching...
No Matches
CommandTrace.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <atomic>
4#include <cstdint>
5#include <fstream>
6#include <mutex>
7#include <string>
8
10{
41 class CommandTrace
42 {
43 public:
44 static CommandTrace& instance();
45
46 bool enabled() const { return enabled_; }
47
50 void record(const char* kind, const std::string& channel, int port, double v0,
51 double v1, double v2, int nvals, int64_t msgTimestampUsec);
52
53 private:
54 CommandTrace();
55 ~CommandTrace();
56
57 bool enabled_ = false;
58 std::ofstream out_;
59 std::mutex mutex_;
60 std::atomic<uint64_t> seq_{0};
61 };
62}
static CommandTrace & instance()
void record(const char *kind, const std::string &channel, int port, double v0, double v1, double v2, int nvals, int64_t msgTimestampUsec)