2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ML_ML_INSTANCE_H_
18 #define ML_ML_INSTANCE_H_
20 #include "common/extension.h"
22 #include "ml/ml_pipeline_manager.h"
23 #include "ml/ml_single_manager.h"
24 #include "nnstreamer/nnstreamer-single.h"
25 #include "nnstreamer/nnstreamer.h"
27 #include "ml_tensors_data_manager.h"
28 #include "ml_tensors_info_manager.h"
33 class MlInstance : public common::ParsedInstance {
36 virtual ~MlInstance();
37 TensorsInfoManager& GetTensorsInfoManager();
38 TensorsDataManager& GetTensorsDataManager();
41 // Common ML API begin
42 void MLCheckNNFWAvailability(const picojson::value& args, picojson::object& out);
43 void MLTensorsInfoCountGetter(const picojson::value& args, picojson::object& out);
44 void MLTensorsInfoCreate(const picojson::value& args, picojson::object& out);
45 void MLTensorsInfoAddTensorInfo(const picojson::value& args, picojson::object& out);
46 void MLTensorsInfoGetDimensions(const picojson::value& args, picojson::object& out);
47 void MLTensorsInfoSetDimensions(const picojson::value& args, picojson::object& out);
48 void MLTensorsInfoGetTensorName(const picojson::value& args, picojson::object& out);
49 void MLTensorsInfoSetTensorName(const picojson::value& args, picojson::object& out);
50 void MLTensorsInfoGetTensorSize(const picojson::value& args, picojson::object& out);
51 void MLTensorsInfoGetTensorType(const picojson::value& args, picojson::object& out);
52 void MLTensorsInfoSetTensorType(const picojson::value& args, picojson::object& out);
53 void MLTensorsInfoGetTensorsData(const picojson::value& args, picojson::object& out);
54 void MLTensorsInfoClone(const picojson::value& args, picojson::object& out);
55 void MLTensorsInfoEquals(const picojson::value& args, picojson::object& out);
56 void MLTensorsInfoDispose(const picojson::value& args, picojson::object& out);
58 void MLTensorsDataDispose(const picojson::value& args, picojson::object& out);
60 TensorsInfoManager tensors_info_manager_;
61 TensorsDataManager tensors_data_manager_;
65 SingleManager single_manager_;
66 void MLSingleManagerOpenModel(const picojson::value& args, picojson::object& out);
67 // MachineLearningSingle::openModelAsync()
68 // OpenModelSuccessCallback
69 void MLSingleShotGetTensorsInfo(const picojson::value& args, picojson::object& out);
70 void MLSingleShotSetInputInfo(const picojson::value& args, picojson::object& out);
71 // SingleShot::invoke()
72 // SingleShot::getValue()
73 // SingleShot::setValue()
74 // SingleShot::setTimeout()
75 // SingleShot::close()
79 PipelineManager pipeline_manager_;
81 // PipelineManager::createPipeline() begin
82 void MLPipelineManagerCreatePipeline(const picojson::value& args, picojson::object& out);
83 // PipelineManager::createPipeline() end
85 // Pipeline::state begin
86 void MLPipelineGetState(const picojson::value& args, picojson::object& out);
87 // Pipeline::state end
89 // Pipeline::start() begin
90 void MLPipelineStart(const picojson::value& args, picojson::object& out);
91 // Pipeline::start() end
93 // Pipeline::stop() begin
94 void MLPipelineStop(const picojson::value& args, picojson::object& out);
95 // Pipeline::stop() end
97 // Pipeline::dispose() begin
98 void MLPipelineDispose(const picojson::value& args, picojson::object& out);
99 // Pipeline::dispose() end
101 // Pipeline::getNodeInfo() begin
102 void MLPipelineGetNodeInfo(const picojson::value& args, picojson::object& out);
103 // Pipeline::getNodeInfo() end
105 // Pipeline::getSource() begin
107 // Pipeline::getSource() end
109 // Pipeline::getSwitch() begin
110 void MLPipelineGetSwitch(const picojson::value& args, picojson::object& out);
111 // Pipeline::getSwitch() end
113 // Pipeline::getValve() begin
114 void MLPipelineGetValve(const picojson::value& args, picojson::object& out);
115 // Pipeline::getValve() end
117 // Pipeline::registerSinkCallback() begin
119 // Pipeline::registerSinkCallback() end
121 // Pipeline::unregisterSinkCallback() begin
123 // Pipeline::unregisterSinkCallback() end
125 // Pipeline::registerCustomFilter() begin
127 // Pipeline::registerCustomFilter() end
129 // Pipeline::unregisterCustomFilter() begin
131 // Pipeline::unregisterCustomFilter() end
133 // NodeInfo::getProperty() begin
134 void MLPipelineNodeInfoGetProperty(const picojson::value& args, picojson::object& out);
135 // NodeInfo::getProperty() end
137 // NodeInfo::setProperty() begin
138 void MLPipelineNodeInfoSetProperty(const picojson::value& args, picojson::object& out);
139 // NodeInfo::setProperty() end
141 // Source::inputTensorsInfo begin
143 // Source::inputTensorsInfo end
145 // Source::inputData() begin
147 // Source::inputData() end
149 // Switch::getPadList() begin
150 void MLPipelineSwitchGetPadList(const picojson::value& args, picojson::object& out);
151 // Switch::getPadList() end
153 // Switch::select() begin
154 void MLPipelineSwitchSelect(const picojson::value& args, picojson::object& out);
155 // Switch::select() end
157 // Valve::setOpen() begin
159 // Valve::setOpen() end
164 } // namespace extension
166 #endif // ML_ML_INSTANCE_H_