libstorage-ng
Actiongraph.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
3  * Copyright (c) 2016 SUSE LLC
4  *
5  * All Rights Reserved.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of version 2 of the GNU General Public License as published
9  * by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, contact Novell, Inc.
18  *
19  * To contact Novell about this file by physical or electronic mail, you may
20  * find current contact information at www.novell.com.
21  */
22 
23 
24 #ifndef STORAGE_ACTIONGRAPH_H
25 #define STORAGE_ACTIONGRAPH_H
26 
27 
28 #include <memory>
29 #include <string>
30 #include <vector>
31 #include <boost/noncopyable.hpp>
32 
33 #include "storage/Graphviz.h"
34 
35 
36 namespace storage
37 {
38 
39  class Storage;
40  class Devicegraph;
41 
42 
43  namespace Action
44  {
45  class Base;
46  }
47 
48 
49  enum Side {
50  LHS, RHS
51  };
52 
53 
54  class Actiongraph : private boost::noncopyable
55  {
56  public:
57 
58  Actiongraph(const Storage& storage, const Devicegraph* lhs, const Devicegraph* rhs);
59  ~Actiongraph();
60 
61  const Storage& get_storage() const;
62 
63  const Devicegraph* get_devicegraph(Side side) const;
64 
65  void print_graph() const;
66  void write_graphviz(const std::string& filename, GraphvizFlags flags =
67  GraphvizFlags::NONE) const;
68 
69  void print_order() const;
70 
71  bool empty() const;
72 
73  size_t num_actions() const;
74 
78  std::vector<const Action::Base*> get_commit_actions() const;
79 
80  // TODO add Action to the public interface and use get_commit_actions instead
81  std::vector<std::string> get_commit_actions_as_strings() const;
82 
83  public:
84 
85  class Impl;
86 
87  Impl& get_impl() { return *impl; }
88  const Impl& get_impl() const { return *impl; }
89 
90  private:
91 
92  const std::unique_ptr<Impl> impl;
93 
94  };
95 
96 }
97 
98 
99 #endif
GraphvizFlags
Bitfield to control graphviz output.
Definition: Graphviz.h:37
The master container of the libstorage.
Definition: Devicegraph.h:133
Definition: Actiongraph.h:54
The main entry point to libstorage.
Definition: Storage.h:99
The storage namespace.
Definition: Actiongraph.h:36