VirtualMachineInterface Class Reference

#include <vm.h>

Inheritance diagram for VirtualMachineInterface:

Public Member Functions

MAXON_METHOD Result< void > Init (const LoadRuntime &runtimeInfo, const DataDictionary &settings=DataDictionary::NullValue())
 
MAXON_METHOD void Free ()
 
MAXON_METHOD Result< VirtualMachineScopeRef > CreateScope ()
 
MAXON_METHOD String GetName ()
 
MAXON_METHOD String GetVersion ()
 
MAXON_METHOD String GetCopyright ()
 
MAXON_METHOD String GetCompiler ()
 
MAXON_METHOD String GetBuildInfo ()
 
MAXON_METHOD Result< void > EnterInteractiveMode ()
 
MAXON_METHOD Result< void > Execute (const String &code)
 
MAXON_METHOD Result< void > Execute (const Url &filepath)
 
MAXON_METHOD Result< void > ExecuteModule (const String &name)
 
MAXON_METHOD Result< void > GetDocumentString (const String &code, DocStringMeta &meta)
 
MAXON_METHOD LibraryRef GetLibraryRef ()
 
MAXON_METHOD Result< BaseArray< Runtime > > GetAllAvailableVirtualMachineLibraries () const
 

Private Member Functions

 MAXON_INTERFACE (VirtualMachineInterface, MAXON_REFERENCE_NORMAL, "net.maxon.python.interface.virtualmachine")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( VirtualMachineInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.python.interface.virtualmachine"   
)
private

◆ Init()

MAXON_METHOD Result<void> Init ( const LoadRuntime runtimeInfo,
const DataDictionary &  settings = DataDictionary::NullValue() 
)
Parameters
[in]runtimeInfoInformation about the virtual machine, how to start it up.
[in]settingsOptional settings which might be needed by the virtual machine.
Returns
OK on success.

◆ Free()

MAXON_METHOD void Free ( )

Frees and shuts down the virtual machine. Should never be called on virtual machines which are owned by the system.

◆ CreateScope()

MAXON_METHOD Result<VirtualMachineScopeRef> CreateScope ( )

Creates a virtual machine scope. The scope must be deleted before the virtual machine will be shutdown.

Returns
New virtual machine scope.

◆ GetName()

MAXON_METHOD String GetName ( )

Returns the name of the underlying library, e.g. "Python".

Returns
Name of the virtual machine.

◆ GetVersion()

MAXON_METHOD String GetVersion ( )

Returns the human readable version string of the underlying library.

Returns
Version details.

◆ GetCopyright()

MAXON_METHOD String GetCopyright ( )

Returns the human readable copyright information of the underlying library.

Returns
Copyright text.

◆ GetCompiler()

MAXON_METHOD String GetCompiler ( )

Returns a human readable compiler info text.

Returns
Compiler which got used to compile the underlying library.

◆ GetBuildInfo()

MAXON_METHOD String GetBuildInfo ( )

Returns a human readable build information.

Returns
Build info with information about the build.

◆ EnterInteractiveMode()

MAXON_METHOD Result<void> EnterInteractiveMode ( )

Enters the interactive mode of the virtual machine.

Returns
OK after the interactive mode was left, or FunctionNotImplementedError

◆ Execute() [1/2]

MAXON_METHOD Result<void> Execute ( const String code)

Executes a given code in the global scope of the virtual machine.

Parameters
[in]codeCode to execute.
Returns
Returns an error if an error occurred. Virtual machine clears all error states when function returns.

◆ Execute() [2/2]

MAXON_METHOD Result<void> Execute ( const Url filepath)

Executes a given file in the global scope of the virtual machine.

Parameters
[in]filepathPath of file to execute.
Returns
Returns an error if an error occurred. Virtual machine clears all error states when function returns.

◆ ExecuteModule()

MAXON_METHOD Result<void> ExecuteModule ( const String name)

Executes a given module in the virtual machine.

Parameters
[in]nameName of the module.
Returns
Returns an error if an error occurred. Virtual machine clears all error states when function returns.

◆ GetDocumentString()

MAXON_METHOD Result<void> GetDocumentString ( const String code,
DocStringMeta meta 
)

Returns docstrings of a given code.

Parameters
[in]codeString code.
[out]metaReturns the docstrings.
Returns
Returns OK if the extraction succeeded, otherwise None.

◆ GetLibraryRef()

MAXON_METHOD LibraryRef GetLibraryRef ( )

Returns the underlying library.

Returns
Underlying virtual machine library.

◆ GetAllAvailableVirtualMachineLibraries()

MAXON_METHOD Result<BaseArray<Runtime> > GetAllAvailableVirtualMachineLibraries ( ) const

Returns all available virtual machine libraries.

Returns
An array of available virtual machines libraries.