#include "cbe/delegate/QueryDelegate.h"
~~~
#include <condition_variable>
#include <mutex>
~~~
std::mutex mutex{};
std::condition_variable conditionVariable{};
bool called = false;
public:
ErrorInfo errorInfo{};
private:
{
std::lock_guard<std::mutex> lock{mutex};
this->queryResult = std::move(queryResult);
called = true;
errorInfo = ErrorInfo{};
}
conditionVariable.notify_one();
}
{
std::lock_guard<std::mutex> lock{mutex};
errorInfo = ErrorInfo{std::move(context), std::move(error)};
called = true;
}
conditionVariable.notify_one();
}
public:
void waitForRsp() {
std::unique_lock<std::mutex> lock{mutex};
conditionVariable.wait(lock, [this] { return called; });
called = false;
}
};
resultset of data retrieved.
Definition: QueryResult.h:51
Definition: QueryDelegate.h:39
virtual void onQueryError(cbe::delegate::QueryError &&error, cbe::util::Context &&context)=0
virtual void onQuerySuccess(cbe::QueryResult &&queryResult)=0
Definition: QueryError.h:20
DefaultCtor
Default constructor marker.
Definition: Types.h:204
Usage of the class above, see