Adds GetBackgroundLabels.
This commit is contained in:
		| @@ -4,17 +4,28 @@ | |||||||
| #include <vector> | #include <vector> | ||||||
|  |  | ||||||
| namespace SBF { | 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) { |   if (backgroundId > 0 && backgroundId <= kBackgroundsCount) { | ||||||
|     return kBackgroundLabels[backgroundId]; |     return kBackgroundLabels[backgroundId]; | ||||||
|   } |   } | ||||||
|   return ""; |   return ""; | ||||||
| } | } | ||||||
|  |  | ||||||
| void FillBackgroundLabels(std::vector<std::string>& labels) { | void FillBackgroundLabels(vector<string>& labels) { | ||||||
|   labels.clear(); |   labels.clear(); | ||||||
|   for (int id = 1; id <= kBackgroundsCount; id++) { |   for (int id = 1; id <= kBackgroundsCount; id++) { | ||||||
|     labels.push_back(kBackgroundLabels[id]); |     labels.push_back(kBackgroundLabels[id]); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | vector<string> GetBackgroundLabels() { | ||||||
|  |   vector<string> labels; | ||||||
|  |   FillBackgroundLabels(labels); | ||||||
|  |   return labels; | ||||||
|  | } | ||||||
| }  // End namespace SBF | }  // End namespace SBF | ||||||
|   | |||||||
| @@ -59,6 +59,10 @@ std::string GetBackgroundLabel(int background_id); | |||||||
| /// @brief Fills the provided vector with all valid background labels. | /// @brief Fills the provided vector with all valid background labels. | ||||||
| /// @param background_labels The vector to fill. It will be emptied first. | /// @param background_labels The vector to fill. It will be emptied first. | ||||||
| void FillBackgroundLabels(std::vector<std::string>& background_labels); | 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 | }  // End namespace SBF | ||||||
|  |  | ||||||
| /** @}*/ | /** @}*/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user