1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00
VILLASnode/common/include/villas/kernel/devices/device_ip_matcher.hpp
2024-11-15 10:36:35 +00:00

39 lines
No EOL
1.1 KiB
C++

/* Devicematcher
*
* Author: Pascal Bauer <pascal.bauer@rwth-aachen.de>
*
* SPDX-FileCopyrightText: 2023-2024 Pascal Bauer <pascal.bauer@rwth-aachen.de>
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <villas/fpga/core.hpp>
#include <villas/kernel/devices/ip_device.hpp>
class DeviceIpMatcher {
private:
std::vector<villas::kernel::devices::IpDevice> devices;
std::list<std::shared_ptr<villas::fpga::ip::Core>> ips;
public:
DeviceIpMatcher(std::vector<villas::kernel::devices::IpDevice> devices,
std::list<std::shared_ptr<villas::fpga::ip::Core>> ips)
: devices(devices), ips(ips) {}
std::vector<std::pair<std::shared_ptr<villas::fpga::ip::Core>,
villas::kernel::devices::IpDevice>>
match() const {
std::vector<std::pair<std::shared_ptr<villas::fpga::ip::Core>,
villas::kernel::devices::IpDevice>>
pairs;
for (auto device : devices) {
for (auto ip : ips) {
if (ip->getBaseaddr() == device.addr()) {
pairs.push_back(std::make_pair(ip, device));
}
}
}
return pairs;
}
};