blob: 70b284cc8fcec01df9c9a5c253f037a927374660 [file] [log] [blame]
Deepak Kodihalli4de4d002019-11-11 02:41:43 -06001#pragma once
2
3#include <bitset>
4
5namespace pldm
6{
7
8constexpr size_t maxInstanceIds = 32;
9
10/** @class InstanceId
11 * @brief Implementation of PLDM instance id as per DSP0240 v1.0.0
12 */
13class InstanceId
14{
15 public:
16 /** @brief Get next unused instance id
17 * @return - PLDM instance id
18 */
19 uint8_t next();
20
21 /** @brief Mark an instance id as unused
22 * @param[in] instanceId - PLDM instance id to be freed
23 */
24 void markFree(uint8_t instanceId)
25 {
26 id.set(instanceId, false);
27 }
28
29 private:
30 std::bitset<maxInstanceIds> id;
31};
32
33} // namespace pldm