future.h Source File

future.h Source File#

Runtime Library: future.h Source File
Runtime Library v0.30
Mobilint SDK qb
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
24template <typename T>
26
42template <typename T>
43class MACCEL_EXPORT Future {
44public:
45 Future();
46 ~Future();
47
48 Future(const Future& other) = delete;
49 Future& operator=(const Future& other) = delete;
50 Future(Future&& other) noexcept;
51 Future& operator=(Future&& other) noexcept;
52
63 bool waitFor(int64_t timeout_ms);
64
77 std::vector<NDArray<T>> get(StatusCode& sc);
78
79private:
80 Future(std::unique_ptr<FutureImpl<T>> future_impl);
81
82 std::unique_ptr<FutureImpl<T>> mImpl;
83 bool mOwner = false;
84
85 friend class FutureImpl<T>;
86};
87
89
90} // namespace mobilint
91
92#endif
bool waitFor(int64_t timeout_ms)
Waits for asynchronous inference to complete or until the timeout elapses.
std::vector< NDArray< T > > get(StatusCode &sc)
Blocks until asynchronous inference completes and retrieves the output.
StatusCode
Enumerates status codes for the maccel runtime.
Definition status_code.h:26