/*
* opencog/atoms/rule/RuleLink.h
*
* Copyright (C) 2015, 2022 Linas Vepstas
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License v3 as
* published by the Free Software Foundation and including the exceptions
* at http://opencog.org/wiki/Licenses
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, write to:
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _OPENCOG_RULE_LINK_H
#define _OPENCOG_RULE_LINK_H
#include <opencog/atoms/scope/PrenexLink.h>
namespace opencog
{
/** \addtogroup grp_atomspace
* @{
*/
class RuleLink : public PrenexLink
{
protected:
void init(void);
/// The rewrite term
HandleSeq _implicand;
/// Alternative initializtion to what ScopeLink does.
void extract_variables(void);
public:
RuleLink(const HandleSeq&&, Type=RULE_LINK);
RuleLink(const Handle& vardecl, const Handle& body, const Handle& rewrite);
RuleLink(const Handle& body, const Handle& rewrite);
RuleLink(const RuleLink&) = delete;
RuleLink& operator=(const RuleLink&) = delete;
virtual const HandleSeq& get_implicand(void) { return _implicand; }
virtual bool is_executable() const { return true; }
virtual ValuePtr execute(AtomSpace*, bool);
static Handle factory(const Handle&);
};
LINK_PTR_DECL(RuleLink)
#define createRuleLink CREATE_DECL(RuleLink)
/** @}*/
}
#endif // _OPENCOG_RULE_LINK_H