libstorage-ng
Topology.h
1 /*
2  * Copyright (c) 2016 SUSE LLC
3  *
4  * All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, contact Novell, Inc.
17  *
18  * To contact Novell about this file by physical or electronic mail, you may
19  * find current contact information at www.novell.com.
20  */
21 
22 
23 #ifndef STORAGE_TOPOLOGY_H
24 #define STORAGE_TOPOLOGY_H
25 
26 
27 #include <libxml/tree.h>
28 #include <memory>
29 #include <ostream>
30 
31 
32 namespace storage
33 {
34 
38  class Topology
39  {
40  public:
41 
42  Topology();
43  Topology(long alignment_offset, unsigned long optimal_io_size);
44  Topology(const Topology& topology);
45  Topology(Topology&& topology) = default;
46  ~Topology();
47 
48  Topology& operator=(const Topology& topology);
49  Topology& operator=(Topology&& topology) = default;
50 
51  long get_alignment_offset() const;
52  void set_alignment_offset(long alignment_offset);
53 
54  unsigned long get_optimal_io_size() const;
55  void set_optimal_io_size(unsigned long optimal_io_size);
56 
57  unsigned long get_minimal_grain() const;
58  void set_minimal_grain(unsigned long minimal_grain);
59 
60  bool operator==(const Topology& rhs) const;
61  bool operator!=(const Topology& rhs) const;
62 
63  friend std::ostream& operator<<(std::ostream& s, const Topology& topology);
64 
65  public:
66 
67  class Impl;
68 
69  Impl& get_impl();
70  const Impl& get_impl() const;
71 
72  friend bool getChildValue(const xmlNode* node, const char* name, Topology& topology);
73  friend void setChildValue(xmlNode* node, const char* name, const Topology& topology);
74 
75  private:
76 
77  const std::unique_ptr<Impl> impl;
78 
79  };
80 
81 }
82 
83 
84 #endif
A class to represent hardware alignment information.
Definition: Topology.h:38
The storage namespace.
Definition: Actiongraph.h:37