mqttidgenerator.h 1.21 KB
#ifndef OSDEV_COMPONENTS_MQTT_MLOGICIDGENERATOR_H
#define OSDEV_COMPONENTS_MQTT_MLOGICIDGENERATOR_H

// std
#include <string>

// osdev::components::mqtt
#include "commondefs.h"

namespace osdev {
namespace components {
namespace mqtt {

class MqttIdGenerator
{
public:
    /**
     * @brief Generates a new MqttId, which is guaranteed to be unique.
     * @return A new unique MqttId.
     */
    static MqttId generate();

    /**
     * @brief Returns an MqttId that represents null.
     * @return An MqttId that represents null.
     */
    static MqttId nullId();

    /**
      * @brief Returns an MqttId based on a namespace uuid and a given string.
      * @param namespaceUuid The namespace in which the MqttId is generated.
      * @param name The name for which an MqttId is generated.
      */
    static MqttId nameId(MqttId namespaceUuid, const std::string& name);

    /**
      * @brief Returns an MqttId in the MQTT namespace for a given string.
      * @param name The name for which an MqttId is generated.
      */
    static MqttId nameId(const std::string& name);
};

}       // End namespace mqtt
}       // End namespace components
}       // End namespace osdev

#endif  // OSDEV_COMPONENTS_MQTT_MLOGICIDGENERATOR_H