16#ifndef SIMICS_SYSTEMC_DEVICE_H
17#define SIMICS_SYSTEMC_DEVICE_H
49 Device() : simulation_(NULL), device_(NULL), is_device_owner_(false) {}
64 : simulation_(NULL), device_(NULL), is_device_owner_(false) {
76 : simulation_(simulation), device_(new T), is_device_owner_(true) {
89 const std::string &device_name)
90 : simulation_(simulation), device_(new T(device_name.c_str())),
91 is_device_owner_(true) {
109 : simulation_(simulation), device_(device_model),
129 FATAL_ERROR_IF(device_,
"Changing the device is not allowed");
130 FATAL_ERROR_IF(simulation_,
"Changing the simulation is not allowed");
132 std::swap(device_, other.device_);
133 std::swap(simulation_, other.simulation_);
134 std::swap(is_device_owner_, other.is_device_owner_);
159 if (is_device_owner_) {
168 bool is_device_owner_;
Utility class that handles the context switching, using RAII methodology.
Definition: context.h:31
Definition: device_access.h:28
Utility class for handling direct access to the SystemC top module (i.e.
Definition: device.h:38
const T * pointer() const
pointer to underlying device object
Definition: device.h:154
Device & operator=(Device &other)
Assume ownership of the underlying simulation and device model.
Definition: device.h:128
Device(iface::SimulationInterface *simulation, const std::string &device_name)
This constructor automatically allocates an object of type T with device_name passed as the only argu...
Definition: device.h:88
const DeviceAccess< T > operator->() const
Access the underlying device object with the proper simulation context.
Definition: device.h:144
ownership_t
Definition: device.h:40
@ TAKE_OWNERSHIP
Definition: device.h:42
@ DONT_TAKE_OWNERSHIP
Definition: device.h:41
T * pointer()
pointer to underlying device object
Definition: device.h:149
Device()
Default constructor.
Definition: device.h:49
Device(Device &other)
Assume ownership of the underlying simulation and device model.
Definition: device.h:63
Device(iface::SimulationInterface *simulation, T *device_model, ownership_t ownership=TAKE_OWNERSHIP)
Wrap an existing model in this Device.
Definition: device.h:107
virtual ~Device()
Definition: device.h:158
Device(iface::SimulationInterface *simulation)
This constructor automatically allocates an object of type T with default arguments.
Definition: device.h:75
DeviceAccess< T > operator->()
Access the underlying device object with the proper simulation context.
Definition: device.h:139
Interface to the SystemC simulation.
Definition: simulation_interface.h:27
Definition: pci_bus_interface.h:24