31 throw std::runtime_error(
"Cannot create HKLFilterUnaryLogicOperation from null operand.");
44 : m_lhs(
std::move(lhs)), m_rhs(
std::move(
rhs)) {
46 throw std::runtime_error(
"Cannot construct HKLFilterBinaryLogicOperation "
47 "with one or more null-operands.");
53 return "(" +
m_lhs->getDescription() +
" & " +
m_rhs->getDescription() +
")";
58 return m_lhs->isAllowed(hkl) && m_rhs->isAllowed(hkl);
63 return "(" +
m_lhs->getDescription() +
" | " +
m_rhs->getDescription() +
")";
68 return m_lhs->isAllowed(hkl) || m_rhs->isAllowed(hkl);
81 return std::make_shared<const HKLFilterNot>(filter);
95 return std::make_shared<const HKLFilterAnd>(lhs,
rhs);
109 return std::make_shared<HKLFilterOr>(lhs,
rhs);
const std::vector< double > & rhs
std::string getDescription() const noexcept override
Returns a description of the HKLFilterAnd.
bool isAllowed(const Kernel::V3D &hkl) const noexcept override
Returns true if both wrapped filters return true.
HKLFilterBinaryLogicOperation(HKLFilter_const_sptr lhs, HKLFilter_const_sptr rhs)
Stores the left-hand and right-hand side operators, throws exception if either is null.
HKLFilter_const_sptr m_lhs
HKLFilter_const_sptr m_rhs
std::string getDescription() const noexcept override
Returns a description of the HKLFilterNot.
bool isAllowed(const Kernel::V3D &hkl) const noexcept override
Returns true if the wrapped filter returns false and false otherwise.
bool isAllowed(const Kernel::V3D &hkl) const noexcept override
Returns true if either of the wrapped filters returns true.
std::string getDescription() const noexcept override
Returns a description of the HKLFilterOr.
HKLFilter_const_sptr m_operand
HKLFilterUnaryLogicOperation(HKLFilter_const_sptr filter)
Stores the supplied filter, throws exception if filter is null.
std::function< bool(const Kernel::V3D &)> fn() const noexcept
Returns a function object that wraps HKLFilter::isAllowed.
virtual bool isAllowed(const Kernel::V3D &hkl) const =0
MANTID_GEOMETRY_DLL const HKLFilter_const_sptr operator&(const HKLFilter_const_sptr &lhs, const HKLFilter_const_sptr &rhs)
Constructs an HKLFilterAnd from the operands.
std::shared_ptr< const HKLFilter > HKLFilter_const_sptr
MANTID_GEOMETRY_DLL const HKLFilter_const_sptr operator|(const HKLFilter_const_sptr &lhs, const HKLFilter_const_sptr &rhs)
Constructs an HKLFilterOr from the operands.
MANTID_GEOMETRY_DLL const HKLFilter_const_sptr operator~(const HKLFilter_const_sptr &filter)
Constructs an HKLFilterNot from the operand.