libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
executioncontext.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#pragma once
4
5#include "global.h"
6#include "spimpl.h"
7
8namespace libscratchcpp
9{
10
11class Thread;
12class IEngine;
13class Promise;
14class IStackTimer;
16class ExecutionContextPrivate;
17
20{
21 public:
24 virtual ~ExecutionContext() { }
25
26 Thread *thread() const;
27 IEngine *engine() const;
28
29 std::shared_ptr<Promise> promise() const;
30 void setPromise(std::shared_ptr<Promise> promise);
31
32 IStackTimer *stackTimer() const;
33 void setStackTimer(IStackTimer *newStackTimer);
34
35 IRandomGenerator *rng() const;
36 void setRng(IRandomGenerator *newRng);
37
38 private:
39 spimpl::unique_impl_ptr<ExecutionContextPrivate> impl;
40};
41
42} // namespace libscratchcpp
Thread * thread() const
Definition executioncontext.cpp:17
ExecutionContext(Thread *thread)
Definition executioncontext.cpp:11
ExecutionContext(const ExecutionContext &)=delete
virtual ~ExecutionContext()
Definition executioncontext.h:24
The IEngine interface provides an API for running Scratch projects.
Definition iengine.h:41
The IRandomGenerator interface represents a random number generator that can be received e....
Definition irandomgenerator.h:12
The IStackTimer interface represents a timer that can be used by blocks.
Definition istacktimer.h:16
The Promise class represents the eventual completion of an asynchronous operation.
Definition promise.h:15
The Thread class represents a running Scratch script.
Definition thread.h:19
#define LIBSCRATCHCPP_EXPORT
Definition global.h:17
The main namespace of the library.
Definition asset.h:10