k3d::iscript_engine Class Reference

Abstract interface implemented by objects that can execute scripts written in a specific scripting language. More...

#include <iscript_engine.h>

Inheritance diagram for k3d::iscript_engine:
Inheritance graph
[legend]

List of all members.

Classes

class  context
 Defines a collection of name-value pairs passed to a script that define its context (its execution environment) - how they are used is implementation-dependent (note that the names are merely suggestions, and may be changed or ignored at the whim of the implementation). More...

Public Types

typedef sigc::slot< void,
const string_t & > 
output_t
 Defines a slot that can be called to redirect script output.

Public Member Functions

virtual ~iscript_engine ()
virtual iplugin_factoryfactory ()=0
 Returns a reference to the factory that created this object.
virtual const string_t language ()=0
 Returns the human-readable name of the scripting language this engine implements.
virtual bool_t execute (const string_t &ScriptName, const string_t &Script, context &Context, output_t *Stdout=0, output_t *Stderr=0)=0
 Executes a script.
virtual bool_t halt ()=0
 Requests a cancellation of all running scripts.

Protected Member Functions

 iscript_engine ()
 iscript_engine (const iscript_engine &Other)
iscript_engineoperator= (const iscript_engine &)

Detailed Description

Abstract interface implemented by objects that can execute scripts written in a specific scripting language.

Note:
: The Script arguments to execute() have bounced back-and-forth between string and stream representations several times. The original rationale for making them streams was to avoid having to buffer the source code to a script in memory; the new rationale for making them strings is that in practice you always end-up having to buffer the source code anyway, for one of two reasons: first, very few script APIs are likely to support C++ streams C++ streams, so we will likely have to buffer the source before using it anyway; second, determining the MIME type of a script and calling execute() in sequence (the most common use-case) requires random access to the source stream, which isn't available for compressed streams or socket-based streams.

Member Typedef Documentation

typedef sigc::slot<void, const string_t&> k3d::iscript_engine::output_t

Defines a slot that can be called to redirect script output.


Constructor & Destructor Documentation

virtual k3d::iscript_engine::~iscript_engine (  )  [inline, virtual]
k3d::iscript_engine::iscript_engine (  )  [inline, protected]
k3d::iscript_engine::iscript_engine ( const iscript_engine Other  )  [inline, protected]

Member Function Documentation

virtual bool_t k3d::iscript_engine::execute ( const string_t ScriptName,
const string_t Script,
context Context,
output_t Stdout = 0,
output_t Stderr = 0 
) [pure virtual]

Executes a script.

Parameters:
ScriptName A human readable identifier for the script, which should be used in error messages, etc.
Script The complete source code of the script to be executed
Context Collection of objects that define the context/execution environment of the script - how they are used is implementation-dependent. Note that the script engine may alter context objects before returning.
Stdout Optional slot that will be called with script output.
Stderr Optional slot that will be called with script output.
Returns:
true, iff the script was successfully executed without errors (either syntax or runtime)

Implemented in module::python::engine.

virtual iplugin_factory& k3d::iscript_engine::factory (  )  [pure virtual]

Returns a reference to the factory that created this object.

Implemented in module::python::engine.

virtual bool_t k3d::iscript_engine::halt (  )  [pure virtual]

Requests a cancellation of all running scripts.

Returns:
true, iff script cancellation is supported by this engine.
Note:
Cancellation may be asynchronous, i.e. scripts may still be running when the call returns, and may continue to run for an indefinite period before shutting down, if at all.

Implemented in module::python::engine.

virtual const string_t k3d::iscript_engine::language (  )  [pure virtual]

Returns the human-readable name of the scripting language this engine implements.

Implemented in module::python::engine.

iscript_engine& k3d::iscript_engine::operator= ( const iscript_engine  )  [inline, protected]

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

Generated on Mon Mar 21 07:41:59 2011 for K-3D by doxygen 1.6.3