2024-03-21 15:03:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-07-25 19:03:26 +01:00
|
|
|
#include <cstdint>
|
2024-03-21 15:03:06 +00:00
|
|
|
#include <string>
|
|
|
|
|
#include <map>
|
2024-07-23 21:14:22 +01:00
|
|
|
#include <vector>
|
2024-03-21 15:03:06 +00:00
|
|
|
#include <optional>
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
|
|
#include "TargetRegisterGroupDescriptor.hpp"
|
2024-07-23 21:14:22 +01:00
|
|
|
#include "TargetRegisterDescriptor.hpp"
|
|
|
|
|
#include "TargetPeripheralSignalDescriptor.hpp"
|
2024-03-21 15:03:06 +00:00
|
|
|
|
|
|
|
|
namespace Targets
|
|
|
|
|
{
|
2024-07-25 19:03:26 +01:00
|
|
|
using TargetPeripheralId = std::size_t;
|
|
|
|
|
|
2024-03-21 15:03:06 +00:00
|
|
|
struct TargetPeripheralDescriptor
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-07-25 19:03:26 +01:00
|
|
|
const TargetPeripheralId id;
|
|
|
|
|
const std::string key;
|
2024-03-21 15:03:06 +00:00
|
|
|
std::string name;
|
|
|
|
|
std::map<std::string, TargetRegisterGroupDescriptor, std::less<void>> registerGroupDescriptorsByKey;
|
2024-07-23 21:14:22 +01:00
|
|
|
std::vector<TargetPeripheralSignalDescriptor> signalDescriptors;
|
2024-03-21 15:03:06 +00:00
|
|
|
|
|
|
|
|
TargetPeripheralDescriptor(
|
|
|
|
|
const std::string& key,
|
|
|
|
|
const std::string& name,
|
2024-07-23 21:14:22 +01:00
|
|
|
std::map<std::string, TargetRegisterGroupDescriptor, std::less<void>>&& registerGroupDescriptorsByKey,
|
|
|
|
|
std::vector<TargetPeripheralSignalDescriptor>&& signalDescriptors
|
2024-03-21 15:03:06 +00:00
|
|
|
);
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
TargetPeripheralDescriptor(const TargetPeripheralDescriptor& other) = delete;
|
|
|
|
|
TargetPeripheralDescriptor& operator = (const TargetPeripheralDescriptor& other) = delete;
|
|
|
|
|
|
|
|
|
|
TargetPeripheralDescriptor(TargetPeripheralDescriptor&& other) noexcept = default;
|
2024-07-25 19:03:26 +01:00
|
|
|
|
|
|
|
|
bool operator == (const TargetPeripheralDescriptor& other) const;
|
|
|
|
|
bool operator != (const TargetPeripheralDescriptor& other) const;
|
2024-07-23 21:14:22 +01:00
|
|
|
|
|
|
|
|
[[nodiscard]] std::optional<
|
|
|
|
|
std::reference_wrapper<const TargetRegisterGroupDescriptor>
|
|
|
|
|
> tryGetRegisterGroupDescriptor(std::string_view keyStr) const;
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] const TargetRegisterGroupDescriptor& getRegisterGroupDescriptor(std::string_view key) const;
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] const TargetRegisterDescriptor& getRegisterDescriptor(
|
|
|
|
|
std::string_view groupKey,
|
|
|
|
|
const std::string& registerKey
|
2024-03-21 15:03:06 +00:00
|
|
|
) const;
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
[[nodiscard]] TargetPeripheralDescriptor clone() const;
|
2024-03-21 15:03:06 +00:00
|
|
|
};
|
|
|
|
|
}
|