libstorage-ng
Actiongraph.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
3  * Copyright (c) [2016-2020] 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 #include "storage/CompoundAction.h"
35 #include "storage/UsedFeatures.h"
36 #include "storage/Utils/Swig.h"
37 
38 
39 namespace storage
40 {
41 
42  class Storage;
43  class Devicegraph;
44 
45 
46  namespace Action
47  {
48  class Base;
49  }
50 
51 
52  enum Side {
53  LHS, RHS
54  };
55 
56 
61  class Actiongraph : private boost::noncopyable
62  {
63  public:
64 
75 
76  ~Actiongraph();
77 
81  const Storage& get_storage() const;
82 
86  const Devicegraph* get_devicegraph(Side side) const;
87 
91  bool empty() const;
92 
96  size_t num_actions() const;
97 
101  uf_t used_features() const;
102 
106  void print_graph() const;
107 
111  void print_order() const;
112 
120  void write_graphviz(const std::string& filename, ActiongraphStyleCallbacks* style_callbacks) const;
121 
129  void write_graphviz(const std::string& filename, GraphvizFlags flags = GraphvizFlags::NAME,
130  GraphvizFlags tooltip_flags = GraphvizFlags::NONE) const;
131 
136  std::vector<const Action::Base*> get_commit_actions() const;
137 
138  std::vector<std::string> get_commit_actions_as_strings() const ST_DEPRECATED;
139 
144 
145  std::vector<const CompoundAction*> get_compound_actions() const;
146 
147  public:
148 
149  class Impl;
150 
151  Impl& get_impl() { return *impl; }
152  const Impl& get_impl() const { return *impl; }
153 
154  private:
155 
156  const std::unique_ptr<Impl> impl;
157 
158  };
159 
160 }
161 
162 
163 #endif
GraphvizFlags
Bitfield to control graphviz output.
Definition: Graphviz.h:44
uint64_t uf_t
Type for used features.
Definition: UsedFeatures.h:63
std::vector< const Action::Base * > get_commit_actions() const
Sorted according to dependencies among actions.
size_t num_actions() const
Return the number of actions in the actiongraph.
uf_t used_features() const
Calculates a bit-field with the used features of the actiongraph.
Actiongraph(const Storage &storage, Devicegraph *lhs, Devicegraph *rhs)
Calculate the actiongraph to get from the LHS (left-hand side) to the RHS (right-hand side) devicegra...
The main container of the libstorage-ng.
Definition: Devicegraph.h:169
void print_graph() const
Print the actiongraph on cout.
The actiongraph has all actions including the dependencies among them to get from one devicegraph to ...
Definition: Actiongraph.h:61
void generate_compound_actions()
Already called inside of Storage::calculate_actiongraph().
void print_order() const
Print the order of the actions on cout.
bool empty() const
Check whether the actiongraph is empty.
The main entry point to libstorage.
Definition: Storage.h:444
const Storage & get_storage() const
Get the storage object for which the actiongraph was constructed.
The storage namespace.
Definition: Actiongraph.h:39
void write_graphviz(const std::string &filename, ActiongraphStyleCallbacks *style_callbacks) const
Writes the actiongraph in graphviz format.
const Devicegraph * get_devicegraph(Side side) const
Get the left or right devicegraph for which the actiongraph was constructed.