Adds GetBackgroundLabels.

This commit is contained in:
2023-04-24 23:35:59 -07:00
parent d33e95a57d
commit 005fcf7f56
2 changed files with 17 additions and 2 deletions

View File

@@ -4,17 +4,28 @@
#include <vector>
namespace SBF {
std::string GetBackgroundLabel(int backgroundId) {
namespace {
using std::string;
using std::vector;
} // End namespace
string GetBackgroundLabel(int backgroundId) {
if (backgroundId > 0 && backgroundId <= kBackgroundsCount) {
return kBackgroundLabels[backgroundId];
}
return "";
}
void FillBackgroundLabels(std::vector<std::string>& labels) {
void FillBackgroundLabels(vector<string>& labels) {
labels.clear();
for (int id = 1; id <= kBackgroundsCount; id++) {
labels.push_back(kBackgroundLabels[id]);
}
}
vector<string> GetBackgroundLabels() {
vector<string> labels;
FillBackgroundLabels(labels);
return labels;
}
} // End namespace SBF

View File

@@ -59,6 +59,10 @@ std::string GetBackgroundLabel(int background_id);
/// @brief Fills the provided vector with all valid background labels.
/// @param background_labels The vector to fill. It will be emptied first.
void FillBackgroundLabels(std::vector<std::string>& background_labels);
/// @brief Gets a vector of all the valid background labels.
/// @return The filled vector with index = background_id -1.
std::vector<std::string> GetBackgroundLabels();
} // End namespace SBF
/** @}*/