AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | List of all members
alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter Class Referenceabstract

#include <AttachmentWriter.h>

Inheritance diagram for alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter:
Inheritance graph
[legend]

Public Types

enum  WriteStatus {
  WriteStatus::OK, WriteStatus::CLOSED, WriteStatus::OK_BUFFER_FULL, WriteStatus::ERROR_BYTES_LESS_THAN_WORD_SIZE,
  WriteStatus::ERROR_INTERNAL, WriteStatus::TIMEDOUT
}
 

Public Member Functions

virtual ~AttachmentWriter ()=default
 
virtual std::size_t write (const void *buf, std::size_t numBytes, WriteStatus *writeStatus, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))=0
 
virtual void close ()=0
 

Detailed Description

A class that provides functionality to write data to an Attachment.

Member Enumeration Documentation

◆ WriteStatus

An enum class to communicate the possible states following a write() call.

Enumerator
OK 

Things are ok.

CLOSED 

The underlying data representation is no longer writeable.

OK_BUFFER_FULL 

The write could not succeed due to the underlying buffer being full.

ERROR_BYTES_LESS_THAN_WORD_SIZE 

The number of bytes in the request is smaller than the word-size of the underlying data representation. This is only posible if the policy is ALL_OR_NOTHING.

ERROR_INTERNAL 

A non-specified error occurred.

TIMEDOUT 

The write timed out. This is only possible if the writer policy is BLOCKING.

Constructor & Destructor Documentation

◆ ~AttachmentWriter()

virtual alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter::~AttachmentWriter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ close()

virtual void alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter::close ( )
pure virtual

The close function. An implementation will take care of any resource management when a writer no longer needs to use an attachment.

Implemented in alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter, and alexaClientSDK::avsCommon::utils::TestableAttachmentWriter.

◆ write()

virtual std::size_t alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter::write ( const void *  buf,
std::size_t  numBytes,
WriteStatus writeStatus,
std::chrono::milliseconds  timeout = std::chrono::milliseconds(0) 
)
pure virtual

The write function.

Parameters
bufThe buffer where data should be copied from.
numBytesThe size of the buffer in bytes.
[out]writeStatusThe out-parameter where the resulting state of the write will be expressed.
timeoutThe 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.
Returns
The number of bytes written as a result of this call.

Implemented in alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter, and alexaClientSDK::avsCommon::utils::TestableAttachmentWriter.


The documentation for this class was generated from the following file:

AlexaClientSDK 1.26.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0