• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2 * Copyright 2022 Huawei Technologies Co., Ltd
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #ifndef MINDSPORE_INCLUDE_JS_API_NNRT_DEVICE_DESC_NAPI_H
17 #define MINDSPORE_INCLUDE_JS_API_NNRT_DEVICE_DESC_NAPI_H
18 
19 #include "include/api/types.h"
20 #include "napi/native_api.h"
21 #include "napi/native_node_api.h"
22 #include "include/js_api/common_napi.h"
23 
24 namespace mindspore {
25 class NnrtDeviceDescNapi {
26 public:
27  static napi_value NewInstance(napi_env env, NnrtDeviceDesc decs);
28  NnrtDeviceDescNapi();
29  ~NnrtDeviceDescNapi();
30 private:
31  static napi_value Constructor(napi_env env, napi_callback_info info);
32  static void Finalize(napi_env env, void *nativeObject, void *finalize);
33  static napi_value GetConstructor(napi_env env);
34 
35  static napi_value GetDeviceName(napi_env env, napi_callback_info info);
36  static napi_value GetDeviceType(napi_env env, napi_callback_info info);
37  static napi_value GetDeviceID(napi_env env, napi_callback_info info);
38 
39  static thread_local napi_ref constructor_;
40  napi_env env_ = nullptr;
41 
42  std::unique_ptr<NnrtDeviceDesc> nativeNnrtDeviceDesc_ = nullptr;
43 };
44 }  // namespace mindspore
45 #endif  // MINDSPORE_INCLUDE_JS_API_NNRT_DEVICE_DESC_NAPI_H