22 #ifndef INCLUDE_HUEPLUSPLUS_SENSOR_LIST_H 23 #define INCLUDE_HUEPLUSPLUS_SENSOR_LIST_H 49 return get(id).asSensorType<T>();
61 nlohmann::json state = this->
stateCache->getValue();
62 std::vector<T> result;
63 for (
auto it = state.begin(); it != state.end(); ++it)
66 if (it->value(
"type",
"") == T::typeStr)
68 result.push_back(
get(
maybeStoi(it.key())).asSensorType<T>());
Handles a ResourceList where Resources can be added by the user.
Definition: ResourceList.h:285
std::shared_ptr< APICache > stateCache
Definition: ResourceList.h:230
Namespace for the hueplusplus library.
Definition: Action.h:27
std::vector< T > getAllByType()
Get all sensors of type T.
Definition: SensorList.h:59
static IdType maybeStoi(const std::string &key)
Calls std::stoi if IdType is int.
Definition: ResourceList.h:173
Handles a list of Sensors with type specific getters.
Definition: SensorList.h:33
T getAsType(int id)
Get sensor specified by id, convert to T.
Definition: SensorList.h:47
CreateableResourceList(CreateableResourceList &&)=default
Protected defaulted move constructor.
SensorList(SensorList &&)=default
Protected defaulted move constructor.
SensorList & operator=(SensorList &&)=default
Protected defaulted move assignment.