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_PIPELINE_MANAGER_H_
18 #define ML_ML_PIPELINE_MANAGER_H_
20 #include "common/extension.h"
21 #include "common/picojson.h"
22 #include "common/platform_result.h"
24 #include "ml_pipeline.h"
25 #include "ml_tensors_info_manager.h"
27 using common::PlatformResult;
32 class PipelineManager {
34 PipelineManager(common::Instance* instance_ptr, TensorsInfoManager* tim);
38 PipelineManager() = delete;
39 PipelineManager(const PipelineManager&) = delete;
40 PipelineManager& operator=(const PipelineManager&) = delete;
42 // PipelineManager::createPipeline() begin
43 PlatformResult CreatePipeline(int id, const std::string& definition,
44 const std::string& state_change_listener_name);
45 // PipelineManager::createPipeline() end
47 // Pipeline::state begin
48 PlatformResult GetPipelineState(int id, std::string* out);
49 // Pipeline::state end
51 // Pipeline::start() begin
52 PlatformResult Start(int id);
53 // Pipeline::start() end
55 // Pipeline::stop() begin
56 PlatformResult Stop(int id);
57 // Pipeline::stop() end
59 // Pipeline::dispose() begin
60 PlatformResult DisposePipeline(int id);
61 // Pipeline::dispose() end
63 // Pipeline::getNodeInfo() begin
64 PlatformResult GetNodeInfo(int id, std::string& name);
65 // Pipeline::getNodeInfo() end
67 // Pipeline::getSource() begin
68 PlatformResult GetSource(int pipeline_id, const std::string& name);
69 // Pipeline::getSource() end
71 // Pipeline::getSwitch() begin
72 PlatformResult GetSwitch(const std::string& name, int pipeline_id, std::string* type);
73 // Pipeline::getSwitch() end
75 // Pipeline::getValve() begin
76 PlatformResult GetValve(const std::string& name, int pipeline_id);
77 // Pipeline::getValve() end
79 // Pipeline::registerSinkCallback() begin
81 // Pipeline::registerSinkCallback() end
83 // Pipeline::unregisterSinkCallback() begin
85 // Pipeline::unregisterSinkCallback() end
87 // Pipeline::registerCustomFilter() begin
89 // Pipeline::registerCustomFilter() end
91 // Pipeline::unregisterCustomFilter() begin
93 // Pipeline::unregisterCustomFilter() end
95 // NodeInfo::getProperty() begin
96 PlatformResult getProperty(int id, const std::string& node_name, const std::string& name,
97 const std::string& type, picojson::object* property);
98 // NodeInfo::getProperty() end
100 // NodeInfo::setProperty() begin
101 PlatformResult setProperty(int id, const std::string& node_name, const std::string& name,
102 const std::string& type, const picojson::value& property);
103 // NodeInfo::setProperty() end
105 // Source::inputTensorsInfo begin
106 PlatformResult getInputTensorsInfo(int id, const std::string& name, int* res_id);
107 // Source::inputTensorsInfo end
109 // Source::inputData() begin
111 // Source::inputData() end
113 // Switch::getPadList() begin
114 PlatformResult SwitchGetPadList(int pipeline_id, const std::string& switch_name,
115 picojson::array* out);
116 // Switch::getPadList() end
118 // Switch::select() begin
119 PlatformResult SwitchSelect(int pipeline_id, const std::string& switch_name,
120 const std::string& pad_name);
121 // Switch::select() end
123 // Valve::setOpen() begin
124 PlatformResult ValveSetOpen(int pipeline_id, const std::string& valve_name, bool open);
125 // Valve::setOpen() end
127 // Valve::isOpen() begin
128 PlatformResult ValveIsOpen(int pipeline_id, const std::string& valve_name, bool* open);
129 // Valve::isOpen() end
131 common::Instance* instance_ptr_;
132 TensorsInfoManager* tensors_info_manager_;
133 std::map<int, std::unique_ptr<Pipeline>> pipelines_;
137 } // namespace extension
139 #endif // ML_ML_PIPELINE_MANAGER_H_