trace_buffer: add object() accessor

genodelabs/genode#4352
This commit is contained in:
Johannes Schlatow 2022-05-17 13:45:55 +02:00 committed by Christian Helmuth
parent 086f3efef2
commit cee0c9858c

View File

@ -257,6 +257,9 @@ class Genode::Trace::Simple_buffer
size_t length() const { return _entry->len; } size_t length() const { return _entry->len; }
char const *data() const { return _entry->data; } char const *data() const { return _entry->data; }
template <typename T>
T const &object() const { return *reinterpret_cast<const T*>(data()); }
/* return whether entry is valid, i.e. length field is present */ /* return whether entry is valid, i.e. length field is present */
bool last() const { return _entry == 0; } bool last() const { return _entry == 0; }