Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
json.h
1#include <unordered_set>
2
3#include <nlohmann/json.hpp>
4
5namespace util {
6
7using json = nlohmann::json;
8using val_t = json::value_t;
9
13bool hasKey(const json& j, const std::string& key);
14
18bool validateKey(const json& j, const std::string& key, const val_t& type);
19
23bool validateKey(const json& j, const std::string& key,
24 const std::unordered_set<val_t>& types);
29bool validateOneOf(const json& j, const std::string& key,
30 const std::unordered_set<std::string>& vals);
31
36bool validateRange(const json& j, const std::string& key, double min, double max);
37
38} // namespace util
_GLIBCXX_END_NAMESPACE_CXX11 typedef basic_string< char > string
detail::value_t value_t
static softfloat min()
static softfloat max()
basic_json<> json
A collection of utility functions and classes with common use-cases.
Definition SwerveController.cpp:145
bool validateOneOf(const json &j, const std::string &key, const std::unordered_set< std::string > &vals)
Check if the value in the given json object at the given key is a string in the given set of allowed ...
Definition json.cpp:18
bool validateRange(const json &j, const std::string &key, double min, double max)
Check if the value in the given json object at the given key is a floating-point number between min a...
Definition json.cpp:25
bool hasKey(const json &j, const std::string &key)
Check if the given json object has the given key.
Definition json.cpp:5
bool validateKey(const json &j, const std::string &key, const val_t &type)
Check if the given json object has the given key with the given type.
Definition json.cpp:9