FreeRDP
Loading...
Searching...
No Matches
Names Class Reference

#include <sdl_overlay_model.hpp>

Public Member Functions

 Names (const std::vector< std::string > &names)
std::optional< uint64_t > get (const Reading &r, const std::string &name) const
bool has (const std::string &name) const

Detailed Description

The statistics' names, looked up once: an index means nothing from one version to the next, a name does. Unused slots and repeated names are left out, the first one wins.

Definition at line 43 of file sdl_overlay_model.hpp.

Constructor & Destructor Documentation

◆ Names()

sdl::overlay::Names::Names ( const std::vector< std::string > & names)
explicit

Definition at line 182 of file sdl_overlay_model.cpp.

183 {
184 for (size_t x = 0; x < names.size(); x++)
185 {
186 const auto& name = names.at(x);
187 if (name.empty() || (name == "FREERDP_CLIENT_STATS_UNUSED") ||
188 startsWith(name, "RDPGFX_CODECID_UNKNOWN") ||
189 startsWith(name, "RDPGFX_STATS_UNUSED"))
190 continue;
191 _index.emplace(name, x);
192 }
193 }

Member Function Documentation

◆ get()

std::optional< uint64_t > sdl::overlay::Names::get ( const Reading & r,
const std::string & name ) const
nodiscard
Returns
the value of name in r, or nothing when this client has no such statistic

Definition at line 195 of file sdl_overlay_model.cpp.

196 {
197 const auto it = _index.find(name);
198 if ((it == _index.end()) || (it->second >= r.values.size()))
199 return std::nullopt;
200 return r.values.at(it->second);
201 }
std::vector< uint64_t > values

◆ has()

bool sdl::overlay::Names::has ( const std::string & name) const
nodiscard

Definition at line 203 of file sdl_overlay_model.cpp.

204 {
205 return _index.find(name) != _index.end();
206 }

The documentation for this class was generated from the following files: