DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
dueca::ScriptInterpret Class Reference

Interaction with the scripting language. More...

#include <ScriptInterpret.hxx>

Inheritance diagram for dueca::ScriptInterpret:
Inheritance graph
[legend]
Collaboration diagram for dueca::ScriptInterpret:
Collaboration graph
[legend]

Public Member Functions

size_t getNumInitFunctions () const
 Get the number of current init functions.
 
void runCode (const char *code)
 Run a piece of code in the interpreter.
 
ObjectType getObjectType () const
 Tell that we are a part of the DUECA core.
 
- Public Member Functions inherited from dueca::NamedObject
const std::string getEntity () const
 Returns the "entity" part of the name.
 
const std::string getClass () const
 Returns the "class" part of the name.
 
const std::string getPart () const
 Returns the sub-entity or "part" part of the name.
 
const NameSetgetNameSet () const
 This returns the complete name set.
 
const GlobalIdgetId () const
 This returns the id.
 

Static Public Member Functions

static ScriptInterpretsingle (ScriptHelper *helper=NULL)
 Return the singleton.
 
static DO_NOT_DOCUMENT void addInitFunction (voidfunc ifunct)
 
static void addInitFunction (const char *name, const char *parent, voidfunc ifunct)
 Add a new function to the script language.
 
static void addInitFunction (const InitFunction *ifunct)
 Add a new init function to the script language.
 

Friends

class Environment
 
class NodeManager
 
struct PythonScripting
 
struct SetScriptInitFunction
 
void scheme_inner_main (void *closure, int argc, char **argv)
 
void init_module_dueca ()
 

Additional Inherited Members

- Protected Member Functions inherited from dueca::NamedObject
 NamedObject (const GlobalId &id)
 Reserve for AssociateObject.
 
 NamedObject (const NameSet &ns)
 Normal constructor, protected, because it has no use to create a NamedObject by itself.
 
virtual ~NamedObject ()
 Destructor.
 

Detailed Description

Interaction with the scripting language.

Start and handle scripting in DUECA, either Scheme or Python currently. The ScriptInterpret singleton iss created by the main dueca program. It takes care of appending the configuration information (from a local file) and model information, sent by dueca, or from a local file on node 0, onto a file which is read and interpreted.

This class is used mostly internally by DUECA, however client modules can add init functions (for python scripting) and have the interpreter run pieces of code.

Member Function Documentation

◆ addInitFunction() [1/2]

static DO_NOT_DOCUMENT void dueca::ScriptInterpret::addInitFunction ( voidfunc ifunct)
static
Deprecated
Add a new function to the script language. Anyone can add one, this is the way to make the script extensible with new commands.
Parameters
ifunctA void function

◆ addInitFunction() [2/2]

static void dueca::ScriptInterpret::addInitFunction ( const char * name,
const char * parent,
voidfunc ifunct )
static

Add a new function to the script language.

Anyone can add one, this is the way to make the script extensible with new commands.

Parameters
nameA descriptive name for the function, used in error messages.
parentParent class, if name is a class, NULL, if no parent.
ifunctA void function

◆ runCode()

void dueca::ScriptInterpret::runCode ( const char * code)

Run a piece of code in the interpreter.

Only do this from the priority 0 thread!

Parameters
codeCode to run
Exceptions
boost::python::error_already_setif a problem occurs.

◆ getObjectType()

ObjectType dueca::ScriptInterpret::getObjectType ( ) const
inlinevirtual

Tell that we are a part of the DUECA core.

Implements dueca::NamedObject.


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