6 #include <gtest/gtest.h>
7 #include <knowrob/queries/ConjunctiveBroadcaster.h>
8 #include "knowrob/queries/TokenQueue.h"
9 #include "knowrob/queries/AnswerYes.h"
10 #include "knowrob/queries/Answer.h"
11 #include "knowrob/terms/Numeric.h"
17 ignoreInconsistentAnswers_(ignoreInconsistentAnswers),
18 hasSolution_(false) {}
22 auto answer = std::static_pointer_cast<const Answer>(tok);
23 if (answer->isPositive()) {
24 const uint32_t channelID = channel.
id();
30 buffer_[channelID][answer->hashOfAnswer()] = answer;
43 }
else if (answer->isNegative()) {
46 negativeAnswers_.emplace_back(std::static_pointer_cast<const AnswerNo>(answer));
53 auto no = std::make_shared<AnswerNo>();
66 uint32_t pushedChannelID, AnswerMap::iterator it,
AnswerPtr &combinedResult) {
71 }
else if (it->first == pushedChannelID) {
76 }
else if (it->second.size() == 1) {
90 for (
auto &msg: it->second) {
bool ignoreInconsistentAnswers_
ConjunctiveBroadcaster(bool ignoreInconsistentAnswers=true)
std::vector< AnswerNoPtr > negativeAnswers_
void genCombinations(uint32_t pushedChannelID, AnswerMap::iterator it, AnswerPtr &combinedResult)
void push(Channel &channel, const TokenPtr &tok) override
void push(const TokenPtr &tok) override
virtual void push(Channel &channel, const TokenPtr &tok)
std::list< std::shared_ptr< Channel > > channels_
std::shared_ptr< const Token > TokenPtr
AnswerPtr mergeAnswers(const AnswerPtr &a, const AnswerPtr &b, bool ignoreInconsistencies)
std::shared_ptr< const Answer > AnswerPtr