xref: /haiku/src/add-ons/kernel/file_systems/packagefs/util/NodeRef.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright 2014, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef NODE_REF_H
6 #define NODE_REF_H
7 
8 
9 #include <Node.h>
10 
11 
12 inline
13 node_ref::node_ref()
14 	:
15 	device(-1),
16 	node(-1)
17 {
18 }
19 
20 
21 inline
22 node_ref::node_ref(dev_t device, ino_t node)
23 	:
24 	device(device),
25 	node(node)
26 {
27 }
28 
29 
30 inline
31 node_ref::node_ref(const node_ref& other)
32 	:
33 	device(other.device),
34 	node(other.node)
35 {
36 }
37 
38 
39 inline bool
40 node_ref::operator==(const node_ref& other) const
41 {
42 	return device == other.device && node == other.node;
43 }
44 
45 
46 inline bool
47 node_ref::operator!=(const node_ref& other) const
48 {
49 	return !(*this == other);
50 }
51 
52 
53 inline bool
54 node_ref::operator<(const node_ref& other) const
55 {
56 	if (device != other.device)
57 		return device < other.device;
58 	return node < other.node;
59 }
60 
61 
62 inline node_ref&
63 node_ref::operator=(const node_ref& other)
64 {
65 	device = other.device;
66 	node = other.node;
67 	return *this;
68 }
69 
70 
71 #endif	// NODE_REF_H
72