[ntcore] NetworkTables 4 (#3217)

This commit is contained in:
Peter Johnson
2022-10-08 10:01:31 -07:00
committed by GitHub
parent 90cfa00115
commit 77301b126c
380 changed files with 34573 additions and 22095 deletions

View File

@@ -2,54 +2,65 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#ifndef NTCORE_TESTPRINTERS_H_
#define NTCORE_TESTPRINTERS_H_
#pragma once
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <wpi/span.h>
#include "gtest/gtest.h"
namespace wpi {
class json;
inline void PrintTo(std::string_view str, ::std::ostream* os) {
::testing::internal::PrintStringTo(std::string{str}, os);
}
template <typename T>
void PrintTo(span<T> val, ::std::ostream* os) {
*os << '{';
bool first = true;
for (auto v : val) {
if (first) {
first = false;
} else {
*os << ", ";
}
*os << ::testing::PrintToString(v);
}
*os << '}';
}
void PrintTo(const json& val, ::std::ostream* os);
} // namespace wpi
namespace nt {
class EntryNotification;
namespace net3 {
class Message3;
} // namespace net3
namespace net {
struct ClientMessage;
struct ServerMessage;
} // namespace net
// class EntryNotification;
class Handle;
class Message;
class PubSubOptions;
class Value;
void PrintTo(const EntryNotification& event, std::ostream* os);
// void PrintTo(const EntryNotification& event, std::ostream* os);
void PrintTo(const Handle& handle, std::ostream* os);
void PrintTo(const Message& msg, std::ostream* os);
inline void PrintTo(std::shared_ptr<Message> msg, std::ostream* os) {
*os << "shared_ptr{";
if (msg) {
PrintTo(*msg, os);
}
*os << '}';
}
void PrintTo(const net3::Message3& msg, std::ostream* os);
void PrintTo(const net::ClientMessage& msg, std::ostream* os);
void PrintTo(const net::ServerMessage& msg, std::ostream* os);
void PrintTo(const Value& value, std::ostream* os);
inline void PrintTo(std::shared_ptr<Value> value, std::ostream* os) {
*os << "shared_ptr{";
if (value) {
PrintTo(*value, os);
}
*os << '}';
}
void PrintTo(const PubSubOptions& options, std::ostream* os);
} // namespace nt
#endif // NTCORE_TESTPRINTERS_H_