Program Listing for File regmap_manager.hpp

Return to documentation for file (regmap_manager.hpp)

#ifndef REGMAP_MANAGER_H_
#define REGMAP_MANAGER_H_

#include <filesystem>
#include <string>

// NOTE: Ignore the deprecated-declarations warning of gcc13, see FLX-2310
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "yaml-cpp/yaml.h"
#pragma GCC diagnostic pop


class RegmapManager
{
    public:
        RegmapManager();

        bool can_read(const std::string& name) {
            return has_type(name, "REGMAP_REG_READ");
        }

        bool can_write(const std::string& name) {
            return has_type(name, "REGMAP_REG_WRITE");
        }

        bool has_endpoint_1(const std::string& name) {
            return has_endpoint(name, "REGMAP_ENDPOINT_1");
        }

    private:
        std::filesystem::path m_regmap_file;
        YAML::Node m_regmap;

        bool has_key(std::string name, std::string key, const std::string& value);
        bool has_type(const std::string& name, const std::string& type);
        bool has_endpoint(const std::string& name, const std::string& endpoint);
};



#endif /* REGMAP_MANAGER_H_ */