Remove pointless FetchValue class
It was just being used where a void* could've been used.
Change-Id: I34eb1c00d6037dc065d9626aa31ccb3db8580e2f
diff --git a/aos/events/raw-event-loop.h b/aos/events/raw-event-loop.h
index d221a6e..887c7ab 100644
--- a/aos/events/raw-event-loop.h
+++ b/aos/events/raw-event-loop.h
@@ -19,7 +19,6 @@
// It is the job of the typed version to cast this to the appropriate type.
class RawFetcher {
public:
- class FetchValue;
RawFetcher() {}
virtual ~RawFetcher() {}
@@ -29,17 +28,15 @@
// Non-blocking fetch of the latest message:
virtual bool Fetch() = 0;
- const FetchValue *most_recent() { return most_recent_; }
+ const void *most_recent() { return most_recent_; }
protected:
RawFetcher(const RawFetcher &) = delete;
RawFetcher &operator=(const RawFetcher &) = delete;
- void set_most_recent(const FetchValue *most_recent) {
- most_recent_ = most_recent;
- }
+ void set_most_recent(const void *most_recent) { most_recent_ = most_recent; }
private:
- const FetchValue *most_recent_ = nullptr;
+ const void *most_recent_ = nullptr;
};
// Raw version of sender. Sending a message is a 3 part process. Fetch an opaque
diff --git a/aos/events/shm-event-loop.cc b/aos/events/shm-event-loop.cc
index e44a54b..4984f59 100644
--- a/aos/events/shm-event-loop.cc
+++ b/aos/events/shm-event-loop.cc
@@ -27,8 +27,7 @@
// time. Also grab the oldest message but don't expose it to the user yet.
static constexpr Options<RawQueue> kOptions =
RawQueue::kFromEnd | RawQueue::kNonBlock;
- msg_ = static_cast<const FetchValue *>(
- queue_->ReadMessageIndex(kOptions, &index_));
+ msg_ = queue_->ReadMessageIndex(kOptions, &index_);
}
~ShmFetcher() {
if (msg_) {
@@ -37,8 +36,7 @@
}
bool FetchNext() override {
- const FetchValue *msg = static_cast<const FetchValue *>(
- queue_->ReadMessageIndex(RawQueue::kNonBlock, &index_));
+ const void *msg = queue_->ReadMessageIndex(RawQueue::kNonBlock, &index_);
// Only update the internal pointer if we got a new message.
if (msg != nullptr) {
queue_->FreeMessage(msg_);
@@ -51,8 +49,7 @@
bool Fetch() override {
static constexpr Options<RawQueue> kOptions =
RawQueue::kFromEnd | RawQueue::kNonBlock;
- const FetchValue *msg = static_cast<const FetchValue *>(
- queue_->ReadMessageIndex(kOptions, &index_));
+ const void *msg = queue_->ReadMessageIndex(kOptions, &index_);
// Only update the internal pointer if we got a new message.
if (msg != nullptr && msg != msg_) {
queue_->FreeMessage(msg_);
@@ -77,7 +74,7 @@
private:
int index_ = 0;
RawQueue *queue_;
- const FetchValue *msg_ = nullptr;
+ const void *msg_ = nullptr;
};
class ShmSender : public RawSender {
diff --git a/aos/events/simulated-event-loop.cc b/aos/events/simulated-event-loop.cc
index a3edd9b..85ea21b 100644
--- a/aos/events/simulated-event-loop.cc
+++ b/aos/events/simulated-event-loop.cc
@@ -53,7 +53,7 @@
msg_ = msgs_.front();
msgs_.pop_front();
- set_most_recent(reinterpret_cast<FetchValue *>(msg_.get()));
+ set_most_recent(msg_.get());
return true;
}
@@ -61,7 +61,7 @@
if (msgs_.size() == 0) {
if (!msg_ && queue_->latest_message()) {
msg_ = queue_->latest_message();
- set_most_recent(reinterpret_cast<FetchValue *>(msg_.get()));
+ set_most_recent(msg_.get());
return true;
} else {
return false;
@@ -72,7 +72,7 @@
// latest message from before we started.
msg_ = msgs_.back();
msgs_.clear();
- set_most_recent(reinterpret_cast<FetchValue *>(msg_.get()));
+ set_most_recent(msg_.get());
return true;
}