OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
environment.h
Go to the documentation of this file.
1 // Copyright 2017-2020, Schlumberger
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "../declspec.h"
18 #include <string>
19 
24 namespace InternalZGY {
25 
32 class OPENZGY_TEST_API Environment
33 {
34 public:
35  static int getNumericEnv(const char *name, int dflt = 0);
36  static std::string getStringEnv(const char *name, const char *dflt = 0);
37  static void putNumericEnv(const char *name, int value);
38  static void putStringEnv(const char *name, const char *value);
39 private: // class has static members only, should not be instantiated.
40  Environment() = delete;
41  Environment& operator=(const Environment&) = delete;
42 };
43 
48 class OPENZGY_TEST_API PushEnvironment
49 {
50  std::string name_;
51  std::string oldvalue_;
52  PushEnvironment(const PushEnvironment&) = delete;
53  PushEnvironment& operator=(const PushEnvironment&) = delete;
54 public:
55  PushEnvironment(const char *name, const char *value = nullptr);
56  ~PushEnvironment();
57  void restore();
58 };
59 
60 } // namespace
InternalZGY::Environment
Definition: environment.h:32
InternalZGY::PushEnvironment
Definition: environment.h:48
InternalZGY
Implementation not visible to clients.