WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
UsageReporting.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <string_view>
8
10#include "wpi/util/string.hpp"
11
12/**
13 * Reports usage of a resource of interest. Repeated calls for the same
14 * resource name replace the previous report.
15 *
16 * @param resource the used resource name; convention is to suffix with
17 * "[instanceNum]" for multiple instances of the same
18 * resource
19 * @param data arbitrary associated data string
20 */
21inline void HAL_ReportUsage(std::string_view resource, std::string_view data) {
22 WPI_String resourceStr = wpi::util::make_string(resource);
23 WPI_String dataStr = wpi::util::make_string(data);
24 HAL_ReportUsage(&resourceStr, &dataStr);
25}
26
27/**
28 * Reports usage of a resource of interest. Repeated calls for the same
29 * resource name replace the previous report.
30 *
31 * @param resource the used resource name
32 * @param instanceNumber an index that identifies the resource instance
33 * @param data arbitrary associated data string
34 */
35void HAL_ReportUsage(std::string_view resource, int instanceNumber,
36 std::string_view data);
void HAL_ReportUsage(std::string_view resource, std::string_view data)
Reports usage of a resource of interest.
Definition UsageReporting.hpp:21
constexpr WPI_String make_string(std::string_view view)
Converts a string_view to a WPI_String.
Definition string.hpp:24
A const UTF8 string.
Definition string.h:12