• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 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 #ifndef TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_BASE_H_
16 #define TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_BASE_H_
17 
18 #include <cstdint>
19 #include <memory>
20 #include <unordered_map>
21 
22 namespace tflite {
23 namespace resource {
24 
25 // ResourceBase is an abstract base class for resources.
26 /// WARNING: Experimental interface, subject to change.
27 class ResourceBase {
28  public:
ResourceBase()29   explicit ResourceBase() {}
~ResourceBase()30   virtual ~ResourceBase() {}
31 
32   // Returns true if it is initialized.
33   virtual bool IsInitialized() = 0;
34 };
35 
36 /// WARNING: Experimental interface, subject to change.
37 using ResourceMap =
38     std::unordered_map<std::int32_t, std::unique_ptr<ResourceBase>>;
39 
40 }  // namespace resource
41 }  // namespace tflite
42 
43 #endif  // TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_BASE_H_
44