11 #include <unordered_map>
39 static constexpr int8_t PROTOCOL_VERSION = 4;
53 void addElement(
const std::vector<std::string> & category, T element);
67 template<
typename SourceT,
typename T>
68 void addElement(SourceT * source,
const std::vector<std::string> & category, T element);
78 template<
typename T,
typename... Args>
79 void addElement(
const std::vector<std::string> & category, T element, Args... args);
91 template<
typename SourceT,
typename T,
typename... Args>
92 void addElement(SourceT * source,
const std::vector<std::string> & category, T element, Args... args);
105 void addElement(
const std::vector<std::string> & category,
ElementsStacking stacking, T element);
119 template<
typename SourceT,
typename T>
120 void addElement(SourceT * source,
const std::vector<std::string> & category,
ElementsStacking stacking, T element);
132 template<
typename T,
typename... Args>
133 void addElement(
const std::vector<std::string> & category,
ElementsStacking stacking, T element, Args... args);
147 template<
typename SourceT,
typename T,
typename... Args>
148 void addElement(SourceT * source,
149 const std::vector<std::string> & category,
161 bool hasElement(
const std::vector<std::string> & category,
const std::string & name);
167 void removeCategory(
const std::vector<std::string> & category);
170 void removeElement(
const std::vector<std::string> & category,
const std::string & name);
183 void removeElements(
void * source);
193 void removeElements(
const std::vector<std::string> & category,
void * source,
bool recurse =
false);
208 template<
typename... Args>
209 void addXYPlot(
const std::string & name,
226 template<
typename... Args>
227 void addXYPlot(
const std::string & name,
243 template<
typename... Args>
257 template<
typename... Args>
258 void addXYPlot(
const std::string & name, Args... args);
273 template<
typename T,
typename... Args>
274 void addPlot(
const std::string & name,
291 template<
typename T,
typename... Args>
303 template<
typename T,
typename... Args>
304 void addPlot(
const std::string & name, T abscissa, Args... args);
322 bool addPlotData(
const std::string & name, T data);
325 void removePlot(
const std::string & name);
334 size_t update(std::vector<char> & data);
340 bool handleRequest(
const std::vector<std::string> & category,
341 const std::string & name,
353 inline size_t size()
const {
return elements_.size(); }
357 void addElementImpl(
void * source,
358 const std::vector<std::string> & category,
371 plot_callback_function_t callback;
377 uint64_t plot_id_ = 0;
379 std::unordered_map<std::string, PlotCallback> plots_;
381 bool update_data_ =
true;
383 std::vector<char> data_buffer_;
385 size_t data_buffer_size_ = 0;
389 const Element & operator()()
const;
390 Element & operator()();
391 std::function<Element &()> element;
397 ElementStore(T
self,
const Category & category,
ElementsStacking stacking,
void * source);
402 std::vector<ElementStore> elements;
403 std::vector<Category> sub;
406 std::vector<Category>::iterator find(
const std::string & name);
410 inline size_t size()
const
413 for(
const auto & c : sub) { s += c.size(); }
414 return s + elements.size();
427 Category * getCategory(
const std::vector<std::string> & category,
size_t depth = std::numeric_limits<size_t>::max());
430 Category & getOrCreateCategory(
const std::vector<std::string> & category);
436 void removeElements(Category & category,
void * source);
438 std::string cat2str(
const std::vector<std::string> & category);
440 void addPlotData(PlotCallback &) {}
442 template<
typename T,
typename... Args>
443 void addPlotData(PlotCallback & callback, T plot, Args... args);
450 #include "StateBuilder.hpp"