OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
opencog::SchemeSmob Class Reference

#include <SchemeSmob.h>

Static Public Member Functions

static void init ()
 
static AtomSpacess_get_env_as (const char *)
 
static SCM handle_to_scm (Handle)
 
static Handle scm_to_handle (SCM)
 
static std::string to_string (Handle)
 
static std::string as_to_string (const AtomSpace *)
 
static std::string av_to_string (const AttentionValue *)
 
static std::string tv_to_string (const TruthValue *)
 

Private Types

enum  {
  COG_UUID = 1, COG_HANDLE, COG_TV, COG_AV,
  COG_AS, COG_EXTEND
}
 

Private Member Functions

 SchemeSmob ()
 

Static Private Member Functions

static void register_procs (void *)
 
static void register_proc (const char *, int, int, int, scm_t_subr)
 
static void init_smob_type (void)
 
static int print_misc (SCM, SCM, scm_print_state *)
 
static SCM equalp_misc (SCM, SCM)
 
static SCM mark_misc (SCM)
 
static size_t free_misc (SCM)
 
static SCM ss_new_node (SCM, SCM, SCM)
 
static SCM ss_new_link (SCM, SCM)
 
static SCM ss_node (SCM, SCM, SCM)
 
static SCM ss_link (SCM, SCM)
 
static SCM ss_delete (SCM, SCM)
 
static SCM ss_delete_recursive (SCM, SCM)
 
static SCM ss_purge (SCM, SCM)
 
static SCM ss_purge_recursive (SCM, SCM)
 
static SCM ss_atom_p (SCM)
 
static SCM ss_node_p (SCM)
 
static SCM ss_link_p (SCM)
 
static SCM ss_atom (SCM)
 
static SCM ss_handle (SCM)
 
static SCM ss_undefined_handle (void)
 
static SCM ss_set_av (SCM, SCM)
 
static SCM ss_set_tv (SCM, SCM)
 
static SCM ss_inc_vlti (SCM)
 
static SCM ss_dec_vlti (SCM)
 
static SCM ss_name (SCM)
 
static SCM ss_type (SCM)
 
static SCM ss_arity (SCM)
 
static SCM ss_av (SCM)
 
static SCM ss_tv (SCM)
 
static SCM ss_incoming_set (SCM)
 
static SCM ss_outgoing_set (SCM)
 
static SCM ss_map_type (SCM, SCM)
 
static SCM ss_get_types (void)
 
static SCM ss_get_type (SCM)
 
static SCM ss_type_p (SCM)
 
static SCM ss_node_type_p (SCM)
 
static SCM ss_link_type_p (SCM)
 
static SCM ss_get_subtypes (SCM)
 
static SCM ss_subtype_p (SCM, SCM)
 
static SCM ss_new_stv (SCM, SCM)
 
static SCM ss_new_ctv (SCM, SCM, SCM)
 
static SCM ss_new_itv (SCM, SCM, SCM)
 
static SCM ss_new_ptv (SCM, SCM, SCM)
 
static SCM ss_new_ftv (SCM, SCM)
 
static SCM ss_tv_p (SCM)
 
static SCM tv_p (SCM, TruthValueType)
 
static SCM ss_stv_p (SCM)
 
static SCM ss_ctv_p (SCM)
 
static SCM ss_itv_p (SCM)
 
static SCM ss_ptv_p (SCM)
 
static SCM ss_ftv_p (SCM)
 
static SCM take_tv (TruthValue *)
 
static SCM tv_to_scm (TruthValuePtr)
 
static SCM ss_tv_get_value (SCM)
 
static SCM ss_new_as (SCM)
 
static SCM ss_as_p (SCM)
 
static SCM ss_get_as (void)
 
static SCM ss_set_as (SCM)
 
static SCM take_as (AtomSpace *)
 
static SCM make_as (AtomSpace *)
 
static AtomSpacess_to_atomspace (SCM)
 
static void as_ref_count (SCM, AtomSpace *)
 
static SCM ss_new_av (SCM, SCM, SCM)
 
static SCM ss_av_p (SCM)
 
static SCM take_av (AttentionValue *)
 
static SCM ss_av_get_value (SCM)
 
static SCM ss_af_boundary (void)
 
