Skip to content
Snippets Groups Projects
Commit 5398cbea authored by Adam Wardyński's avatar Adam Wardyński
Browse files

Base class for predicates that operate on two sets

parent fa524598
Branches
No related merge requests found
#ifndef SETPREDICATE_H
#define SETPREDICATE_H
#include <boost/shared_ptr.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/count.hpp>
#include <libwccl/ops/predicate.h>
#include <libwccl/ops/formatters.h>
namespace Wccl {
/**
* Abstract base class for predicates which operate on two sets
*/
template<class T>
class SetPredicate : public Predicate {
BOOST_MPL_ASSERT(( boost::mpl::count<boost::mpl::list<StrSet, TSet>, T> ));
public:
typedef boost::shared_ptr<Function<T> > SetFunctionPtr;
SetPredicate(const SetFunctionPtr& set1_expr, const SetFunctionPtr& set2_expr)
: set1_expr_(set1_expr), set2_expr_(set2_expr)
{
BOOST_ASSERT(set1_expr_);
BOOST_ASSERT(set2_expr_);
}
virtual std::string to_string(const Corpus2::Tagset& tagset) const {
return BinaryFunctionFormatter::to_string(tagset, *this, *set1_expr_, *set2_expr_);
}
virtual std::string to_raw_string() const {
return BinaryFunctionFormatter::to_raw_string(*this, *set1_expr_, *set2_expr_);
}
protected:
const SetFunctionPtr set1_expr_;
const SetFunctionPtr set2_expr_;
typedef FunctionBase::BaseRetValPtr BaseRetValPtr;
};
} /* end ns Wccl */
#endif // SETPREDICATE_H
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment