mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 08:19:51 -05:00
Add Lua function to return a list of all loaded kernels
This commit is contained in:
@@ -232,6 +232,14 @@ public:
|
||||
*/
|
||||
void unloadKernel(KernelHandle kernelId);
|
||||
|
||||
/**
|
||||
* Returns a list of all loaded kernels in the kernel pool that have been loaded
|
||||
* through the SpiceManager. The kernels are reported in order of their loading.
|
||||
*
|
||||
* \return The list of all loaded kernels that have been loaded through this manager
|
||||
*/
|
||||
std::vector<std::string> loadedKernels() const;
|
||||
|
||||
/**
|
||||
* Unloads a SPICE kernel identified by the \p filePath which was used in the
|
||||
* loading call to #loadKernel. The unloading is done by calling the `unload_c`
|
||||
|
||||
@@ -324,6 +324,15 @@ void SpiceManager::unloadKernel(std::string filePath) {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> SpiceManager::loadedKernels() const {
|
||||
std::vector<std::string> res;
|
||||
res.reserve(_loadedKernels.size());
|
||||
for (const KernelInformation& info : _loadedKernels) {
|
||||
res.push_back(info.path);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool SpiceManager::hasSpkCoverage(const std::string& target, double et) const {
|
||||
ghoul_assert(!target.empty(), "Empty target");
|
||||
|
||||
@@ -1530,9 +1539,10 @@ scripting::LuaLibrary SpiceManager::luaLibrary() {
|
||||
{
|
||||
codegen::lua::LoadKernel,
|
||||
codegen::lua::UnloadKernel,
|
||||
codegen::lua::Kernels,
|
||||
codegen::lua::SpiceBodies,
|
||||
codegen::lua::RotationMatrix,
|
||||
codegen::lua::Position
|
||||
codegen::lua::Position,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -68,6 +68,13 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all loaded kernels
|
||||
*/
|
||||
[[codegen::luawrap]] std::vector<std::string> kernels() {
|
||||
return openspace::SpiceManager::ref().loadedKernels();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Spice Bodies loaded into the system. Returns SPICE built in frames if
|
||||
* builtInFrames. Returns User loaded frames if !builtInFrames.
|
||||
|
||||
Reference in New Issue
Block a user