libstorage-ng
Environment.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
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_ENVIRONMENT_H
24 #define STORAGE_ENVIRONMENT_H
25 
26 
27 #include <string>
28 #include <memory>
29 
30 
31 namespace storage
32 {
33 
35  enum class ProbeMode {
36  STANDARD, // probe system during init
37  STANDARD_WRITE_DEVICEGRAPH, // probe system during init, write devicegraph
38  STANDARD_WRITE_MOCKUP, // probe system during init, write mockup
39  NONE, // no probing - for testsuite
40  READ_DEVICEGRAPH, // fake probe - for testsuite
41  READ_MOCKUP // fake probe - for testsuite
42  };
43 
45  enum class TargetMode {
46  DIRECT, // direct target
47  CHROOT, // the target is chrooted, e.g. inst-sys
48  IMAGE // the target is image based
49  };
50 
51 
53  {
54  public:
55 
56  Environment(bool read_only);
57  Environment(bool read_only, ProbeMode probe_mode, TargetMode target_mode);
58  Environment(const Environment& environment);
59  ~Environment();
60 
61  Environment& operator=(const Environment& environment) = delete;
62 
63  bool is_read_only() const;
64 
65  ProbeMode get_probe_mode() const;
66 
67  TargetMode get_target_mode() const;
68 
69  const std::string& get_devicegraph_filename() const;
70  void set_devicegraph_filename(const std::string& devicegraph_filename);
71 
72  const std::string& get_arch_filename() const;
73  void set_arch_filename(const std::string& arch_filename);
74 
75  const std::string& get_mockup_filename() const;
76  void set_mockup_filename(const std::string& mockup_filename);
77 
78  friend std::ostream& operator<<(std::ostream& out, const Environment& environment);
79 
80  public:
81 
82  class Impl;
83 
84  Impl& get_impl() { return *impl; }
85  const Impl& get_impl() const { return *impl; }
86 
87  private:
88 
89  const std::unique_ptr<Impl> impl;
90 
91  };
92 
93 }
94 
95 #endif
Definition: Environment.h:52
TargetMode
Is the target a disk, chroot, or image?
Definition: Environment.h:45
ProbeMode
How to probe the system.
Definition: Environment.h:35
The storage namespace.
Definition: Actiongraph.h:37