blob: 70b284cc8fcec01df9c9a5c253f037a927374660 [file] [log] [blame]
#pragma once
#include <bitset>
namespace pldm
{
constexpr size_t maxInstanceIds = 32;
/** @class InstanceId
* @brief Implementation of PLDM instance id as per DSP0240 v1.0.0
*/
class InstanceId
{
public:
/** @brief Get next unused instance id
* @return - PLDM instance id
*/
uint8_t next();
/** @brief Mark an instance id as unused
* @param[in] instanceId - PLDM instance id to be freed
*/
void markFree(uint8_t instanceId)
{
id.set(instanceId, false);
}
private:
std::bitset<maxInstanceIds> id;
};
} // namespace pldm