File ApplicationBufferMap.hpp

Parent directory (SNPE)

Definition (SNPE/ApplicationBufferMap.hpp)

Includes

Included By

Namespaces

Full File Listing

namespace PSNPE
class ApplicationBufferMap
#include <ApplicationBufferMap.hpp>

A class representing the UserBufferMap of Input and Output asynchronous mode.

Public Functions

ApplicationBufferMap()

Constructs a ApplicationBufferMap and returns a handle to it.

Returns

the handle to the created Application Buffer Map

explicit ApplicationBufferMap(const std::unordered_map<std::string, std::vector<uint8_t>> &buffer)

Constructs a ApplicationBufferMap initializes it with the given map.

Parameters

buffer[in] Unordered map to be initialized in the Application Buffer Map

Returns

the handle to the created Application Buffer

void add(const char *name, const std::vector<uint8_t> &buff)

Adds a name and the corresponding buffer to the map.

Parameters
  • name[in] The name of the UserBuffer

  • buffer[in] The vector of the uint8_t data

Note

If a UserBuffer with the same name already exists, the new UserBuffer pointer would be updated.

void add(const char *name, const std::vector<float> &buff)

Adds an entry of (name,buff) to the Application buffer map.

Parameters
  • name[in] Name of the buffer

  • buff[in] Vector of floats

void remove(const char *name) noexcept

Removes a mapping of one UserBuffer and its name by its name.

Parameters

name[in] The name of UserBuffer to be removed

Note

If no UserBuffer with the specified name is found, nothing is done.

size_t size() const noexcept

Returns the size of the Application buffer map.

Returns

The size of the application buffer map

void clear() noexcept

Clears the Application buffer map.

std::vector<uint8_t> getUserBuffer(const char *name) const

Returns the UserBuffer given its name.

Parameters

name[in] The name of the UserBuffer to get.

Returns

nullptr if no UserBuffer with the specified name is found; otherwise, a valid pointer to the UserBuffer.

std::vector<uint8_t> operator[](const char *name) const

Gets a user buffer from Application buffer map.

Parameters

name[in] Name of the buffer to be retrieved

Returns

A vector containing the contents of the user buffer

DlSystem::StringList getUserBufferNames() const

Returns the list of names of user Buffer in Application Buffer Map.

Returns

A StringList of User buffer names

std::unordered_map<std::string, std::vector<uint8_t>> getUserBuffer() const

Gets all the user buffers from Application buffer map.

Returns

A map of all user buffers (name, buffer) present in the Application Buffer