9 #include <nlohmann/json.hpp>
19 MuxedInterruptDistributorFactory::MuxedInterruptDistributorFactory() {
36 std::vector<size_t>
const& subdomainID,
DeviceBackend& backend) {
38 auto const& key = metaDataEntry.first;
41 auto jkey = nlohmann::json::parse(std::string({++key.begin(), key.end()}));
42 auto interruptId = jkey.get<std::vector<size_t>>();
44 if(interruptId == subdomainID) {
45 auto jdescriptor = nlohmann::json::parse(metaDataEntry.second);
46 auto controllerType = jdescriptor.begin().key();
47 auto controllerDescription = jdescriptor.front().dump();
48 return {controllerType, controllerDescription};
51 catch(json::parse_error& e) {
56 std::string subdomainIdString;
57 for(
auto i : subdomainID) {
60 subdomainIdString.pop_back();
63 "No interrupt controller description for SubDomain " + subdomainIdString +
" in MetadataCatalogue");
70 std::string name, description;
71 std::tie(name, description) =
77 return creatorFunctionIter->second(description, std::move(parent));
82 : _backend(parent->getBackend()), _id(parent->getId()), _parent(std::move(parent)),
83 _asyncDomain(_parent->getDomain()) {}
86 template<
typename DistributorType>
88 std::vector<size_t>
const& qualififedSubDomainId) {
90 assert(!qualififedSubDomainId.empty());
91 auto fullyQualifiedId =
_id;
92 fullyQualifiedId.push_back(qualififedSubDomainId.front());
95 boost::shared_ptr<SubDomain<std::nullptr_t>> subDomain;
96 auto subDomainIter =
_subDomains.find(qualififedSubDomainId.front());
98 subDomain = subDomainIter->second.lock();
102 boost::make_shared<SubDomain<std::nullptr_t>>(
_backend, fullyQualifiedId, shared_from_this(),
_asyncDomain);
103 _subDomains[qualififedSubDomainId.front()] = subDomain;
110 return subDomain->getAccessorManager<DistributorType>(qualififedSubDomainId);
126 auto subDomain = subDomainIter.second.lock();
136 auto subDomain = subDomainIter.second.lock();
138 subDomain->sendException(e);
146 subDomain.
activate(
nullptr, version);