16#ifndef SIMICS_SYSTEMC_SIMICS2TLM_MULTI_GASKET_OWNER_H
17#define SIMICS_SYSTEMC_SIMICS2TLM_MULTI_GASKET_OWNER_H
42 FATAL_ERROR_IF(
hasId(
id),
43 "Cannot bind the same ID (%d) to multiple gaskets",
id);
55 gasket_map_[id] = gasket_owner;
69 GasketOwnerMap::const_iterator it = gasket_map_.find(
id);
70 if (it != gasket_map_.end()) {
71 return it->second->gasket();
72 }
else if (!
empty()) {
73 return gasket_map_.begin()->second->gasket();
78 std::set<int>
keys()
const {
80 for (
auto i = gasket_map_.begin(); i != gasket_map_.end(); ++i)
86 for (GasketOwnerMap::iterator it = gasket_map_.begin();
87 it != gasket_map_.end(); ++it) {
94 return gasket_map_.count(
id);
97 return gasket_map_.empty();
101 typedef std::map<int, GasketOwner*> GasketOwnerMap;
102 GasketOwnerMap gasket_map_;
Definition: class_type.h:25
std::shared_ptr< GasketInterface > Ptr
Definition: gasket_interface.h:37
Base class, responsible for handling a gasket.
Definition: gasket_owner.h:32
GasketInterface::Ptr gasket() const
Definition: gasket_owner.h:46
void set_gasket(GasketInterface::Ptr gasketInterface)
Definition: gasket_owner.h:39
GasketInterface::Ptr gasket_
Definition: gasket_owner.h:50
GasketOwner()
Definition: gasket_owner.h:34
Container class for multiple GasketOwners, each given a unique ID.
Definition: multi_gasket_owner.h:39
GasketInterface::Ptr findGasket(int id) const
Returns the gasket matching the ID given.
Definition: multi_gasket_owner.h:68
virtual ~MultiGasketOwner()
Definition: multi_gasket_owner.h:85
bool hasId(int id) const
Definition: multi_gasket_owner.h:93
std::set< int > keys() const
Definition: multi_gasket_owner.h:78
void addGasket(int id, GasketInterface::Ptr gasketInterface)
Definition: multi_gasket_owner.h:41
int empty() const
Definition: multi_gasket_owner.h:96
Definition: null_gasket.h:34
Definition: pci_bus_interface.h:24