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

#include <SchemePrimitive.h>

+ Inheritance diagram for opencog::PrimitiveEnviron:

Protected Member Functions

void do_register (const char *, const char *, int)
 
virtual SCM invoke (SCM)=0
 
virtual const char * get_module (void)=0
 
virtual const char * get_name (void)=0
 
virtual size_t get_size (void)=0
 
virtual ~PrimitiveEnviron ()
 

Private Member Functions

void really_do_register (const char *, const char *, int)
 

Static Private Member Functions

static void init (void)
 
static void init_in_module (void *)
 
static void * c_wrap_register (void *)
 
static SCM do_call (SCM, SCM)
 
static PrimitiveEnvironverify_pe (SCM, const char *)
 

Private Attributes

const char * tmp_module
 
const char * tmp_name
 
int tmp_nargs
 

Static Private Attributes

static bool is_inited = false
 

Friends

class SchemeEval
 
class SchemeSmob
 

Detailed Description

Definition at line 28 of file SchemePrimitive.h.

Constructor & Destructor Documentation

PrimitiveEnviron::~PrimitiveEnviron ( )
protectedvirtual

Definition at line 52 of file SchemePrimitive.cc.

Member Function Documentation

void * PrimitiveEnviron::c_wrap_register ( void *  p)
staticprivate

Definition at line 64 of file SchemePrimitive.cc.

References really_do_register().

+ Here is the caller graph for this function:

SCM PrimitiveEnviron::do_call ( SCM  sfe,
SCM  arglist 
)
staticprivate

Definition at line 132 of file SchemePrimitive.cc.

References get_name(), invoke(), opencog::SchemeSmob::throw_exception(), and verify_pe().

+ Here is the caller graph for this function:

void PrimitiveEnviron::do_register ( const char *  module,
const char *  name,
int  nargs 
)
protected

Definition at line 54 of file SchemePrimitive.cc.

References c_wrap_register(), tmp_module, tmp_name, and tmp_nargs.

virtual const char* opencog::PrimitiveEnviron::get_module ( void  )
protectedpure virtual
virtual const char* opencog::PrimitiveEnviron::get_name ( void  )
protectedpure virtual

Implemented in opencog::SchemePrimitive< T >.

+ Here is the caller graph for this function:

virtual size_t opencog::PrimitiveEnviron::get_size ( void  )
protectedpure virtual

Implemented in opencog::SchemePrimitive< T >.

+ Here is the caller graph for this function:

void PrimitiveEnviron::init ( void  )
staticprivate

initialization code – This is currently called under a lock, from SchemeEval::init()

Definition at line 31 of file SchemePrimitive.cc.

References init_in_module(), and is_inited.

+ Here is the caller graph for this function:

void PrimitiveEnviron::init_in_module ( void *  )
staticprivate

This is called while (opencog extension) is the current module. Thus, opencog-extension is only defined in that module.

Definition at line 44 of file SchemePrimitive.cc.

References C, and do_call().

+ Here is the caller graph for this function:

virtual SCM opencog::PrimitiveEnviron::invoke ( SCM  )
protectedpure virtual

Implemented in opencog::SchemePrimitive< T >.

+ Here is the caller graph for this function:

void PrimitiveEnviron::really_do_register ( const char *  module_name,
const char *  name,
int  nargs 
)
private

Create a new smob that will store a pointer to "this", which, in turn, holds a pointer to the C++ instance and the C++ method to be invoked, when its called from scheme. The evaluation of the scheme function will actually end up calling "opencog-extension", which passes this smob to do_call(). It will be do_call that then calls the actual C++ function.

Note that this method must be called in "guile mode".

Definition at line 82 of file SchemePrimitive.cc.

References BUFLEN, opencog::SchemeSmob::COG_EXTEND, opencog::SchemeSmob::cog_misc_tag, get_size(), and init().

+ Here is the caller graph for this function:

PrimitiveEnviron * PrimitiveEnviron::verify_pe ( SCM  spe,
const char *  subrname 
)
staticprivate

Definition at line 160 of file SchemePrimitive.cc.

References opencog::SchemeSmob::COG_EXTEND, and opencog::SchemeSmob::cog_misc_tag.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class SchemeEval
friend

Definition at line 30 of file SchemePrimitive.h.

friend class SchemeSmob
friend

Definition at line 31 of file SchemePrimitive.h.

Member Data Documentation

bool PrimitiveEnviron::is_inited = false
staticprivate

Definition at line 33 of file SchemePrimitive.h.

const char* opencog::PrimitiveEnviron::tmp_module
private

Definition at line 40 of file SchemePrimitive.h.

const char* opencog::PrimitiveEnviron::tmp_name
private

Definition at line 41 of file SchemePrimitive.h.

int opencog::PrimitiveEnviron::tmp_nargs
private

Definition at line 42 of file SchemePrimitive.h.


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