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

#include <InProcessAttachmentWriter.h>

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

Public Types

using SDSType = avsCommon::utils::sds::InProcessSDS
 Type aliases for convenience. More...
 
using SDSTypeWriter = SDSType::Writer
 
- Public Types inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter
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

 ~InProcessAttachmentWriter ()
 
std::size_t write (const void *buf, std::size_t numBytes, WriteStatus *writeStatus, std::chrono::milliseconds timeout=std::chrono::milliseconds(0)) override
 
void close () override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter
virtual ~AttachmentWriter ()=default
 

Static Public Member Functions

static std::unique_ptr< InProcessAttachmentWritercreate (std::shared_ptr< SDSType > sds, SDSTypeWriter::Policy policy=SDSTypeWriter::Policy::ALL_OR_NOTHING)
 

Protected Member Functions

 InProcessAttachmentWriter (std::shared_ptr< SDSType > sds, SDSTypeWriter::Policy policy=SDSTypeWriter::Policy::ALL_OR_NOTHING)
 

Protected Attributes

std::shared_ptr< SDSTypeWriterm_writer
 The underlying SharedDataStream reader. More...
 

Detailed Description

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

Note
This class is not thread-safe beyond the thread-safety provided by the underlying SharedDataStream object.

Member Typedef Documentation

◆ SDSType

Type aliases for convenience.

◆ SDSTypeWriter

Constructor & Destructor Documentation

◆ ~InProcessAttachmentWriter()

alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter::~InProcessAttachmentWriter ( )

Destructor.

◆ InProcessAttachmentWriter()

alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter::InProcessAttachmentWriter ( std::shared_ptr< SDSType sds,
SDSTypeWriter::Policy  policy = SDSTypeWriter::Policy::ALL_OR_NOTHING 
)
protected

Constructor.

Parameters
sdsThe underlying SharedDataStream which this object will use.
policyThe policy of the new Writer.

Member Function Documentation

◆ close()

void alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter::close ( )
overridevirtual

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

Implements alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter.

Reimplemented in alexaClientSDK::avsCommon::utils::TestableAttachmentWriter.

◆ create()

std::unique_ptr< InProcessAttachmentWriter > alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter::create ( std::shared_ptr< SDSType sds,
SDSTypeWriter::Policy  policy = SDSTypeWriter::Policy::ALL_OR_NOTHING 
)
static

Create an InProcessAttachmentWriter.

Parameters
sdsThe underlying SharedDataStream which this object will use.
policyThe policy of the new Writer.
Returns
Returns a new InProcessAttachmentWriter, or nullptr if the operation failed.

◆ write()

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

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.

Implements alexaClientSDK::avsCommon::avs::attachment::AttachmentWriter.

Reimplemented in alexaClientSDK::avsCommon::utils::TestableAttachmentWriter.

Member Data Documentation

◆ m_writer

std::shared_ptr<SDSTypeWriter> alexaClientSDK::avsCommon::avs::attachment::InProcessAttachmentWriter::m_writer
protected

The underlying SharedDataStream reader.


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

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