libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
libscratchcpp::ExecutionContext Class Reference

The ExecutionContext represents the execution context of a target (can be a clone) with variables, lists, etc. More...

#include <scratchcpp/executioncontext.h>

Public Member Functions

 ExecutionContext (Thread *thread)
 
 ExecutionContext (const ExecutionContext &)=delete
 
virtual ~ExecutionContext ()
 
Threadthread () const
 
IEngineengine () const
 
std::shared_ptr< Promisepromise () const
 
void setPromise (std::shared_ptr< Promise > promise)
 
IStackTimerstackTimer () const
 
void setStackTimer (IStackTimer *newStackTimer)
 
IRandomGeneratorrng () const
 
void setRng (IRandomGenerator *newRng)
 

Detailed Description

The ExecutionContext represents the execution context of a target (can be a clone) with variables, lists, etc.

Constructor & Destructor Documentation

◆ ExecutionContext() [1/2]

ExecutionContext::ExecutionContext ( Thread * thread)

Constructs ExecutionContext.

◆ ExecutionContext() [2/2]

libscratchcpp::ExecutionContext::ExecutionContext ( const ExecutionContext & )
delete

◆ ~ExecutionContext()

virtual libscratchcpp::ExecutionContext::~ExecutionContext ( )
inlinevirtual

Member Function Documentation

◆ engine()

IEngine * ExecutionContext::engine ( ) const

Returns the engine of the project.

◆ promise()

std::shared_ptr< Promise > ExecutionContext::promise ( ) const

Returns the script promise.

◆ rng()

IRandomGenerator * ExecutionContext::rng ( ) const

Returns the random number generator of this context.

◆ setPromise()

void ExecutionContext::setPromise ( std::shared_ptr< Promise > promise)

Sets the script promise (yields until the promise is resolved).

◆ setRng()

void ExecutionContext::setRng ( IRandomGenerator * newRng)

Sets a custom random number generator.

◆ setStackTimer()

void ExecutionContext::setStackTimer ( IStackTimer * newStackTimer)

Sets a custom stack timer.

◆ stackTimer()

IStackTimer * ExecutionContext::stackTimer ( ) const

Returns the stack timer of this context. Can be used for wait blocks.

◆ thread()

Thread * ExecutionContext::thread ( ) const

Returns the thread of this context.


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