#include <DownloadChunkQueue.h>
◆ DownloadChunkQueue()
alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::DownloadChunkQueue |
( |
size_t |
expectedSize | ) |
|
|
explicit |
Constructing a new queue to hold downloaded data chunks
- Parameters
-
expectedSize | expected download size. Pushing more or less data before completion signals error unless the user has signaled no size check with the expected size of 0. |
◆ ~DownloadChunkQueue()
virtual alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::~DownloadChunkQueue |
( |
| ) |
|
|
virtual |
◆ popComplete()
bool alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::popComplete |
( |
bool |
succeeded | ) |
|
Consumer signals the completion of reading from queue. Will wait until producer pushComplete or return false if data chunks still available in queue.
- Parameters
-
succeeded | whether the completion is triggered by an error/succes condition |
- Returns
- false if there're still remaining chunks in the queue or download has failed
◆ push()
bool alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::push |
( |
char * |
data, |
|
|
size_t |
size |
|
) |
| |
Producer pushes new data chunk into download queue
- Parameters
-
data | pointer for data chunk |
size | number of bytes in the data chunk |
- Returns
- true when successful, false for invalid argument or if accumulated size exceeds expectedSize
◆ pushComplete()
bool alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::pushComplete |
( |
bool |
succeeded | ) |
|
Producer signals push completion
- Parameters
-
succeeded | whether download succeeded |
- Returns
- whether total downloaded size matches the expected size unless aborted if size check isn't turned off
◆ size()
size_t alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::size |
( |
| ) |
|
Returning number of data chunks in the queue.
- Returns
- number of data chunks in the queue.
◆ waitAndPop()
std::shared_ptr<DataChunk> alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::waitAndPop |
( |
| ) |
|
Blocking wait and get the next data chunk from queue.
- Returns
- next data chunk from the front of the queue, or nullptr if error has been detected or no more data. The last waitAndPop should be followed by popComplte()
The documentation for this class was generated from the following file:
- /workplace/avs-device-sdk/capabilities/DavsClient/acsdkAssetsCommon/include/acsdkAssetsCommon/DownloadChunkQueue.h
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0