static SCM ss_set_af_boundary (SCM)
 
static SCM ss_af (void)
 
static SCM ss_ad_hoc (SCM, SCM)
 
static std::string to_string (SCM)
 
static TruthValuePtr to_tv (SCM)
 
static std::string handle_to_string (SCM)
 
static std::string handle_to_string (Handle, int)
 
static std::string misc_to_string (SCM)
 
static TruthValueget_tv_from_list (SCM)
 
static AttentionValueget_av_from_list (SCM)
 
static AtomSpaceget_as_from_list (SCM)
 
static void throw_exception (const char *, const char *)
 
static Type verify_atom_type (SCM, const char *, int pos=1)
 
static Handle verify_handle (SCM, const char *, int pos=1)
 
static TruthValueverify_tv (SCM, const char *, int pos=1)
 
static AttentionValueverify_av (SCM, const char *, int pos=1)
 
static std::vector< Handleverify_handle_list (SCM, const char *, int pos=1)
 
static std::string verify_string (SCM, const char *, int pos=1, const char *msg="expecting string")
 
static int verify_int (SCM, const char *, int pos=1, const char *msg="expecting integer")
 
static void ss_set_env_as (AtomSpace *)
 

Static Private Attributes

static std::atomic_flag is_inited = ATOMIC_FLAG_INIT
 
static scm_t_bits cog_misc_tag
 
static SCM _radix_ten
 
static std::mutex as_mtx
 
static std::map< AtomSpace *, int > deleteable_as
 
static SCM atomspace_fluid
 

Friends

class SchemeEval
 
class PrimitiveEnviron
 
template<typename TT >
class SchemePrimitive
 

Detailed Description

Definition at line 36 of file SchemeSmob.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
COG_UUID 
COG_HANDLE 
COG_TV 
COG_AV 
COG_AS 
COG_EXTEND 

Definition at line 44 of file SchemeSmob.h.

Constructor & Destructor Documentation

SchemeSmob::SchemeSmob ( )
private

Definition at line 56 of file SchemeSmob.cc.

References init().

Member Function Documentation

void SchemeSmob::as_ref_count ( SCM  old_as,
AtomSpace nas 
)
staticprivate

The current atomspace for the current thread must not be deleted under any circumstances. Thus each thread increments a use-count on the atomspace (stored in deleteable_as). Atomspaces that are not current in any thread, and also have no SCM mobs pointing at them may be deleted by the gc. This will cause atoms to disappear, if the user is not careful ...

Oh, wait: only atomspaces that were interanlly created (i.e. created by a scheme call) are eligible for deletion. We may also be given atomspaces that magically appeared from the outside world — we do NOT track those for deletion.

Definition at line 139 of file SchemeSmobAS.cc.

References as_mtx, deleteable_as, and ss_to_atomspace().

+ Here is the caller graph for this function:

std::string SchemeSmob::as_to_string ( const AtomSpace as)
static

Definition at line 30 of file SchemeSmobAS.cc.

References BUFLEN.

+ Here is the caller graph for this function:

std::string SchemeSmob::av_to_string ( const AttentionValue av)
static

Definition at line 50 of file SchemeSmobAV.cc.

References BUFLEN, opencog::AttentionValue::getLTI(), opencog::AttentionValue::getSTI(), and opencog::AttentionValue::getVLTI().

+ Here is the caller graph for this function:

SCM SchemeSmob::equalp_misc ( SCM  a,
SCM  b 
)
staticprivate

Definition at line 80 of file SchemeSmob.cc.

References av, COG_AS, COG_AV, COG_EXTEND, COG_HANDLE, cog_misc_tag, COG_TV, and scm_to_handle().

+ Here is the caller graph for this function:

size_t SchemeSmob::free_misc ( SCM  node)
staticprivate

Free the memory associated with an opencog guile object. This routine is called by the guile garbage collector, from time to time. For testing purposes, you can force the garbage collector to run by saying (gc), while, for stats, try (gc-stats) and (gc-live-object-stats). The later should show both "opencog-handle" and "opencog-misc" stats.

Definition at line 57 of file SchemeSmobGC.cc.

