Skip to content

Commit

Permalink
Fix property<void> type reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
janweinstock committed Jun 26, 2023
1 parent 8eb9142 commit 2e3aff0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion include/vcml/properties/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class property<void, N> : public property_base

virtual size_t size() const override { return m_size; }
virtual size_t count() const override { return m_count; }
virtual const char* type() const override { return "void"; }
virtual const char* type() const override;

constexpr bool is_inited() const { return m_inited; }
constexpr bool is_default() const { return !m_inited; }
Expand Down Expand Up @@ -575,6 +575,22 @@ inline void property<void, N>::str(const string& s) {
}
}

template <size_t N>
inline const char* property<void, N>::type() const {
switch (m_size) {
case 1:
return "u8";
case 2:
return "u16";
case 4:
return "u32";
case 8:
return "u64";
default:
return "void";
}
}

template <size_t N>
inline u64 property<void, N>::get(size_t idx) const {
VCML_ERROR_ON(idx >= m_count, "index %zu out of bounds", idx);
Expand Down

0 comments on commit 2e3aff0

Please sign in to comment.