![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <TestableAttachmentWriter.h>
Public Member Functions | |
TestableAttachmentWriter (std::shared_ptr< avsCommon::utils::sds::InProcessSDS > dummySDS, std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter > writer) | |
std::size_t | write (const void *buf, std::size_t numBytes, WriteStatus *writeStatus, std::chrono::milliseconds timeout) override |
void | close () override |
![]() | |
~InProcessAttachmentWriter () | |
![]() | |
virtual | ~AttachmentWriter ()=default |
A version of the Decorator Pattern, this class allows us to simulate pausing writes without requiring an actual (slow) AttachmentReader anywhere in the test code. Besides this small change in functionality, all real work is done by the encapsulated InProcessAttachmentWriter object.
alexaClientSDK::avsCommon::utils::TestableAttachmentWriter::TestableAttachmentWriter | ( | std::shared_ptr< avsCommon::utils::sds::InProcessSDS > | dummySDS, |
std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter > | writer | ||
) |
Constructor.
dummySDS | An SDS used to instantiate this class, although it will never be used. This is to avert any risk of this wrapper object being created with a nullptr. |
writer | The AttachmentWriter object to be wrapped by this class. |
|
overridevirtual |
The close function. An implementation will take care of any resource management when a writer no longer needs to use an attachment.
Reimplemented from alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter.
|
overridevirtual |
The write function.
buf | The buffer where data should be copied from. | |
numBytes | The size of the buffer in bytes. | |
[out] | writeStatus | The out-parameter where the resulting state of the write will be expressed. |
timeout | The maximum time to wait (if policy is BLOCKING ) for space to write into. If this parameter is zero, there is no timeout and blocking writes will wait forever. If policy is not BLOCKING, this parameter is ignored. |
Reimplemented from alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0