OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace / opencog / atoms / value / SectionValue.cc

52 lines · cc ref:
/*
 * opencog/atoms/value/SectionValue.cc
 *
 * Copyright (C) 2015 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.
 */

#include <opencog/util/exceptions.h>
#include <opencog/atoms/value/SectionValue.h>
#include <opencog/atoms/value/ValueFactory.h>

using namespace opencog;

SectionValue::SectionValue(const ValueSeq& vlist) :
	LinkValue(SECTION_VALUE, vlist)
{
	if (2 != _value.size())
		throw SyntaxException(TRACE_INFO,
			"Expecting two args: a name and a connector seq; got %s\n",
			to_string().c_str());
}

SectionValue::SectionValue(ValueSeq&& vlist) :
	LinkValue(SECTION_VALUE, std::move(vlist))
{
	if (2 != _value.size())
		throw SyntaxException(TRACE_INFO,
			"Expecting two args: a name and a connector seq; got %s\n",
			to_string().c_str());
}

// ==============================================================

// Adds factory when library is loaded.
DEFINE_VALUE_FACTORY(SECTION_VALUE,
                     createSectionValue, std::vector<ValuePtr>)