From 3ff7b974f5be9a45b6f2663e27021255b6264fec Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 5 Nov 2018 21:11:01 -0500 Subject: [PATCH 1/2] Adapt ISWAManager and KameleonWrapper to removal of singleton --- modules/iswa/util/iswamanager.cpp | 23 +++++++++++++++++++++++ modules/iswa/util/iswamanager.h | 13 ++++++++----- modules/kameleon/src/kameleonwrapper.cpp | 1 + src/util/spicemanager.cpp | 2 -- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index fe7a51def1..ca1a371888 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -94,6 +94,8 @@ namespace { namespace openspace { +IswaManager* IswaManager::_instance = nullptr; + IswaManager::IswaManager() : properties::PropertyOwner({ "IswaManager" }) , _baseUrl("https://iswa-demo-server.herokuapp.com/") @@ -118,6 +120,27 @@ IswaManager::~IswaManager() { _cygnetInformation.clear(); } + +void IswaManager::initialize() { + ghoul_assert(!isInitialized(), "IswaManager is already initialized"); + _instance = new IswaManager; +} + +void IswaManager::deinitialize() { + ghoul_assert(isInitialized(), "IswaManager is not initialized"); + delete _instance; + _instance = nullptr; +} + +bool IswaManager::isInitialized() { + return _instance != nullptr; +} + +IswaManager& IswaManager::ref() { + ghoul_assert(isInitialized(), "IswaManager is not initialized"); + return *_instance; +} + void IswaManager::addIswaCygnet(int id, const std::string& type, std::string group) { if (id > 0) { createScreenSpace(id); diff --git a/modules/iswa/util/iswamanager.h b/modules/iswa/util/iswamanager.h index 005ef9f471..146065d76c 100644 --- a/modules/iswa/util/iswamanager.h +++ b/modules/iswa/util/iswamanager.h @@ -26,7 +26,6 @@ #define __OPENSPACE_MODULE_ISWA___ISWAMANAGER___H__ #include -#include #include #include @@ -68,10 +67,7 @@ struct MetadataFuture { bool isFinished; }; -class IswaManager : public ghoul::Singleton, public properties::PropertyOwner -{ - friend class ghoul::Singleton; - +class IswaManager : public properties::PropertyOwner { public: enum CygnetType { Texture, Data, Kameleon, NoType }; enum CygnetGeometry { Plane, Sphere }; @@ -79,6 +75,11 @@ public: IswaManager(); ~IswaManager(); + static void initialize(); + static void deinitialize(); + static bool isInitialized(); + static IswaManager& ref(); + void addIswaCygnet(int id, const std::string& type = "Texture", std::string group = ""); void addKameleonCdf(std::string group, int pos); @@ -127,6 +128,8 @@ private: ghoul::Event<> _iswaEvent; std::string _baseUrl; + + static IswaManager* _instance; }; } //namespace openspace diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index abfe554825..d509336acb 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #ifdef WIN32 diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index ef9a236417..d897221a9e 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -90,7 +90,6 @@ namespace openspace { SpiceManager* SpiceManager::_instance = nullptr; - SpiceManager::SpiceException::SpiceException(std::string msg) : ghoul::RuntimeError(std::move(msg), "Spice") { @@ -207,7 +206,6 @@ SpiceManager& SpiceManager::ref() { return *_instance; } - SpiceManager::KernelHandle SpiceManager::loadKernel(std::string filePath) { ghoul_assert(!filePath.empty(), "Empty file path"); ghoul_assert( From 7b677d29c18191f7ecc22665d460d266ccc50789 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 5 Nov 2018 21:28:37 -0500 Subject: [PATCH 2/2] Added Micah to the CREDITS file --- CREDITS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.md b/CREDITS.md index 47813a7f5e..f5138ee08d 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -7,6 +7,7 @@ Matthew Territo Gene Payne Kalle Bladin Erik Sundén +Micah Acinapura Jonas Strandstedt Hans-Christian Helltegen