Luanti 5.16.0-dev
 
Loading...
Searching...
No Matches
SSCSMEnvironment Class Reference

The thread that runs SSCSM code. More...

#include <sscsm_environment.h>

+ Inheritance diagram for SSCSMEnvironment:
+ Collaboration diagram for SSCSMEnvironment:

Public Member Functions

 SSCSMEnvironment (std::shared_ptr< StupidChannel > channel)
 
 ~SSCSMEnvironment () override
 
SSCSMScriptinggetScript ()
 
ModVFSgetModVFS ()
 
void updateVFSFiles (std::vector< std::pair< std::string, std::string > > &&files)
 
std::optional< std::string_view > readVFSFile (const std::string &path)
 
void setFatalError (const std::string &reason)
 
template<typename RQ >
RQ::Answer doRequest (RQ &&rq)
 
- Public Member Functions inherited from Thread
 Thread (const std::string &name="")
 
virtual ~Thread ()
 
bool start ()
 
bool stop ()
 
bool wait ()
 
bool isCurrentThread () const
 
bool isRunning () const
 
bool stopRequested () const
 
std::thread::id getThreadId () const
 
bool getReturnValue (void **ret) const
 
bool bindToProcessor (unsigned int proc_number)
 
bool setPriority (int prio)
 

Private Member Functions

void * run () override
 
SerializedSSCSMAnswer exchange (SerializedSSCSMRequest req)
 

Private Attributes

std::shared_ptr< StupidChannelm_channel
 
std::unique_ptr< SSCSMScriptingm_script
 
std::unique_ptr< ModVFSm_vfs
 

Additional Inherited Members

- Static Public Member Functions inherited from Thread
static ThreadgetCurrentThread ()
 
static void setName (const std::string &name)
 
static unsigned int getNumberOfProcessors ()
 
- Protected Attributes inherited from Thread
std::string m_name
 

Detailed Description

The thread that runs SSCSM code.

Meant to be replaced by a sandboxed process.

RAII-owns and abstracts away resources to communicate to the main process / thread.

See also SSCSMController for other side.

Constructor & Destructor Documentation

◆ SSCSMEnvironment()

SSCSMEnvironment::SSCSMEnvironment ( std::shared_ptr< StupidChannel > channel)

◆ ~SSCSMEnvironment()

SSCSMEnvironment::~SSCSMEnvironment ( )
overridedefault

Member Function Documentation

◆ doRequest()

template<typename RQ >
RQ::Answer SSCSMEnvironment::doRequest ( RQ && rq)
inline

References deserializeSSCSMAnswer(), exchange(), and serializeSSCSMRequest().

Referenced by run(), and setFatalError().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exchange()

SerializedSSCSMAnswer SSCSMEnvironment::exchange ( SerializedSSCSMRequest req)
private

References StupidChannel::exchangeA(), and m_channel.

Referenced by doRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModVFS()

ModVFS * SSCSMEnvironment::getModVFS ( )
inline

References m_vfs.

◆ getScript()

SSCSMScripting * SSCSMEnvironment::getScript ( )
inline

References m_script.

Referenced by SSCSMEventLoadMods::exec(), and SSCSMEventOnStep::exec().

+ Here is the caller graph for this function:

◆ readVFSFile()

std::optional< std::string_view > SSCSMEnvironment::readVFSFile ( const std::string & path)

References ModVFS::m_vfs, and m_vfs.

◆ run()

void * SSCSMEnvironment::run ( )
overrideprivatevirtual

Implements Thread.

References doRequest(), setFatalError(), and BaseException::what().

+ Here is the call graph for this function:

◆ setFatalError()

void SSCSMEnvironment::setFatalError ( const std::string & reason)

References doRequest(), and SSCSMRequestSetFatalError::reason.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateVFSFiles()

void SSCSMEnvironment::updateVFSFiles ( std::vector< std::pair< std::string, std::string > > && files)

References ModVFS::m_vfs, m_vfs, and p().

Referenced by SSCSMEventUpdateVFSFiles::exec().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_channel

std::shared_ptr<StupidChannel> SSCSMEnvironment::m_channel
private

Referenced by exchange().

◆ m_script

std::unique_ptr<SSCSMScripting> SSCSMEnvironment::m_script
private

Referenced by getScript().

◆ m_vfs

std::unique_ptr<ModVFS> SSCSMEnvironment::m_vfs
private

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