Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / ade / ade / include / execution_engine / backend.hpp
1 // Copyright (C) 2018 Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5
6 #ifndef BACKEND_HPP
7 #define BACKEND_HPP
8
9 #include <memory>
10
11 namespace util
12 {
13     class any;
14 }
15
16 namespace ade
17 {
18
19 class Graph;
20 class Executable;
21 class ExecutionEngineSetupContext;
22
23 class BackendExecutable;
24
25 class ExecutionBackend
26 {
27 public:
28     virtual ~ExecutionBackend() = default;
29
30     virtual void setupExecutionEngine(ExecutionEngineSetupContext& engine) = 0;
31     virtual std::unique_ptr<BackendExecutable> createExecutable(const Graph& graph) = 0;
32 };
33
34 class BackendExecutable
35 {
36 protected:
37     // Backward-compatibility stubs
38     virtual void run()      {};                    // called by run(any)
39     virtual void runAsync() {};                    // called by runAsync(any)
40
41 public:
42     virtual ~BackendExecutable() = default;
43
44     virtual void run(util::any &opaque);           // Triggered by ADE engine
45     virtual void runAsync(util::any &opaque);      // Triggered by ADE engine
46
47     virtual void wait() = 0;
48     virtual void cancel() = 0;
49 };
50 }
51
52 #endif // BACKEND_HPP