References as_mtx, av, COG_AS, COG_AV, COG_EXTEND, COG_HANDLE, COG_TV, deleteable_as, opencog::PrimitiveEnviron::get_size(), and tv.

+ Here is the caller graph for this function:

AtomSpace * SchemeSmob::get_as_from_list ( SCM  slist)
staticprivate

Search for an atomspace in a list of values. Return the atomspace if found, else return null. Throw errors if the list is not stictly just key-value pairs

Definition at line 205 of file SchemeSmobAS.cc.

References ss_to_atomspace().

+ Here is the caller graph for this function:

AttentionValue * SchemeSmob::get_av_from_list ( SCM  slist)
staticprivate

Search for an attention value in a list of values. Return the attention value if found, else return null. Throw errors if the list is not stictly just key-value pairs

Definition at line 25 of file SchemeSmobAV.cc.

References COG_AV, and cog_misc_tag.

+ Here is the caller graph for this function:

TruthValue * SchemeSmob::get_tv_from_list ( SCM  slist)
staticprivate

Search for a truth value in a list of values. Return the truth value if found, else return null. Throw errors if the list is not stictly just key-value pairs

Definition at line 103 of file SchemeSmobTV.cc.

References cog_misc_tag, and COG_TV.

+ Here is the caller graph for this function:

SCM SchemeSmob::handle_to_scm ( Handle  h)
static

Wrapper – given a handle, return the corresponding scheme object. Note that smobs hold the integer value of the handle, and not the C++ handle object itself.

Definition at line 130 of file SchemeSmobNew.cc.

References COG_HANDLE, and cog_misc_tag.

+ Here is the caller graph for this function:

std::string SchemeSmob::handle_to_string ( SCM  node)
staticprivate

Definition at line 117 of file SchemeSmobNew.cc.

References scm_to_handle().

+ Here is the caller graph for this function:

void SchemeSmob::init ( void  )
static

Definition at line 43 of file SchemeSmob.cc.

References _radix_ten, atomspace_fluid, init_smob_type(), is_inited, and register_procs().

+ Here is the caller graph for this function:

void SchemeSmob::init_smob_type ( void  )
staticprivate

Definition at line 68 of file SchemeSmob.cc.

References cog_misc_tag, equalp_misc(), free_misc(), and print_misc().

+ Here is the caller graph for this function:

SCM SchemeSmob::make_as ( AtomSpace as)
staticprivate

Create SCM object wrapping the atomspace. Do NOT take over memory management of it!

Definition at line 44 of file SchemeSmobAS.cc.

References COG_AS, and cog_misc_tag.

+ Here is the caller graph for this function:

SCM SchemeSmob::mark_misc ( SCM  misc_smob)
staticprivate

Definition at line 20 of file SchemeSmobGC.cc.

References COG_AS, COG_AV, COG_EXTEND, COG_HANDLE, and COG_TV.

std::string SchemeSmob::misc_to_string ( SCM  node)
staticprivate

Definition at line 125 of file SchemeSmobGC.cc.

References as_to_string(), av_to_string(), COG_AS, COG_AV, COG_EXTEND, COG_HANDLE, COG_TV, opencog::PrimitiveEnviron::get_name(), handle_to_string(), and tv_to_string().

+ Here is the caller graph for this function:

int SchemeSmob::print_misc ( SCM  node,
SCM  port,
scm_print_state *  ps 
)
staticprivate

Definition at line 166 of file SchemeSmobGC.cc.

References misc_to_string().

+ Here is the caller graph for this function:

void SchemeSmob::register_proc ( const char *  name,
int  req,
int  opt,
int  rst,
scm_t_subr  fcn 
)
staticprivate

Definition at line 262 of file SchemeSmob.cc.

+ Here is the caller graph for this function:

Handle SchemeSmob::scm_to_handle ( SCM  sh)
static

Definition at line 144 of file SchemeSmobNew.cc.

References COG_HANDLE, cog_misc_tag, and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_ad_hoc ( SCM  command,
SCM  optargs 
)
staticprivate

Dispatcher to invoke various miscellaneous C++ riff-raff from scheme code.

Definition at line 22 of file SchemeAdHoc.cc.

References python.atom_type_names::atomspace, handle_to_scm(), verify_handle(), and verify_string().

SCM SchemeSmob::ss_af ( void  )
staticprivate

