AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
InProcessAttachmentWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_ATTACHMENT_INPROCESSATTACHMENTWRITER_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_ATTACHMENT_INPROCESSATTACHMENTWRITER_H_
18 
21 
22 #include "AttachmentWriter.h"
23 
24 namespace alexaClientSDK {
25 namespace avsCommon {
26 namespace avs {
27 namespace attachment {
28 
35 public:
38  using SDSTypeWriter = SDSType::Writer;
39 
47  static std::unique_ptr<InProcessAttachmentWriter> create(
48  std::shared_ptr<SDSType> sds,
49  SDSTypeWriter::Policy policy = SDSTypeWriter::Policy::ALL_OR_NOTHING);
50 
55 
56  std::size_t write(
57  const void* buf,
58  std::size_t numBytes,
59  WriteStatus* writeStatus,
60  std::chrono::milliseconds timeout = std::chrono::milliseconds(0)) override;
61 
62  void close() override;
63 
64 protected:
72  std::shared_ptr<SDSType> sds,
73  SDSTypeWriter::Policy policy = SDSTypeWriter::Policy::ALL_OR_NOTHING);
74 
76  std::shared_ptr<SDSTypeWriter> m_writer;
77 };
78 
79 } // namespace attachment
80 } // namespace avs
81 } // namespace avsCommon
82 } // namespace alexaClientSDK
83 
84 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_ATTACHMENT_INPROCESSATTACHMENTWRITER_H_
std::shared_ptr< SDSTypeWriter > m_writer
The underlying SharedDataStream reader.
Definition: InProcessAttachmentWriter.h:76
InProcessAttachmentWriter(std::shared_ptr< SDSType > sds, SDSTypeWriter::Policy policy=SDSTypeWriter::Policy::ALL_OR_NOTHING)
avsCommon::utils::sds::InProcessSDS SDSType
Type aliases for convenience.
Definition: InProcessAttachmentWriter.h:37
static std::unique_ptr< InProcessAttachmentWriter > create(std::shared_ptr< SDSType > sds, SDSTypeWriter::Policy policy=SDSTypeWriter::Policy::ALL_OR_NOTHING)
SharedDataStream< InProcessSDSTraits > InProcessSDS
Type alias for a SharedDataStream which works between threads in a single process.
Definition: InProcessSDS.h:54
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
SDSType::Writer SDSTypeWriter
Definition: InProcessAttachmentWriter.h:38
std::size_t write(const void *buf, std::size_t numBytes, WriteStatus *writeStatus, std::chrono::milliseconds timeout=std::chrono::milliseconds(0)) override

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