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 
44 
48  enum class TargetMode {
49 
51  DIRECT,
52 
54  CHROOT,
55 
57  IMAGE
58 
59  };
60 
61 
63  {
64  public:
65 
66  Environment(bool read_only);
67  Environment(bool read_only, ProbeMode probe_mode, TargetMode target_mode);
68  Environment(const Environment& environment);
69  ~Environment();
70 
71  Environment& operator=(const Environment& environment) = delete;
72 
76  bool is_read_only() const;
77 
83  ProbeMode get_probe_mode() const;
84 
91 
92  const std::string& get_devicegraph_filename() const;
93  void set_devicegraph_filename(const std::string& devicegraph_filename);
94 
95  const std::string& get_arch_filename() const;
96  void set_arch_filename(const std::string& arch_filename);
97 
98  const std::string& get_mockup_filename() const;
99  void set_mockup_filename(const std::string& mockup_filename);
100 
101  friend std::ostream& operator<<(std::ostream& out, const Environment& environment);
102 
103  public:
104 
105  class Impl;
106 
107  Impl& get_impl() { return *impl; }
108  const Impl& get_impl() const { return *impl; }
109 
110  private:
111 
112  const std::unique_ptr<Impl> impl;
113 
114  };
115 
116 }
117 
118 #endif
Definition: Environment.h:62
ProbeMode get_probe_mode() const
Return the probe mode.
TargetMode get_target_mode() const
return the target mode.
TargetMode
Enum with target modes.
Definition: Environment.h:48
ProbeMode
How to probe the system.
Definition: Environment.h:35
The target is image based.
The storage namespace.
Definition: Actiongraph.h:38
The target is chrooted, e.g.
bool is_read_only() const
Return whether the Environment has read-only set.