SSCMA-Micro CPP SDK  v2.0.0
SSCMA-Micro is a cross-platform machine learning inference framework designed for embedded devices.
ma_transport.h
Go to the documentation of this file.
1 #ifndef _MA_TRANSPORT_H_
2 #define _MA_TRANSPORT_H_
3 
4 #include <core/ma_types.h>
5 #include <ma_config_board.h>
6 
7 #include <cstddef>
8 #include <cstdint>
9 
10 namespace ma {
11 
12 class Transport {
13  public:
14  explicit Transport(ma_transport_type_t type) noexcept : m_initialized(false), m_type(type) {}
15  virtual ~Transport() = default;
16 
17  Transport(const Transport&) = delete;
18  Transport& operator=(const Transport&) = delete;
19 
20  [[nodiscard]] virtual ma_err_t init(const void* config) noexcept = 0;
21  virtual void deInit() noexcept = 0;
22 
23  [[nodiscard]] operator bool() const noexcept { return m_initialized; }
24  [[nodiscard]] ma_transport_type_t getType() const noexcept { return m_type; }
25 
26  [[nodiscard]] virtual size_t available() const noexcept = 0;
27  virtual size_t send(const char* data, size_t length) noexcept = 0;
28  virtual size_t flush() noexcept = 0;
29  virtual size_t receive(char* data, size_t length) noexcept = 0;
30  virtual size_t receiveIf(char* data, size_t length, char delimiter) noexcept = 0;
31 
32  protected:
35 };
36 
37 } // namespace ma
38 
39 #endif // _MA_TRANSPORT_H_
Definition: ma_transport.h:12
virtual size_t send(const char *data, size_t length) noexcept=0
virtual ma_err_t init(const void *config) noexcept=0
virtual size_t flush() noexcept=0
Transport(ma_transport_type_t type) noexcept
Definition: ma_transport.h:14
ma_transport_type_t m_type
Definition: ma_transport.h:34
ma_transport_type_t getType() const noexcept
Definition: ma_transport.h:24
virtual size_t available() const noexcept=0
bool m_initialized
Definition: ma_transport.h:33
virtual ~Transport()=default
virtual size_t receive(char *data, size_t length) noexcept=0
Transport(const Transport &)=delete
virtual void deInit() noexcept=0
virtual size_t receiveIf(char *data, size_t length, char delimiter) noexcept=0
Transport & operator=(const Transport &)=delete
ma_err_t
Definition: ma_types.h:21
ma_transport_type_t
Definition: ma_types.h:235
Definition: ma_cv.cpp:7