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 
66  bool is_read_only() const;
67 
73  ProbeMode get_probe_mode() const;
74 
81 
82  const std::string& get_devicegraph_filename() const;
83  void set_devicegraph_filename(const std::string& devicegraph_filename);
84 
85  const std::string& get_arch_filename() const;
86  void set_arch_filename(const std::string& arch_filename);
87 
88  const std::string& get_mockup_filename() const;
89  void set_mockup_filename(const std::string& mockup_filename);
90 
91  friend std::ostream& operator<<(std::ostream& out, const Environment& environment);
92 
93  public:
94 
95  class Impl;
96 
97  Impl& get_impl() { return *impl; }
98  const Impl& get_impl() const { return *impl; }
99 
100  private:
101 
102  const std::unique_ptr<Impl> impl;
103 
104  };
105 
106 }
107 
108 #endif
Definition: Environment.h:52
ProbeMode get_probe_mode() const
Return the probe mode.
TargetMode get_target_mode() const
return the target mode.
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:38
bool is_read_only() const
Return whether the Environment has read-only set.