#pragma once

#include <mutex>
#include <cstdint>

class Flags {
public:
    Flags() : flags_{0} {}

    void set_flag(uint32_t mask) {
        std::lock_guard<std::mutex> guard(mutex_);
        flags_ |= mask;
    }

    uint32_t get_flag(uint32_t mask) {
        std::lock_guard<std::mutex> guard(mutex_);
        return flags_ & mask;
    }

    uint32_t get_flags() {
        std::lock_guard<std::mutex> guard(mutex_);
        return flags_;
    }

    void clear_flags(uint32_t mask)
    {
       std::lock_guard<std::mutex> guard(mutex_);
       flags_ &= ~mask;
    }
    
private:
    uint32_t flags_;
    mutable std::mutex mutex_;
};