AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MessageStorageInterface.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_CERTIFIEDSENDER_INCLUDE_CERTIFIEDSENDER_MESSAGESTORAGEINTERFACE_H_
17 #define ALEXA_CLIENT_SDK_CERTIFIEDSENDER_INCLUDE_CERTIFIEDSENDER_MESSAGESTORAGEINTERFACE_H_
18 
19 #include <memory>
20 #include <string>
21 #include <queue>
22 
23 namespace alexaClientSDK {
24 namespace certifiedSender {
25 
35 public:
39  struct StoredMessage {
43  StoredMessage() : id{0} {
44  }
45 
53  StoredMessage(int id, const std::string& message, const std::string& uriPathExtension = "") :
54  id{id},
57  }
58 
60  int id;
62  std::string message;
64  std::string uriPathExtension;
65  };
66 
70  virtual ~MessageStorageInterface() = default;
71 
80  virtual bool createDatabase() = 0;
81 
89  virtual bool open() = 0;
90 
94  virtual void close() = 0;
95 
103  virtual bool store(const std::string& message, int* id) = 0;
104 
113  virtual bool store(const std::string& message, const std::string& uriPathExtension, int* id) = 0;
114 
121  virtual bool load(std::queue<StoredMessage>* messageContainer) = 0;
122 
129  virtual bool erase(int messageId) = 0;
130 
137  virtual bool clearDatabase() = 0;
138 };
139 
140 } // namespace certifiedSender
141 } // namespace alexaClientSDK
142 
143 #endif // ALEXA_CLIENT_SDK_CERTIFIEDSENDER_INCLUDE_CERTIFIEDSENDER_MESSAGESTORAGEINTERFACE_H_
virtual bool load(std::queue< StoredMessage > *messageContainer)=0
int id
The unique id which the database associates with this message.
Definition: MessageStorageInterface.h:60
std::string message
The message being stored.
Definition: MessageStorageInterface.h:62
virtual bool store(const std::string &message, int *id)=0
Definition: MessageStorageInterface.h:34
std::string uriPathExtension
The uri of the message.
Definition: MessageStorageInterface.h:64
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
StoredMessage(int id, const std::string &message, const std::string &uriPathExtension="")
Definition: MessageStorageInterface.h:53

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