mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-26 14:58:51 -06:00
distinguish between local and remote scripting
This commit is contained in:
@@ -37,9 +37,8 @@ namespace scripting {
|
||||
struct LuaLibrary {
|
||||
/**
|
||||
* This structure represents a Lua function with its #name, #function pointer
|
||||
* #argumentText describing the arguments this function takes, the #helpText
|
||||
* describing the function, and whether it should be shared in a parallel
|
||||
* connection (#parallelShared)
|
||||
* #argumentText describing the arguments this function takes, and the the #helpText
|
||||
* describing the function.
|
||||
*/
|
||||
struct Function {
|
||||
/// The name of the function
|
||||
@@ -50,9 +49,6 @@ struct LuaLibrary {
|
||||
std::string argumentText;
|
||||
/// A help text describing what the function does/
|
||||
std::string helpText;
|
||||
/// If <code>true</code>, this function will be shared with other parallel
|
||||
/// connections
|
||||
bool parallelShared;
|
||||
};
|
||||
/// The name of the library
|
||||
std::string name;
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace scripting {
|
||||
*/
|
||||
class ScriptEngine {
|
||||
public:
|
||||
using RemoteScripting = ghoul::Boolean;
|
||||
/**
|
||||
* Initializes the internal Lua state and registers a common set of library functions
|
||||
* \throw LuaRuntimeException If the creation of the new Lua state fails
|
||||
@@ -81,7 +82,7 @@ public:
|
||||
|
||||
void preSynchronization();
|
||||
|
||||
void queueScript(const std::string &script);
|
||||
void queueScript(const std::string &script, RemoteScripting remoteScripting);
|
||||
|
||||
void setLogFile(const std::string& filename, const std::string& type);
|
||||
|
||||
@@ -90,9 +91,9 @@ public:
|
||||
std::vector<std::string> allLuaFunctions() const;
|
||||
|
||||
//parallel functions
|
||||
bool parseLibraryAndFunctionNames(std::string &library, std::string &function, const std::string &script);
|
||||
bool shouldScriptBeSent(const std::string &library, const std::string &function);
|
||||
void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
//bool parseLibraryAndFunctionNames(std::string &library, std::string &function, const std::string &script);
|
||||
//bool shouldScriptBeSent(const std::string &library, const std::string &function);
|
||||
//void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
|
||||
private:
|
||||
|
||||
@@ -109,13 +110,13 @@ private:
|
||||
|
||||
//sync variables
|
||||
std::mutex _mutex;
|
||||
std::vector<std::string> _queuedScripts;
|
||||
std::vector<std::pair<std::string, bool>> _queuedScripts;
|
||||
std::vector<std::string> _receivedScripts;
|
||||
std::string _currentSyncedScript;
|
||||
|
||||
//parallel variables
|
||||
std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
|
||||
std::mutex _cachedScriptsMutex;
|
||||
//std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
|
||||
//std::mutex _cachedScriptsMutex;
|
||||
|
||||
//logging variables
|
||||
bool _logFileExists = false;
|
||||
|
||||
Reference in New Issue
Block a user