Permalink
Browse files

Adapt ISWAManager and KameleonWrapper to removal of singleton

  • Loading branch information...
alexanderbock committed Nov 6, 2018
1 parent 1742ed0 commit 3ff7b974f5be9a45b6f2663e27021255b6264fec
@@ -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);
@@ -26,7 +26,6 @@
#define __OPENSPACE_MODULE_ISWA___ISWAMANAGER___H__
#include <openspace/properties/propertyowner.h>
#include <ghoul/designpattern/singleton.h>
#include <openspace/engine/downloadmanager.h>
#include <ghoul/designpattern/event.h>
@@ -68,17 +67,19 @@ struct MetadataFuture {
bool isFinished;
};
class IswaManager : public ghoul::Singleton<IswaManager>, public properties::PropertyOwner
{
friend class ghoul::Singleton<IswaManager>;
class IswaManager : public properties::PropertyOwner {
public:
enum CygnetType { Texture, Data, Kameleon, NoType };
enum CygnetGeometry { Plane, Sphere };
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 @@ class IswaManager : public ghoul::Singleton<IswaManager>, public properties::Pro
ghoul::Event<> _iswaEvent;
std::string _baseUrl;
static IswaManager* _instance;
};
} //namespace openspace
@@ -29,6 +29,7 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
#include <ghoul/glm.h>
#include <ghoul/misc/assert.h>
#include <ghoul/misc/misc.h>
#ifdef WIN32
@@ -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(

0 comments on commit 3ff7b97

Please sign in to comment.