MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / GetSampleText

Method GetSampleText

lib/mdflib/mdflib/src/channelobserver.cpp:68–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67template <>
68bool ChannelObserver<std::vector<uint8_t>>::GetSampleText(
69 uint64_t sample, std::string &value, uint64_t array_index) const {
70 const auto array_size = channel_.ArraySize();
71 const auto sample_index = static_cast<size_t>( (sample * array_size) + array_index );
72 // The value_list consist of byte arrays. Convert o
73 std::ostringstream s;
74 if (sample_index < value_list_.size()) {
75 const auto &list = value_list_[sample_index];
76 for (const auto byte : list) {
77 s << std::setfill('0') << std::setw(2) << std::uppercase << std::hex
78 << static_cast<uint16_t>(byte);
79 }
80 }
81 value = s.str();
82 return sample_index < valid_list_.size() && valid_list_[sample_index];
83}
84
85template <>
86bool ChannelObserver<std::vector<uint8_t>>::GetSampleByteArray(

Callers

nothing calls this directly

Calls 2

ArraySizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected