hueplusplus 1.2.0+ds-2build1
Loading...
Searching...
No Matches
hueplusplus::GroupResourceList< Resource, CreateType > Class Template Reference

Handles a group list with the special group 0. More...

#include <hueplusplus/ResourceList.h>

Inheritance diagram for hueplusplus::GroupResourceList< Resource, CreateType >:
Collaboration diagram for hueplusplus::GroupResourceList< Resource, CreateType >:

Public Member Functions

Resource get (const int &id)
 Get group, specially handles group 0.
bool exists (int id) const
 Get group, specially handles group 0.
Public Member Functions inherited from hueplusplus::CreateableResourceList< ResourceList< Resource, int >, CreateType >
ResourceList< Resource, int >::IdType create (const CreateType &params)
 Create a new resource.
Public Member Functions inherited from hueplusplus::ResourceList< Resource, int >
 ResourceList (std::shared_ptr< APICache > baseCache, const std::string &cacheEntry, std::chrono::steady_clock::duration refreshDuration, bool sharedState=false, const std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> &factory=nullptr)
 Construct ResourceList using a base cache and optional factory function.
ResourceListoperator= (const ResourceList &)=delete
 Deleted copy assignment.
void refresh ()
 Refreshes internal state now.
void setRefreshDuration (std::chrono::steady_clock::duration refreshDuration)
 Sets custom refresh interval for this list and all resources created.
std::vector< Resource > getAll ()
 Get all resources that exist.
Resource get (const IdType &id)
 Get resource specified by id.
bool exists (const IdType &id)
 Checks whether resource with id exists.
bool remove (const IdType &id)
 Removes the resource.

Protected Member Functions

 GroupResourceList (GroupResourceList &&)=default
 Protected defaulted move constructor.
GroupResourceListoperator= (GroupResourceList &&)=default
 Protected defaulted move assignment.
Protected Member Functions inherited from hueplusplus::CreateableResourceList< ResourceList< Resource, int >, CreateType >
 CreateableResourceList (CreateableResourceList &&)=default
 Protected defaulted move constructor.
CreateableResourceListoperator= (CreateableResourceList &&)=default
 Protected defaulted move assignment.
Protected Member Functions inherited from hueplusplus::ResourceList< Resource, int >
Resource construct (const IdType &id, const nlohmann::json &state)
 Constructs resource using factory or constructor, if available.

Additional Inherited Members

Public Types inherited from hueplusplus::ResourceList< Resource, int >
using ResourceType
using IdType
Static Protected Member Functions inherited from hueplusplus::ResourceList< Resource, int >
static IdType maybeStoi (const std::string &key)
 Calls std::stoi if IdType is int.
static std::string maybeToString (const IdType &id)
 Calls std::to_string if IdType is int.
Protected Attributes inherited from hueplusplus::ResourceList< Resource, int >
std::shared_ptr< APICachestateCache
std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> factory
std::string path
bool sharedState

Detailed Description

template<typename Resource, typename CreateType>
class hueplusplus::GroupResourceList< Resource, CreateType >

Handles a group list with the special group 0.

Template Parameters
ResourceResource type that is in the list
CreateTypeType that provides parameters for creation. Must have a const getRequest() function returning the JSON for the POST request.

Constructor & Destructor Documentation

◆ GroupResourceList()

template<typename Resource, typename CreateType>
hueplusplus::GroupResourceList< Resource, CreateType >::GroupResourceList ( GroupResourceList< Resource, CreateType > && )
protecteddefault

Protected defaulted move constructor.

Member Function Documentation

◆ exists()

template<typename Resource, typename CreateType>
bool hueplusplus::GroupResourceList< Resource, CreateType >::exists ( int id) const
inline

Get group, specially handles group 0.

See also
ResourceList::exists

◆ get()

template<typename Resource, typename CreateType>
Resource hueplusplus::GroupResourceList< Resource, CreateType >::get ( const int & id)
inline

Get group, specially handles group 0.

See also
ResourceList::get

◆ operator=()

template<typename Resource, typename CreateType>
GroupResourceList & hueplusplus::GroupResourceList< Resource, CreateType >::operator= ( GroupResourceList< Resource, CreateType > && )
protecteddefault

Protected defaulted move assignment.


The documentation for this class was generated from the following file: