20 using namespace opencog;
42 scm_wrong_type_arg_msg(subrname, pos, satom,
"opencog atom");
56 if (nnn) name = nnn->getName();
57 SCM str = scm_from_utf8_string(name.c_str());
66 SCM str = scm_from_utf8_string(tname.c_str());
67 SCM sym = scm_string_to_symbol(str);
77 if (lll) ari = lll->getArity();
80 SCM sari = scm_from_ushort(ari);
98 scm_remember_upto_here_1(stv);
143 if (NULL == lll)
return SCM_EOL;
145 const HandleSeq& oset = lll->getOutgoingSet();
148 for (
int i = oset.size()-1; i >= 0; i--)
152 list = scm_cons (smob, list);
172 head = scm_cons(smob, head);
191 std::list<Handle> handle_set;
197 std::list<Handle>::iterator i;
198 for (i = handle_set.begin(); i != handle_set.end(); ++i) {
201 SCM rc = scm_call_1(proc, smob);
202 if (!scm_is_false(rc))
return rc;
221 SCM str = scm_from_utf8_string(tname.c_str());
222 SCM sym = scm_string_to_symbol(str);
223 list = scm_cons(sym, list);
238 std::vector<Type> subl;
241 for (
unsigned int i=0; i<ns; i++) {
244 SCM str = scm_from_utf8_string(tname.c_str());
245 SCM sym = scm_string_to_symbol(str);
246 list = scm_cons(sym, list);
257 if (scm_is_true(scm_symbol_p(stype)))
258 stype = scm_symbol_to_string(stype);
260 static_assert(2 ==
sizeof(
Type),
261 "*** Code currently assumes types are shorts! ***");
263 if (scm_is_false(scm_string_p(stype)))
264 return scm_from_ushort(NOTYPE);
266 const char * ct = scm_i_string_chars(stype);
269 return scm_from_ushort(t);
277 if (scm_is_integer(stype)) {
278 Type t = scm_to_ushort(stype);
284 if (scm_is_true(scm_symbol_p(stype)))
285 stype = scm_symbol_to_string(stype);
287 if (scm_is_false(scm_string_p(stype)))
290 const char * ct = scm_i_string_chars(stype);
293 if (NOTYPE == t)
return SCM_BOOL_F;
303 if (scm_is_integer(stype)) {
304 Type t = scm_to_ushort(stype);
310 if (scm_is_true(scm_symbol_p(stype)))
311 stype = scm_symbol_to_string(stype);
313 if (scm_is_false(scm_string_p(stype)))
316 const char * ct = scm_i_string_chars(stype);
319 if (NOTYPE == t)
return SCM_BOOL_F;
320 if (
false ==
classserver().isA(t, NODE))
return SCM_BOOL_F;
330 if (scm_is_integer(stype)) {
331 Type t = scm_to_ushort(stype);
337 if (scm_is_true(scm_symbol_p(stype)))
338 stype = scm_symbol_to_string(stype);
340 if (scm_is_false(scm_string_p(stype)))
343 const char * ct = scm_i_string_chars(stype);
346 if (NOTYPE == t)
return SCM_BOOL_F;
347 if (
false ==
classserver().isA(t, LINK))
return SCM_BOOL_F;
357 if (scm_is_true(scm_symbol_p(stype)))
358 stype = scm_symbol_to_string(stype);
360 if (scm_is_false(scm_string_p(stype)))
363 const char * ct = scm_i_string_chars(stype);
366 if (NOTYPE == parent)
return SCM_BOOL_F;
369 if (scm_is_true(scm_symbol_p(schild)))
370 schild = scm_symbol_to_string(schild);
372 if (scm_is_false(scm_string_p(schild)))
375 const char * cht = scm_i_string_chars(schild);
378 if (NOTYPE == child)
return SCM_BOOL_F;
380 if (
classserver().isA(child, parent))
return SCM_BOOL_T;
AttentionValuePtr getAttentionValue()
static SCM ss_node_type_p(SCM)
static SCM ss_get_types(void)
static SCM ss_inc_vlti(SCM)
static AttentionValue * verify_av(SCM, const char *, int pos=1)
static SCM ss_subtype_p(SCM, SCM)
static SCM take_av(AttentionValue *)
IncomingSet getIncomingSet()
std::vector< Handle > HandleSeq
a list of handles
std::shared_ptr< TruthValue > TruthValuePtr
virtual TruthValuePtr clone() const =0
static SCM ss_incoming_set(SCM)
std::shared_ptr< Link > LinkPtr
void setTruthValue(TruthValuePtr)
Sets the TruthValue object of the atom.
void get_handles_by_type(HandleSeq &appendToHandles, Type type, bool subclass=false) const
ClassServer & classserver(ClassServerFactory *=ClassServer::createInstance)
static SCM ss_get_type(SCM)
static NodePtr NodeCast(const Handle &h)
unsigned long getChildren(Type type, OutputIterator result)
void setAttentionValue(AttentionValuePtr)
Sets the AttentionValue object of the atom.
static const Handle UNDEFINED
Type getNumberOfClasses()
static Type verify_atom_type(SCM, const char *, int pos=1)
static Handle scm_to_handle(SCM)
const std::string & getTypeName(Type type)
AttentionValuePtr clone() const
Returns An AttentionValue* cloned from this AttentionValue.
static LinkPtr LinkCast(const Handle &h)
static SCM ss_map_type(SCM, SCM)
std::vector< LinkPtr > IncomingSet
static SCM take_tv(TruthValue *)
static SCM ss_type_p(SCM)
std::shared_ptr< Node > NodePtr
TruthValuePtr getTruthValue()
Type getType(const std::string &typeName)
static TruthValue * verify_tv(SCM, const char *, int pos=1)
static SCM ss_dec_vlti(SCM)
static SCM ss_outgoing_set(SCM)
static SCM ss_set_tv(SCM, SCM)
unsigned short Type
type of Atoms, represented as short integer (16 bits)
static Handle verify_handle(SCM, const char *, int pos=1)
static SCM ss_set_av(SCM, SCM)
static SCM handle_to_scm(Handle)
static SCM ss_get_subtypes(SCM)
static AtomSpace * ss_get_env_as(const char *)
unsigned short Arity
arity of Links, represented as short integer (16 bits)
static SCM ss_link_type_p(SCM)