forked from opencog/opencog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide a simpler, better solution for wrapping
- Loading branch information
Showing
4 changed files
with
34 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
* Copyright (c) 2008 Linas Vepstas <[email protected]> | ||
*/ | ||
|
||
#include "BindLink.h" | ||
#include "PatternMatch.h" | ||
#include "PatternSCM.h" | ||
#include "QueryModule.h" | ||
|
||
|
@@ -14,17 +16,28 @@ DECLARE_MODULE(QueryModule); | |
|
||
QueryModule::QueryModule(CogServer& cs) : Module(cs) | ||
{ | ||
pat = NULL; | ||
} | ||
|
||
QueryModule::~QueryModule() | ||
{ | ||
delete pat; | ||
foreach(PatternWrap *pw: _binders) | ||
delete pw; | ||
} | ||
|
||
void QueryModule::init(void) | ||
{ | ||
// Force the constructor to run, so that the scheme initialization | ||
// happens. | ||
pat = new PatternSCM(); | ||
// Run implication, assuming that the argument is a handle to | ||
// an BindLink containing variables and an ImplicationLink. | ||
_binders.push_back(new PatternWrap(bindlink, "cog-bind")); | ||
|
||
// Identical to do_bindlink above, except that it only returns the | ||
// first match. | ||
_binders.push_back(new PatternWrap(single_bindlink, "cog-bind-single")); | ||
|
||
// Run implication, assuming that the argument is a handle to | ||
// an BindLink containing variables and an ImplicationLink | ||
_binders.push_back(new PatternWrap(crisp_logic_bindlink, "cog-bind-crisp")); | ||
|
||
// Mystery function | ||
_binders.push_back(new PatternWrap(pln_bindlink, "cog-bind-pln")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters