• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
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 
16 #ifndef TENSORFLOW_CORE_UTIL_ENV_VAR_H_
17 #define TENSORFLOW_CORE_UTIL_ENV_VAR_H_
18 
19 #include "tensorflow/core/lib/core/status.h"
20 #include "tensorflow/core/lib/core/stringpiece.h"
21 #include "tensorflow/core/platform/types.h"
22 
23 namespace tensorflow {
24 
25 // Returns a boolean into "value" from the environmental variable
26 // "env_var_name". If it is unset, the default value is used. A string "0" or a
27 // case insensitive "false" is interpreted as false. A string "1" or a case
28 // insensitive "true" is interpreted as true. Otherwise, an error status is
29 // returned.
30 Status ReadBoolFromEnvVar(StringPiece env_var_name, bool default_val,
31                           bool* value);
32 
33 // Returns an int64 into "value" from the environmental variable "env_var_name".
34 // If it is unset, the default value is used.
35 // If the string cannot be parsed into int64, an error status is returned.
36 Status ReadInt64FromEnvVar(StringPiece env_var_name, int64 default_val,
37                            int64* value);
38 
39 // Returns a string into "value" from the environmental variable "env_var_name".
40 // If it is unset, the default value is used.
41 Status ReadStringFromEnvVar(StringPiece env_var_name, StringPiece default_val,
42                             string* value);
43 
44 }  // namespace tensorflow
45 
46 #endif  // TENSORFLOW_CORE_UTIL_ENV_VAR_H_
47