Merge branch 'master' of github.com:OpenSpace/OpenSpace into feature/data-management

This commit is contained in:
Emil Axelsson
2017-11-10 16:07:58 +01:00
482 changed files with 7286 additions and 3720 deletions

View File

@@ -61,19 +61,19 @@ public:
* \throw LuaRuntimeException If the creation of the new Lua state fails
*/
void initialize();
/**
* Cleans the internal Lua state and leaves the ScriptEngine in a state to be newly
* initialize%d.
*/
void deinitialize();
void initializeLuaState(lua_State* state);
ghoul::lua::LuaState* luaState();
void addLibrary(LuaLibrary library);
bool hasLibrary(const std::string& name);
bool runScript(const std::string& script);
bool runScriptFile(const std::string& filename);
@@ -91,35 +91,35 @@ public:
std::vector<std::string> cachedScripts();
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);
static std::string OpenSpaceLibraryName;
private:
bool registerLuaLibrary(lua_State* state, LuaLibrary& library);
void addLibraryFunctions(lua_State* state, LuaLibrary& library, bool replace);
bool isLibraryNameAllowed(lua_State* state, const std::string& name);
void addBaseLibrary();
void remapPrintFunction();
std::string generateJson() const override;
ghoul::lua::LuaState _state;
std::vector<LuaLibrary> _registeredLibraries;
//sync variables
std::mutex _mutex;
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;

View File

@@ -37,7 +37,7 @@ namespace openspace::documentation { struct Documentation; }
namespace openspace::scripting {
/**
* Maintains an ordered list of <code>ScheduledScript</code>s and provides a simple
* Maintains an ordered list of <code>ScheduledScript</code>s and provides a simple
* interface for retrieveing scheduled scripts
*/
class ScriptScheduler {
@@ -45,13 +45,12 @@ public:
struct ScheduledScript {
ScheduledScript() = default;
ScheduledScript(const ghoul::Dictionary& dict);
double time;
std::string forwardScript;
std::string backwardScript;
};
/**
* Load a schedule from a ghoul::Dictionary \p dictionary and adds the
* ScheduledScript%s to the list of stored scripts.
@@ -73,8 +72,8 @@ public:
void clearSchedule();
/**
* Progresses the script schedulers time and returns all scripts that has been
* scheduled to run between \param newTime and the time provided in the last invocation
* Progresses the script schedulers time and returns all scripts that has been
* scheduled to run between \param newTime and the time provided in the last invocation
* of this method.
*
* \param newTime A j2000 time value specifying the new time stamp that
@@ -95,9 +94,9 @@ public:
std::pair<
std::vector<std::string>::const_iterator, std::vector<std::string>::const_iterator
> progressTo(double newTime);
/**
* Returns the the j2000 time value that the script scheduler is currently at
* Returns the the j2000 time value that the script scheduler is currently at
*/
double currentTime() const;
@@ -108,17 +107,16 @@ public:
static LuaLibrary luaLibrary();
static documentation::Documentation Documentation();
private:
std::vector<double> _timings;
std::vector<std::string> _forwardScripts;
std::vector<std::string> _backwardScripts;
int _currentIndex = 0;
double _currentTime = 0;
};
} // namespace openspace::scripting