PahoMqttCpp
MQTT C++ Client for POSIX and Windows
Toggle main menu visibility
Loading...
Searching...
No Matches
iclient_persistence.h
Go to the documentation of this file.
1
7
8
/*******************************************************************************
9
* Copyright (c) 2013-2016 Frank Pagliughi <fpagliughi@mindspring.com>
10
*
11
* All rights reserved. This program and the accompanying materials
12
* are made available under the terms of the Eclipse Public License v2.0
13
* and Eclipse Distribution License v1.0 which accompany this distribution.
14
*
15
* The Eclipse Public License is available at
16
* http://www.eclipse.org/legal/epl-v20.html
17
* and the Eclipse Distribution License is available at
18
* http://www.eclipse.org/org/documents/edl-v10.php.
19
*
20
* Contributors:
21
* Frank Pagliughi - initial implementation and documentation
22
*******************************************************************************/
23
24
#ifndef __mqtt_iclient_persistence_h
25
#define __mqtt_iclient_persistence_h
26
27
#include <vector>
28
29
#include "MQTTAsync.h"
30
#include "
mqtt/buffer_view.h
"
31
#include "
mqtt/string_collection.h
"
32
#include "
mqtt/types.h
"
33
34
namespace
mqtt
{
35
42
inline
void
*
persistence_malloc
(
size_t
n) {
return
MQTTAsync_malloc(n); }
43
48
inline
void
persistence_free
(
void
* p) { MQTTAsync_free(p); }
49
51
69
class
iclient_persistence
70
{
71
friend
class
async_client
;
72
friend
class
mock_persistence
;
73
75
static
int
persistence_open(
76
void
** handle,
const
char
* clientID,
const
char
* serverURI,
void
* context
77
);
78
static
int
persistence_close(
void
* handle);
79
static
int
persistence_put(
80
void
* handle,
char
* key,
int
bufcount,
char
* buffers[],
int
buflens[]
81
);
82
static
int
persistence_get(
void
* handle,
char
* key,
char
** buffer,
int
* buflen);
83
static
int
persistence_remove(
void
* handle,
char
* key);
84
static
int
persistence_keys(
void
* handle,
char
***
keys
,
int
* nkeys);
85
static
int
persistence_clear(
void
* handle);
86
static
int
persistence_containskey(
void
* handle,
char
* key);
87
88
public
:
90
using
ptr_t
= std::shared_ptr<iclient_persistence>;
92
using
const_ptr_t
= std::shared_ptr<const iclient_persistence>;
93
97
virtual
~iclient_persistence
() {}
105
virtual
void
open
(
const
string
& clientId,
const
string
& serverURI) = 0;
109
virtual
void
close
() = 0;
113
virtual
void
clear
() = 0;
119
virtual
bool
contains_key
(
const
string
& key) = 0;
124
virtual
string_collection
keys
()
const
= 0;
130
virtual
void
put
(
const
string
& key,
const
std::vector<string_view>& bufs) = 0;
136
virtual
string
get
(
const
string
& key)
const
= 0;
141
virtual
void
remove
(
const
string
& key) = 0;
142
};
143
145
using
iclient_persistence_ptr
=
iclient_persistence::ptr_t
;
146
148
using
const_iclient_persistence_ptr
=
iclient_persistence::const_ptr_t
;
149
151
}
// namespace mqtt
152
153
#endif
// __mqtt_iclient_persistence_h
buffer_view.h
mqtt::iclient_persistence
Definition
iclient_persistence.h:70
mqtt::iclient_persistence::open
virtual void open(const string &clientId, const string &serverURI)=0
mqtt::iclient_persistence::close
virtual void close()=0
mqtt::iclient_persistence::const_ptr_t
std::shared_ptr< const iclient_persistence > const_ptr_t
Definition
iclient_persistence.h:92
mqtt::iclient_persistence::get
virtual string get(const string &key) const =0
mqtt::iclient_persistence::contains_key
virtual bool contains_key(const string &key)=0
mqtt::iclient_persistence::ptr_t
std::shared_ptr< iclient_persistence > ptr_t
Definition
iclient_persistence.h:90
mqtt::iclient_persistence::put
virtual void put(const string &key, const std::vector< string_view > &bufs)=0
mqtt::iclient_persistence::~iclient_persistence
virtual ~iclient_persistence()
Definition
iclient_persistence.h:97
mqtt::iclient_persistence::async_client
friend class async_client
Definition
iclient_persistence.h:71
mqtt::iclient_persistence::keys
virtual string_collection keys() const =0
mqtt::iclient_persistence::clear
virtual void clear()=0
mqtt::iclient_persistence::mock_persistence
friend class mock_persistence
Definition
iclient_persistence.h:72
mqtt::iclient_persistence::remove
virtual void remove(const string &key)=0
mqtt::string_collection
Definition
string_collection.h:45
mqtt
Definition
async_client.h:60
mqtt::iclient_persistence_ptr
iclient_persistence::ptr_t iclient_persistence_ptr
Definition
iclient_persistence.h:145
mqtt::const_iclient_persistence_ptr
iclient_persistence::const_ptr_t const_iclient_persistence_ptr
Definition
iclient_persistence.h:148
mqtt::persistence_free
void persistence_free(void *p)
Definition
iclient_persistence.h:48
mqtt::persistence_malloc
void * persistence_malloc(size_t n)
Definition
iclient_persistence.h:42
string_collection.h
types.h
Generated on
for PahoMqttCpp by
1.17.0