future.h Source File

future.h Source File#

SDK qb Runtime Library: future.h Source File
SDK qb Runtime Library v0.28
MCS001-KR
future.h
Go to the documentation of this file.
1
4
5#ifndef MACCEL_FUTURE_H_
6#define MACCEL_FUTURE_H_
7
8#include <stdint.h>
9
10#include <memory>
11#include <vector>
12
13#include "maccel/export.h"
14#include "maccel/ndarray.h"
15#include "maccel/type.h"
16
17namespace mobilint {
18
23
24class FutureImpl;
25
41class MACCEL_EXPORT Future {
42public:
43 Future();
44 ~Future();
45
46 Future(const Future& other) = delete;
47 Future& operator=(const Future& other) = delete;
48 Future(Future&& other) noexcept;
49 Future& operator=(Future&& other) noexcept;
50
61 bool waitFor(int64_t timeout_ms);
62
75 std::vector<NDArray<float>> get(StatusCode& sc);
76
77private:
78 Future(std::unique_ptr<FutureImpl> future_impl);
79
80 std::unique_ptr<FutureImpl> mImpl;
81 bool mOwner = false;
82
83 friend class FutureImpl;
84};
85
87
88} // namespace mobilint
89
90#endif
std::vector< NDArray< float > > get(StatusCode &sc)
Blocks until asynchronous inference completes and retrieves the output.
bool waitFor(int64_t timeout_ms)
Waits for asynchronous inference to complete or until the timeout elapses.
StatusCode
Enumerates status codes for the maccel runtime.
Definition status_code.h:24