Upgrade WPILib and upgraded compilers to C++17
I haven't touched the CTRE libraries yet, although they may need to be
upgraded as well.
Note that this change makes it so that you need either Ubuntu 18.04 or
later or debian buster or later in order to build the code (you may be
able to build code for the roborio on older operating systems, but
running the tests will not work normally).
Change-Id: I0cfa37fe37f830edde6d305e1f50414c369098e4
diff --git a/aos/events/event_loop.h b/aos/events/event_loop.h
index 34e55a8..fde7273 100644
--- a/aos/events/event_loop.h
+++ b/aos/events/event_loop.h
@@ -3,8 +3,8 @@
#include <atomic>
#include <string>
+#include <string_view>
-#include "absl/strings/string_view.h"
#include "aos/configuration.h"
#include "aos/configuration_generated.h"
#include "aos/flatbuffers.h"
@@ -79,7 +79,7 @@
virtual bool Send(const void *data, size_t size) = 0;
// Returns the name of this sender.
- virtual const absl::string_view name() const = 0;
+ virtual const std::string_view name() const = 0;
const Channel *channel() const { return channel_; }
@@ -175,7 +175,7 @@
Builder MakeBuilder();
// Returns the name of the underlying queue.
- const absl::string_view name() const { return sender_->name(); }
+ const std::string_view name() const { return sender_->name(); }
private:
friend class EventLoop;
@@ -231,7 +231,7 @@
// Makes a class that will always fetch the most recent value
// sent to the provided channel.
template <typename T>
- Fetcher<T> MakeFetcher(const absl::string_view channel_name) {
+ Fetcher<T> MakeFetcher(const std::string_view channel_name) {
const Channel *channel = configuration::GetChannel(
configuration_, channel_name, T::GetFullyQualifiedName(), name());
CHECK(channel != nullptr)
@@ -244,7 +244,7 @@
// Makes class that allows constructing and sending messages to
// the provided channel.
template <typename T>
- Sender<T> MakeSender(const absl::string_view channel_name) {
+ Sender<T> MakeSender(const std::string_view channel_name) {
const Channel *channel = configuration::GetChannel(
configuration_, channel_name, T::GetFullyQualifiedName(), name());
CHECK(channel != nullptr)
@@ -262,16 +262,16 @@
// TODO(parker): Need to support ::std::bind. For now, use lambdas.
// TODO(austin): Do we need a functor? Or is a std::function good enough?
template <typename Watch>
- void MakeWatcher(const absl::string_view name, Watch &&w);
+ void MakeWatcher(const std::string_view name, Watch &&w);
// The passed in function will be called when the event loop starts.
// Use this to run code once the thread goes into "real-time-mode",
virtual void OnRun(::std::function<void()> on_run) = 0;
// Sets the name of the event loop. This is the application name.
- virtual void set_name(const absl::string_view name) = 0;
+ virtual void set_name(const std::string_view name) = 0;
// Gets the name of the event loop.
- virtual const absl::string_view name() const = 0;
+ virtual const std::string_view name() const = 0;
// Creates a timer that executes callback when the timer expires
// Returns a TimerHandle for configuration of the timer
diff --git a/aos/events/event_loop_tmpl.h b/aos/events/event_loop_tmpl.h
index 9910d4d..bfd9775 100644
--- a/aos/events/event_loop_tmpl.h
+++ b/aos/events/event_loop_tmpl.h
@@ -27,7 +27,7 @@
}
template <typename Watch>
-void EventLoop::MakeWatcher(const absl::string_view channel_name, Watch &&w) {
+void EventLoop::MakeWatcher(const std::string_view channel_name, Watch &&w) {
using T = typename watch_message_type_trait<Watch>::message_type;
const Channel *channel = configuration::GetChannel(
configuration_, channel_name, T::GetFullyQualifiedName(), name());
diff --git a/aos/events/shm_event_loop.cc b/aos/events/shm_event_loop.cc
index 8fed31e..c05187b 100644
--- a/aos/events/shm_event_loop.cc
+++ b/aos/events/shm_event_loop.cc
@@ -101,12 +101,12 @@
}
private:
- void MkdirP(absl::string_view path) {
+ void MkdirP(std::string_view path) {
struct stat st;
auto last_slash_pos = path.find_last_of("/");
- std::string folder(last_slash_pos == absl::string_view::npos
- ? absl::string_view("")
+ std::string folder(last_slash_pos == std::string_view::npos
+ ? std::string_view("")
: path.substr(0, last_slash_pos));
if (stat(folder.c_str(), &st) == -1) {
PCHECK(errno == ENOENT);
@@ -126,10 +126,10 @@
};
// Returns the portion of the path after the last /.
-absl::string_view Filename(absl::string_view path) {
+std::string_view Filename(std::string_view path) {
auto last_slash_pos = path.find_last_of("/");
- return last_slash_pos == absl::string_view::npos
+ return last_slash_pos == std::string_view::npos
? path
: path.substr(last_slash_pos + 1, path.size());
}
@@ -297,7 +297,7 @@
return true;
}
- const absl::string_view name() const override { return name_; }
+ const std::string_view name() const override { return name_; }
private:
const ShmEventLoop *shm_event_loop_;
diff --git a/aos/events/shm_event_loop.h b/aos/events/shm_event_loop.h
index e859201..577a98d 100644
--- a/aos/events/shm_event_loop.h
+++ b/aos/events/shm_event_loop.h
@@ -59,10 +59,10 @@
void SetRuntimeRealtimePriority(int priority) override;
- void set_name(const absl::string_view name) override {
+ void set_name(const std::string_view name) override {
name_ = std::string(name);
}
- const absl::string_view name() const override { return name_; }
+ const std::string_view name() const override { return name_; }
int priority() const { return priority_; }
diff --git a/aos/events/simulated_event_loop.cc b/aos/events/simulated_event_loop.cc
index d374bb7..f65e75d 100644
--- a/aos/events/simulated_event_loop.cc
+++ b/aos/events/simulated_event_loop.cc
@@ -144,7 +144,7 @@
return Send(size);
}
- const absl::string_view name() const override {
+ const std::string_view name() const override {
return simulated_channel_->name();
}
@@ -368,10 +368,10 @@
scheduler_->Schedule(scheduler_->monotonic_now(), on_run);
}
- void set_name(const absl::string_view name) override {
+ void set_name(const std::string_view name) override {
name_ = std::string(name);
}
- const absl::string_view name() const override { return name_; }
+ const std::string_view name() const override { return name_; }
SimulatedChannel *GetSimulatedChannel(const Channel *channel);