TensorFlow Serving C++ API Documentation
oss_or_google.h
1 /* Copyright 2019 Google Inc. 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 #ifndef TENSORFLOW_SERVING_UTIL_OSS_OR_GOOGLE_H_
16 #define TENSORFLOW_SERVING_UTIL_OSS_OR_GOOGLE_H_
17 
18 #define TENSORFLOW_SERVING_OSS
19 
20 namespace tensorflow {
21 namespace serving {
22 
23 // Used to distinguish the context of the code; whether it's part of our OSS
24 // distribution or within Google.
25 //
26 // This is useful in cases where we want to enable/disable running some piece of
27 // code based on whether we are in/out of OSS.
28 //
29 // NB that the method is marked 'constexpr' so that the value can be used as
30 // a compile-time constant.
31 inline constexpr bool IsTensorflowServingOSS() {
32 #ifdef TENSORFLOW_SERVING_GOOGLE
33  return false;
34 #else
35  return true;
36 #endif
37 }
38 
39 } // namespace serving
40 } // namespace tensorflow
41 
42 #endif // TENSORFLOW_SERVING_UTIL_OSS_OR_GOOGLE_H_