AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acsdkAssets::common::DownloadChunkQueue Class Reference

#include <DownloadChunkQueue.h>

Public Member Functions

 DownloadChunkQueue (size_t expectedSize)
virtual ~DownloadChunkQueue ()
size_t size ()
bool push (char *data, size_t size)
bool pushComplete (bool succeeded)
std::shared_ptr< DataChunkwaitAndPop ()
bool popComplete (bool succeeded)

Constructor & Destructor Documentation

◆ DownloadChunkQueue()

alexaClientSDK::acsdkAssets::common::DownloadChunkQueue::DownloadChunkQueue ( size_t  expectedSize)

Constructing a new queue to hold downloaded data chunks

expectedSizeexpected 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 ( )

Member Function Documentation

◆ 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.

succeededwhether the completion is triggered by an error/succes condition
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

datapointer for data chunk
sizenumber of bytes in the data chunk
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

succeededwhether download succeeded
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.

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.

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:

AlexaClientSDK 3.0.0 - Copyright 2016-2022, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0