24 #ifndef STORAGE_DEVICE_H
25 #define STORAGE_DEVICE_H
28 #include <libxml/tree.h>
33 #include <boost/noncopyable.hpp>
35 #include "storage/Utils/Exception.h"
73 class Device :
private boost::noncopyable
80 sid_t get_sid()
const;
82 bool operator==(
const Device& rhs)
const;
83 bool operator!=(
const Device& rhs)
const;
85 std::string get_displayname()
const;
87 virtual ResizeInfo detect_resize_info()
const;
89 bool has_children()
const;
90 size_t num_children()
const;
92 bool has_parents()
const;
93 size_t num_parents()
const;
99 std::vector<Device*> get_children();
100 std::vector<const Device*> get_children()
const;
102 std::vector<Device*> get_parents();
103 std::vector<const Device*> get_parents()
const;
105 std::vector<Device*> get_siblings(
bool itself);
106 std::vector<const Device*> get_siblings(
bool itself)
const;
108 std::vector<Device*> get_descendants(
bool itself);
109 std::vector<const Device*> get_descendants(
bool itself)
const;
111 std::vector<Device*> get_ancestors(
bool itself);
112 std::vector<const Device*> get_ancestors(
bool itself)
const;
114 std::vector<Device*> get_leaves(
bool itself);
115 std::vector<const Device*> get_leaves(
bool itself)
const;
117 std::vector<Device*> get_roots(
bool itself);
118 std::vector<const Device*> get_roots(
bool itself)
const;
120 std::vector<Holder*> get_in_holders();
121 std::vector<const Holder*> get_in_holders()
const;
123 std::vector<Holder*> get_out_holders();
124 std::vector<const Holder*> get_out_holders()
const;
126 void remove_descendants();
128 const std::map<std::string, std::string>& get_userdata()
const;
129 void set_userdata(
const std::map<std::string, std::string>& userdata);
131 friend std::ostream& operator<<(std::ostream& out,
const Device& device);
137 Impl& get_impl() {
return *impl; }
138 const Impl& get_impl()
const {
return *impl; }
140 virtual Device* clone()
const = 0;
142 void save(xmlNode* node)
const;
155 const std::unique_ptr<Impl> impl;
The master container of the libstorage.
Definition: Devicegraph.h:133
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:73
Base class for storage exceptions.
Definition: Exception.h:113
unsigned int sid_t
An integer storage ID.
Definition: Device.h:64