Return the list of atoms in the AttentionalFocus

Definition at line 61 of file SchemeSmobAF.cc.

References python.atom_type_names::atomspace, opencog::AtomSpace::get_handle_set_in_attentional_focus(), handle_to_scm(), and ss_get_env_as().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_af_boundary ( void  )
staticprivate

Return AttentionalFocus Boundary

Definition at line 38 of file SchemeSmobAF.cc.

References python.atom_type_names::atomspace, opencog::AtomSpace::get_attentional_focus_boundary(), and ss_get_env_as().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_arity ( SCM  satom)
staticprivate

Definition at line 72 of file SchemeSmobAtom.cc.

References opencog::LinkCast(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_as_p ( SCM  s)
staticprivate

Return true if the scm is an atom space

Definition at line 84 of file SchemeSmobAS.cc.

References COG_AS, and cog_misc_tag.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_atom ( SCM  suuid)
staticprivate

Create a new scheme object, holding the atom uuid

Definition at line 162 of file SchemeSmobNew.cc.

References handle_to_scm().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_atom_p ( SCM  s)
staticprivate

Return true if s is an atom

Definition at line 197 of file SchemeSmobNew.cc.

References COG_HANDLE, and cog_misc_tag.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_av ( SCM  satom)
staticprivate

Definition at line 102 of file SchemeSmobAtom.cc.

References opencog::Atom::getAttentionValue(), take_av(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_av_get_value ( SCM  s)
staticprivate

Return association list holding contents of an attention value

Definition at line 137 of file SchemeSmobAV.cc.

References av, opencog::AttentionValue::getLTI(), opencog::AttentionValue::getSTI(), opencog::AttentionValue::getVLTI(), and verify_av().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_av_p ( SCM  s)
staticprivate

Return true if the scm is an attention value

Definition at line 102 of file SchemeSmobAV.cc.

References COG_AV, and cog_misc_tag.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_ctv_p ( SCM  s)
staticprivate

Definition at line 326 of file SchemeSmobTV.cc.

References opencog::COUNT_TRUTH_VALUE, and tv_p().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_dec_vlti ( SCM  satom)
staticprivate

Definition at line 126 of file SchemeSmobAtom.cc.

References opencog::Atom::decVLTI(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_delete ( SCM  satom,
SCM  kv_pairs 
)
staticprivate

Delete the atom, but only if it has no incoming links. Return SCM_BOOL_T if the atom was deleted, else return SCM_BOOL_F This deletes the atom from both the atomspace, and any attached backing store; thus deletion is permanent!

Definition at line 513 of file SchemeSmobNew.cc.

References python.atom_type_names::atomspace, get_as_from_list(), opencog::Atom::getIncomingSetSize(), opencog::AtomSpace::remove_atom(), ss_get_env_as(), opencog::Handle::UNDEFINED, and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_delete_recursive ( SCM  satom,
SCM  kv_pairs 
)
staticprivate

Delete the atom, and everything pointing to it. This deletes the atom from both the atomspace, and any attached backing store; thus deletion is permanent!

Definition at line 547 of file SchemeSmobNew.cc.

References python.atom_type_names::atomspace, get_as_from_list(), opencog::AtomSpace::remove_atom(), ss_get_env_as(), opencog::Handle::UNDEFINED, and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_ftv_p ( SCM  s)
staticprivate

Definition at line 341 of file SchemeSmobTV.cc.

References opencog::FUZZY_TRUTH_VALUE, and tv_p().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_get_as ( void  )
staticprivate

Definition at line 122 of file SchemeSmobAS.cc.

References atomspace_fluid.

+ Here is the caller graph for this function:

AtomSpace * SchemeSmob::ss_get_env_as ( const char *  subr)
static

Definition at line 188 of file SchemeSmobAS.cc.

References atomspace_fluid, and ss_to_atomspace().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_get_subtypes ( SCM  stype)
staticprivate

Return a list of the subtypes of the indicated type

Definition at line 233 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::ClassServer::getChildren(), opencog::ClassServer::getTypeName(), python.undocumented.blocksworld::t, and verify_atom_type().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_get_type ( SCM  stype)
staticprivate

Return integer value corresponding to the string type name.

Definition at line 255 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::ClassServer::getType(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_get_types ( void  )
staticprivate

Return a list of all of the atom types in the system.

Definition at line 213 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::ClassServer::getNumberOfClasses(), opencog::ClassServer::getTypeName(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_handle ( SCM  satom)
staticprivate

Return uuid of atom

Definition at line 176 of file SchemeSmobNew.cc.

References scm_to_handle(), opencog::Handle::UNDEFINED, and opencog::Handle::value().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_inc_vlti ( SCM  satom)
staticprivate

Definition at line 118 of file SchemeSmobAtom.cc.

References opencog::Atom::incVLTI(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_incoming_set ( SCM  satom)
staticprivate

Convert the incoming set of an atom into a list; return the list.

Definition at line 162 of file SchemeSmobAtom.cc.

References opencog::Atom::getIncomingSet(), handle_to_scm(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_itv_p ( SCM  s)
staticprivate

Definition at line 331 of file SchemeSmobTV.cc.

References opencog::INDEFINITE_TRUTH_VALUE, and tv_p().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_link ( SCM  stype,
SCM  satom_list 
)
staticprivate

Return the indicated link, of named type stype, holding the indicated atom list, if it exists; else return nil if it does not exist.

Definition at line 479 of file SchemeSmobNew.cc.

References python.atom_type_names::atomspace, av, opencog::AttentionValue::clone(), opencog::TruthValue::clone(), get_as_from_list(), get_av_from_list(), opencog::AtomSpace::get_handle(), get_tv_from_list(), handle_to_scm(), ss_get_env_as(), python.undocumented.blocksworld::t, tv, opencog::Handle::UNDEFINED, verify_atom_type(), and verify_handle_list().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_link_p ( SCM  s)
staticprivate

Return true if s is a link

Definition at line 226 of file SchemeSmobNew.cc.

References opencog::LinkCast(), scm_to_handle(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_link_type_p ( SCM  stype)
staticprivate

Return true if stype is a link type

Definition at line 328 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::ClassServer::getType(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_map_type ( SCM  proc,
SCM  stype 
)
staticprivate

Apply proceedure proc to all atoms of type stype If the proceedure returns something other than #f, terminate the loop.

Definition at line 185 of file SchemeSmobAtom.cc.

References python.atom_type_names::atomspace, opencog::AtomSpace::get_handles_by_type(), handle_to_scm(), ss_get_env_as(), python.undocumented.blocksworld::t, and verify_atom_type().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_name ( SCM  satom)
staticprivate

Return the string name of the atom

Definition at line 51 of file SchemeSmobAtom.cc.

References opencog::NodeCast(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_as ( SCM  s)
staticprivate

Create a new atom space. The parent argument might not be present – its optional.

Definition at line 69 of file SchemeSmobAS.cc.

References deleteable_as, ss_to_atomspace(), and take_as().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_av ( SCM  ssti,
SCM  slti,
SCM  svlti 
)
staticprivate

Create a new attention value, with indicated sti/lti/vlti

Definition at line 80 of file SchemeSmobAV.cc.

References av, and take_av().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_ctv ( SCM  smean,
SCM  sconfidence,
SCM  scount 
)
staticprivate

Definition at line 246 of file SchemeSmobTV.cc.

References take_tv(), and tv.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_ftv ( SCM  smean,
SCM  sconfidence 
)
staticprivate

Definition at line 276 of file SchemeSmobTV.cc.

References opencog::FuzzyTruthValue::confidenceToCount(), take_tv(), and tv.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_itv ( SCM  slower,
SCM  supper,
SCM  sconfidence 
)
staticprivate

Definition at line 256 of file SchemeSmobTV.cc.

References take_tv(), and tv.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_link ( SCM  stype,
SCM  satom_list 
)
staticprivate
SCM SchemeSmob::ss_new_node ( SCM  stype,
SCM  sname,
SCM  kv_pairs 
)
staticprivate
SCM SchemeSmob::ss_new_ptv ( SCM  smean,
SCM  sconfidence,
SCM  scount 
)
staticprivate

Definition at line 266 of file SchemeSmobTV.cc.

References take_tv(), and tv.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_new_stv ( SCM  smean,
SCM  sconfidence 
)
staticprivate

Create a new simple truth value, with indicated mean and confidence.

Definition at line 236 of file SchemeSmobTV.cc.

References opencog::SimpleTruthValue::confidenceToCount(), take_tv(), and tv.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_node ( SCM  stype,
SCM  sname,
SCM  kv_pairs 
)
staticprivate

Return the indicated node, of named type stype, and string name sname if it exists; else return nil if it does not exist. If the node exists, and a truth value was specified, then change the truth value.

Definition at line 349 of file SchemeSmobNew.cc.

References python.atom_type_names::atomspace, av, opencog::AttentionValue::clone(), opencog::TruthValue::clone(), get_as_from_list(), get_av_from_list(), opencog::AtomSpace::get_handle(), get_tv_from_list(), handle_to_scm(), ss_get_env_as(), python.undocumented.blocksworld::t, tv, opencog::Handle::UNDEFINED, verify_atom_type(), and verify_string().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_node_p ( SCM  s)
staticprivate

Return true if s is a node

Definition at line 212 of file SchemeSmobNew.cc.

References opencog::NodeCast(), scm_to_handle(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_node_type_p ( SCM  stype)
staticprivate

Return true if stype is a node type

Definition at line 301 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::ClassServer::getType(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_outgoing_set ( SCM  satom)
staticprivate

Convert the outgoing set of an atom into a list; return the list.

Definition at line 138 of file SchemeSmobAtom.cc.

References handle_to_scm(), opencog::LinkCast(), and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_ptv_p ( SCM  s)
staticprivate

Definition at line 336 of file SchemeSmobTV.cc.

References opencog::PROBABILISTIC_TRUTH_VALUE, and tv_p().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_purge ( SCM  satom,
SCM  kv_pairs 
)
staticprivate

Purge the atom from the atomspace, but only if it has no incoming links. Return SCM_BOOL_T if the atom was deleted, else return SCM_BOOL_F This does NOT remove the atom from any attached backing store, only from the atomspace.

Definition at line 571 of file SchemeSmobNew.cc.

References python.atom_type_names::atomspace, get_as_from_list(), opencog::Atom::getIncomingSetSize(), opencog::AtomSpace::purge_atom(), ss_get_env_as(), opencog::Handle::UNDEFINED, and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_purge_recursive ( SCM  satom,
SCM  kv_pairs 
)
staticprivate

Purge the atom, and everything pointing to it. This does NOT remove the atom from any attached backing store, only from the atomspace.

Definition at line 605 of file SchemeSmobNew.cc.

References python.atom_type_names::atomspace, get_as_from_list(), opencog::AtomSpace::purge_atom(), ss_get_env_as(), opencog::Handle::UNDEFINED, and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_set_af_boundary ( SCM  sboundary)
staticprivate

Set AttentionalFocus Boundary

Definition at line 47 of file SchemeSmobAF.cc.

References python.atom_type_names::atomspace, opencog::AtomSpace::set_attentional_focus_boundary(), and ss_get_env_as().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_set_as ( SCM  new_as)
staticprivate

Set the current atomspace for this dynamic state. Return the previous atomspace.

Definition at line 157 of file SchemeSmobAS.cc.

References as_ref_count(), atomspace_fluid, COG_AS, cog_misc_tag, ss_get_as(), and ss_to_atomspace().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_set_av ( SCM  satom,
SCM  sav 
)
staticprivate

Definition at line 109 of file SchemeSmobAtom.cc.

References av, opencog::AttentionValue::clone(), opencog::Atom::setAttentionValue(), verify_av(), and verify_handle().

+ Here is the caller graph for this function:

void SchemeSmob::ss_set_env_as ( AtomSpace nas)
staticprivate

Set the atomspace into the top-level interaction environment Since its held in a fluid, it can have a different value in each thread, so that different threads can use different atomspaces, all at the same time.

Definition at line 181 of file SchemeSmobAS.cc.

References as_ref_count(), atomspace_fluid, make_as(), and ss_get_as().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_set_tv ( SCM  satom,
SCM  stv 
)
staticprivate

Definition at line 92 of file SchemeSmobAtom.cc.

References opencog::TruthValue::clone(), opencog::Atom::setTruthValue(), tv, verify_handle(), and verify_tv().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_stv_p ( SCM  s)
staticprivate

Definition at line 321 of file SchemeSmobTV.cc.

References opencog::SIMPLE_TRUTH_VALUE, and tv_p().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_subtype_p ( SCM  stype,
SCM  schild 
)
staticprivate

Return true if a subtype

Definition at line 355 of file SchemeSmobAtom.cc.

References opencog::classserver(), and opencog::ClassServer::getType().

+ Here is the caller graph for this function:

AtomSpace * SchemeSmob::ss_to_atomspace ( SCM  sas)
staticprivate

Definition at line 104 of file SchemeSmobAS.cc.

References COG_AS, and cog_misc_tag.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_tv ( SCM  satom)
staticprivate

Definition at line 84 of file SchemeSmobAtom.cc.

References opencog::Atom::getTruthValue(), take_tv(), tv, and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_tv_p ( SCM  s)
staticprivate

Return true if the scm is a truth value

Definition at line 290 of file SchemeSmobTV.cc.

References cog_misc_tag, and COG_TV.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_type ( SCM  satom)
staticprivate

Definition at line 61 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::Atom::getType(), opencog::ClassServer::getTypeName(), python.undocumented.blocksworld::t, and verify_handle().

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_type_p ( SCM  stype)
staticprivate

Return true if stype is an atom type

Definition at line 275 of file SchemeSmobAtom.cc.

References opencog::classserver(), opencog::ClassServer::getType(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

SCM SchemeSmob::ss_undefined_handle ( void  )
staticprivate

Return Handle::UNDEFINED

Definition at line 189 of file SchemeSmobNew.cc.

References opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

SCM SchemeSmob::take_as ( AtomSpace as)
staticprivate

Take over memory management of an atom space

Definition at line 56 of file SchemeSmobAS.cc.

References make_as().

+ Here is the caller graph for this function:

SCM SchemeSmob::take_av ( AttentionValue av)
staticprivate

Take over memory management of an attention value

Definition at line 65 of file SchemeSmobAV.cc.

References COG_AV, and cog_misc_tag.

+ Here is the caller graph for this function:

SCM SchemeSmob::take_tv ( TruthValue tv)
staticprivate

Take over memory management of a truth value

Definition at line 221 of file SchemeSmobTV.cc.

References cog_misc_tag, and COG_TV.

+ Here is the caller graph for this function:

void SchemeSmob::throw_exception ( const char *  msg,
const char *  func 
)
staticprivate

Definition at line 150 of file SchemeSmob.cc.

+ Here is the caller graph for this function:

std::string SchemeSmob::to_string ( SCM  node)
staticprivate

Return a string holding the scheme representation of an atom/truthvalue.

The input is assumed to be pointing at a Handle, a TruthValue, an AttentionValue or a UUID. Returned is a valid scheme expression that represents that Handle, etc.

Definition at line 30 of file SchemeSmobNew.cc.

References cog_misc_tag, and misc_to_string().

std::string SchemeSmob::to_string ( Handle  h)
static

Return a string holding the scheme representation of an atom.

The input handle is represented in terms of a valid scheme expression. Evaluating this expression should result in exactly the same atom being created.

Definition at line 45 of file SchemeSmobNew.cc.

References handle_to_string().

TruthValuePtr SchemeSmob::to_tv ( SCM  s)
staticprivate

Return a fresh copy of truth value.

Definition at line 198 of file SchemeSmobTV.cc.

References opencog::TruthValue::clone(), tv, and verify_tv().

+ Here is the caller graph for this function:

SCM SchemeSmob::tv_p ( SCM  s,
TruthValueType  wanted 
)
inlinestaticprivate

Return true if the scm is a truth value

Definition at line 310 of file SchemeSmobTV.cc.

References opencog::TruthValue::getType(), ss_tv_p(), and tv.

+ Here is the caller graph for this function:

SCM SchemeSmob::tv_to_scm ( TruthValuePtr  tvp)
staticprivate

Import a truth value

Definition at line 213 of file SchemeSmobTV.cc.

References take_tv().

+ Here is the caller graph for this function:

Type SchemeSmob::verify_atom_type ( SCM  stype,
const char *  subrname,
int  pos = 1 
)
staticprivate

Check that the argument is the string or symbol name of an atom, else throw errors. Return the atom type.

Definition at line 242 of file SchemeSmobNew.cc.

References opencog::classserver(), opencog::ClassServer::getType(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

AttentionValue * SchemeSmob::verify_av ( SCM  sav,
const char *  subrname,
int  pos = 1 
)
staticprivate

Definition at line 121 of file SchemeSmobAV.cc.

References av, COG_AV, and cog_misc_tag.

+ Here is the caller graph for this function:

Handle SchemeSmob::verify_handle ( SCM  satom,
const char *  subrname,
int  pos = 1 
)
staticprivate

Verify that SCM arg is an actual opencog Handle; returning Handle

This routine is meant for validating arguments passed into guile-wrapped C++ code.

This routine takes an SCM arg and a string subroutine name. It verifies that the arg is actually a handle (and not, for example, an int, string, etc.) If its not a handle, it throws an SCM error, using the subroutine name in the error message. (Such an error is caught by the shell, and printed as a stack trace at the shell prompt). If the arg is a handle, then the actual opencog handle is returned.

Definition at line 38 of file SchemeSmobAtom.cc.

References scm_to_handle(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

std::vector< Handle > SchemeSmob::verify_handle_list ( SCM  satom_list,
const char *  subrname,
int  pos = 1 
)
staticprivate

Convert argument into a list of handles.

Definition at line 384 of file SchemeSmobNew.cc.

References cog_misc_tag, scm_to_handle(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

int SchemeSmob::verify_int ( SCM  sint,
const char *  subrname,
int  pos = 1,
const char *  msg = "expecting integer" 
)
staticprivate

Check that the argument is an int, else throw errors. Return the int.

Definition at line 284 of file SchemeSmobNew.cc.

+ Here is the caller graph for this function:

std::string SchemeSmob::verify_string ( SCM  sname,
const char *  subrname,
int  pos = 1,
const char *  msg = "expecting string" 
)
staticprivate

Check that the argument is a string, else throw errors. Return the string, in C.

Definition at line 268 of file SchemeSmobNew.cc.

+ Here is the caller graph for this function:

TruthValue * SchemeSmob::verify_tv ( SCM  stv,
const char *  subrname,
int  pos = 1 
)
staticprivate

Definition at line 348 of file SchemeSmobTV.cc.

References cog_misc_tag, COG_TV, and tv.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class PrimitiveEnviron
friend

Definition at line 39 of file SchemeSmob.h.

friend class SchemeEval
friend

Definition at line 38 of file SchemeSmob.h.

template<typename TT >
friend class SchemePrimitive
friend

Definition at line 40 of file SchemeSmob.h.

Member Data Documentation

SCM SchemeSmob::_radix_ten
staticprivate

Definition at line 81 of file SchemeSmob.h.

std::mutex SchemeSmob::as_mtx
staticprivate

Definition at line 140 of file SchemeSmob.h.

SCM SchemeSmob::atomspace_fluid
staticprivate

Return current atomspace for this dynamic state.

Definition at line 181 of file SchemeSmob.h.

scm_t_bits SchemeSmob::cog_misc_tag
staticprivate

Just one scheme smob type is used to implement the interface.

The cog_misc_tag is used to store all structures, such as atoms and truth values. It is assumed that these structures are all ephemeral (garbage-collected), including the Handles. Note that atoms in the atomspace have a concrete existence outside of the scheme shell. By contrast, truth values created by the scheme shell are garbage collected by the shell.

The type of the "misc" structure is stored in the flag bits; thus, handling is dispatched based on these flags.

XXX TODO: The cog_misc_tag should be replaced by a tag-per-class (i.e. we should have a separate tag for handles, tv's, etc.) This would simplify that code, and probably improve performance just a bit.

Definition at line 59 of file SchemeSmob.h.

std::map< AtomSpace *, int > SchemeSmob::deleteable_as
staticprivate

Definition at line 141 of file SchemeSmob.h.

std::atomic_flag SchemeSmob::is_inited = ATOMIC_FLAG_INIT
staticprivate

Definition at line 53 of file SchemeSmob.h.


The documentation for this class was generated from the following files: