TensorFlow Serving C++ API Documentation
hashmap_source_adapter.h
1 /* Copyright 2016 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 
16 #ifndef TENSORFLOW_SERVING_SERVABLES_HASHMAP_HASHMAP_SOURCE_ADAPTER_H_
17 #define TENSORFLOW_SERVING_SERVABLES_HASHMAP_HASHMAP_SOURCE_ADAPTER_H_
18 
19 #include <string>
20 #include <unordered_map>
21 
22 #include "tensorflow_serving/core/simple_loader.h"
23 #include "tensorflow_serving/core/source_adapter.h"
24 #include "tensorflow_serving/core/storage_path.h"
25 #include "tensorflow_serving/servables/hashmap/hashmap_source_adapter.pb.h"
26 
27 namespace tensorflow {
28 namespace serving {
29 
30 // A SourceAdapter for string-string hashmaps. It takes storage paths that give
31 // the locations of serialized hashmaps (in the format indicated in the config)
32 // and produces loaders for them.
34  : public SimpleLoaderSourceAdapter<StoragePath,
35  std::unordered_map<string, string>> {
36  public:
37  explicit HashmapSourceAdapter(const HashmapSourceAdapterConfig& config);
38  ~HashmapSourceAdapter() override;
39 
40  private:
41  TF_DISALLOW_COPY_AND_ASSIGN(HashmapSourceAdapter);
42 };
43 
44 } // namespace serving
45 } // namespace tensorflow
46 
47 #endif // TENSORFLOW_SERVING_SERVABLES_HASHMAP_HASHMAP_SOURCE_ADAPTER_H_