27 lines
824 B
C++
27 lines
824 B
C++
#pragma once
|
|
#include <string>
|
|
#include <functional>
|
|
#include <vector>
|
|
|
|
namespace MockDDS {
|
|
|
|
// Richer mock for migration smoke-tests:
|
|
// - publish(topic, payload)
|
|
// - subscribe(topic, callback) -> subscription id
|
|
// - unsubscribe(topic, subscription id)
|
|
// - take_last(topic), get_queue(topic)
|
|
// - clear_all()
|
|
// - sequence numbers per topic (as simple integer appended to payload meta)
|
|
|
|
using Subscriber = std::function<void(const std::string &payload)>;
|
|
using SubscriptionId = unsigned long;
|
|
|
|
void publish(const std::string &topic, const std::string &msg);
|
|
SubscriptionId subscribe(const std::string &topic, Subscriber cb);
|
|
void unsubscribe(const std::string &topic, SubscriptionId id);
|
|
std::string take_last(const std::string &topic);
|
|
std::vector<std::string> get_queue(const std::string &topic);
|
|
void clear_all();
|
|
|
|
}
|