blob: cbbd5405495b4314e18a70a124f3536163b48961 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include <kapi/devices/device.hpp>
#include <kapi/devices.hpp>
#include <kapi/devices/bus.hpp>
#include <kstd/memory.hpp>
#include <kstd/string.hpp>
namespace kapi::devices
{
device::device(kstd::string const & name)
: m_name(name)
{}
auto device::name() const -> kstd::string const &
{
return m_name;
}
auto device::parent() const -> kstd::shared_ptr<bus>
{
return m_parent.lock();
}
auto device::state() const noexcept -> enum state
{
return m_state;
}
auto device::set_state(enum state state) -> void
{
m_state = state;
}
auto device::bind_driver(kstd::weak_ptr<struct driver> driver) -> void
{
m_driver = driver;
}
auto device::driver_data() const -> kstd::shared_ptr<void> const &
{
return m_driver_data;
}
auto device::set_driver_data(kstd::shared_ptr<void> data) -> void
{
m_driver_data = data;
}
auto device::query_interface(interface) -> void *
{
return nullptr;
}
auto device::set_parent(kstd::weak_ptr<bus> parent) -> void
{
m_parent = parent;
}
} // namespace kapi::devices
|