1 #ifndef WPP_RESOURCE_CONTAINER_H
2 #define WPP_RESOURCE_CONTAINER_H
79 bool set(
ID_T resId,
const T &value);
91 bool set(
ID_T resId,
ID_T resInstId,
const T &value);
102 bool set(
ID_T resId, T &&value);
148 bool add(
ID_T resId,
const T &value);
164 bool add(
ID_T resId, T &&value);
210 std::vector<Resource> _resources;
226 if (!res->set(value, resInstId)) {
246 if (!res->set(std::move(value), resInstId)) {
265 return res->get<T>(resInstId);
275 if (res->isSingle()) {
280 ID_T newId = res->newInstId();
285 if (!res->set(value, newId)) {
300 if (res->isSingle()) {
305 ID_T newId = res->newInstId();
311 if (!res->set(std::move(value), newId)) {
#define WPP_LOGE(TAG, FMT,...)
#define WPP_LOGW(TAG, FMT,...)
#define WPP_LOGD(TAG, FMT,...)
#define SINGLE_INSTANCE_ID
void setupResources(const std::vector< Resource > &resources)
This methods setup resources list.
virtual ~ResourceContainer()=default
Resource * resource(ID_T resId)
This method return resource ptr if it exists. If resources does not exist then return NULL.
std::vector< ID_T > instIds(ID_T resId)
Returns vector with available ids of resource instances.
std::vector< Resource > & resources()
This method return list with all resources that has been defined.
size_t instCount(ID_T resId)
Get the number of resource instances.
virtual void resourceOperationNotifier(ItemOp::TYPE type, ID_T resId, ID_T resInstId)=0
This method must be implemented by the derived class, and handle information about resource operation...
bool removeRes(ID_T resId, ID_T resInstId)
Remove resource instance if resource is MULTIPLE and instance exists, if the resource is SINGLE remov...
bool clearRes(ID_T resId)
Remove all instances.
bool add(ID_T resId, const T &value)
Add new instance with data value by copy for the MULTIPLE resource.
bool isMultiple(ID_T resId)
Check if the resource is MULTIPLE.
ResourceContainer()=default
ID_T newInstId(ID_T resId)
Find first available instance ID that is not used.
bool isExist(ID_T resId)
Check if the instance ID is exist.
bool isSingle(ID_T resId)
Check if the resource is SINGLE.
bool set(ID_T resId, const T &value)
Set data value by copy for the resource.
const T & get(ID_T resId, ID_T resInstId=SINGLE_INSTANCE_ID)
The Resource class in the wpp namespace is a comprehensive and flexible class designed to handle diff...
The WppConnection class represents a connection interface for the Wpp library.
TYPE
Enum representing the different types of operations.