1 #ifndef AESALON_GUI_STORAGE_NODE_H
2 #define AESALON_GUI_STORAGE_NODE_H
7 #include "MemoryTypes.h"
8 #include "SnapshotID.h"
14 BlockTreeNode
*parent
;
16 MemoryAddress address
;
19 SnapshotID snapshot_id
;
21 BlockTreeNode(SnapshotID snapshot_id
) : left(NULL
), right(NULL
), parent(NULL
), address(0), size(0), snapshot_id(snapshot_id
) {}
22 virtual ~BlockTreeNode() {}
24 BlockTreeNode
*get_left() const { return left
; }
25 void set_left(BlockTreeNode
*new_left
) { left
= new_left
; if(left
) left
->set_parent(this); }
26 BlockTreeNode
*get_right() const { return right
; }
27 void set_right(BlockTreeNode
*new_right
) { right
= new_right
; if(right
) right
->set_parent(this); }
28 BlockTreeNode
*get_parent() const { return parent
; }
29 void set_parent(BlockTreeNode
*new_parent
) { parent
= new_parent
; }
31 /* NOTE: these operators operate solely on address, not on size . . . */
32 bool operator<(const BlockTreeNode
&other
) const;
33 bool operator>(const BlockTreeNode
&other
) const;
34 bool operator==(const BlockTreeNode
&other
) const;
36 bool stores_data() const { return size
!= 0; }
38 MemoryAddress
get_address() const { return address
; }
39 void set_address(MemoryAddress new_address
) { address
= new_address
; }
40 MemorySize
get_size() const { return size
; }
41 void set_size(MemorySize new_size
) { size
= new_size
; }
43 BlockTreeNode
*find_block_by_address(MemoryAddress address
) const;