PityTest11 is a very flexible C++11 peer-to-peer test framework supporting hierarchically structured test suites, multi-processing, logging, IPC, synchronization and more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include <pEp/pEpLog.hh>
#include <vector>
#include <memory>
#include <unordered_map>
namespace pEp {
namespace PityTest11 {
// Address - Dir
using Endpoints = std::unordered_map<std::string, std::string>;
class PityTransport {
// Constructors
PityTransport() = delete;
explicit PityTransport(std::string inboxDir, Endpoints& endpoints);
// Getters
bool hasMsg() const;
void sendMsg(const std::string nodename, const std::string& msg) const;
// Non-blocking
// throws underflow_error if inbox empty
std::string pollMsg() const;
// Blocking
// Returns when a msg has been received
std::string receiveMsg(int poll_interval = 100) const;
//internal logging
static bool debug_log_enabled;
Adapter::pEpLog::pEpLogger logger_debug{ "PityTransport", debug_log_enabled };
std::string _inboxDir;
Endpoints& _endpoints;
//internal logging
Adapter::pEpLog::pEpLogger& m4gic_logger_n4me = logger_debug;
}; // namespace PityTest11
}; // namespace pEp