15 using namespace opencog;
36 std::string name = n->getName();
37 printf(
"Info: my_func instance %d received the node: %s\n",
39 hlist = _as->add_link(LIST_LINK, h);
43 printf(
"Warning: my_func instance %d called with invalid handle\n", _id);
50 throw (RuntimeException(TRACE_INFO,
"I threw an exception %d", _id));
63 printf(
"\nInfo: Start creating a scheme call into C++\n");
73 eval->
eval(
"(define nnn (cog-new-node 'ConceptNode \"Hello World!\"))");
74 std::string rslt = eval->
eval(
"(bingo nnn)");
77 printf(
"Error: failed evaluation\n");
81 printf(
"Info: Result of scheme evaluation is %s", rslt.c_str());
86 rslt = eval->
eval(
"(whoops nnn)");
89 printf(
"XXX ERROR XXX: an error should have been thrown, but wasn't!\n");
93 printf(
"Info: Intentional throw gave the following output:\n%s", rslt.c_str());
96 printf(
"\nInfo: We are done, bye!\n");
std::string eval(const std::string &expr)
ClassServer & classserver(ClassServerFactory *=ClassServer::createInstance)
static NodePtr NodeCast(const Handle &h)
virtual bool eval_error(void)
static const Handle UNDEFINED
Handle my_other_func(Handle h)
MyTestClass(AtomSpace *as, int id)
std::shared_ptr< Node > NodePtr
unsigned short Type
type of Atoms, represented as short integer (16 bits)