Some cleanup of ModuleEngine

Some cleanup of SettingsEngine
Some cleanup of SyncEngine
This commit is contained in:
Alexander Bock
2017-03-02 15:43:54 -05:00
parent d6b5bb753b
commit c12bd7182b
12 changed files with 165 additions and 204 deletions
+13 -5
View File
@@ -25,14 +25,23 @@
#ifndef __OPENSPACE_CORE___MODULEENGINE___H__
#define __OPENSPACE_CORE___MODULEENGINE___H__
#include <openspace/util/openspacemodule.h>
#include <openspace/scripting/scriptengine.h>
#include <memory>
#include <vector>
namespace ghoul {
namespace systemcapabilities {
struct Version;
} // namespace systemcapabilities
} // namespace ghoul
namespace openspace {
namespace scripting { struct LuaLibrary; }
class OpenSpaceModule;
/**
* The ModuleEngine is the central repository for registering and accessing
* OpenSpaceModule for the current application run. By initializing (#initialize) the
@@ -80,8 +89,7 @@ public:
* version of all registered modules' OpenGL versions.
* \return The combined minimum OpenGL version
*/
ghoul::systemcapabilities::OpenGLCapabilitiesComponent::Version
requiredOpenGLVersion() const;
ghoul::systemcapabilities::Version requiredOpenGLVersion() const;
/**
* Returns the Lua library that contains all Lua functions available to affect the
+1 -8
View File
@@ -43,26 +43,19 @@ public:
void initialize();
void setModules(std::vector<OpenSpaceModule*> modules);
void setModules(const std::vector<OpenSpaceModule*>& modules);
bool busyWaitForDecode();
bool logSGCTOutOfOrderErrors();
bool useDoubleBuffering();
private:
void initEyeSeparation();
void initSceneFiles();
void initBusyWaitForDecode();
void initLogSGCTOutOfOrderErrors();
void initUseDoubleBuffering();
properties::FloatProperty _eyeSeparation;
properties::OptionProperty _scenes;
properties::BoolProperty _busyWaitForDecode;
properties::BoolProperty _logSGCTOutOfOrderErrors;
properties::BoolProperty _useDoubleBuffering;
properties::BoolProperty _spiceUseExceptions;
};
} // namespace openspace
+37 -35
View File
@@ -25,80 +25,82 @@
#ifndef __OPENSPACE_CORE___SYNCENGINE___H__
#define __OPENSPACE_CORE___SYNCENGINE___H__
#include <openspace/util/syncbuffer.h>
#include <ghoul/misc/boolean.h>
#include <vector>
#include <memory>
namespace openspace {
class Syncable;
class SyncBuffer;
/**
* Manages a collection of <code>Syncable</code>s and ensures they are synchronized
* over SGCT nodes. Encoding/Decoding order is handles internally.
*/
* Manages a collection of <code>Syncable</code>s and ensures they are synchronized
* over SGCT nodes. Encoding/Decoding order is handles internally.
*/
class SyncEngine {
public:
using IsMaster = ghoul::Boolean;
/**
* Dependency injection: a SyncEngine relies on a SyncBuffer to encode the sync data.
*/
SyncEngine(SyncBuffer* syncBuffer);
* Creates a new SyncEngine which a buffer size of \p syncBufferSize
* \pre syncBufferSize must be bigger than 0
*/
SyncEngine(unsigned int syncBufferSize);
/**
* Encodes all added Syncables in the injected <code>SyncBuffer</code>.
* This method is only called on the SGCT master node
*/
* Encodes all added Syncables in the injected <code>SyncBuffer</code>.
* This method is only called on the SGCT master node
*/
void encodeSyncables();
/**
* Decodes the <code>SyncBuffer</code> into the added Syncables.
* This method is only called on the SGCT slave nodes
*/
* Decodes the <code>SyncBuffer</code> into the added Syncables.
* This method is only called on the SGCT slave nodes
*/
void decodeSyncables();
/**
* Invokes the presync method of all added Syncables
*/
void presync(bool isMaster);
* Invokes the presync method of all added Syncables
*/
void preSynchronization(IsMaster isMaster);
/**
* Invokes the postsync method of all added Syncables
*/
void postsync(bool isMaster);
* Invokes the postsync method of all added Syncables
*/
void postSynchronization(IsMaster isMaster);
/**
* Add a Syncable to be synchronized over the SGCT cluster
*/
* Add a Syncable to be synchronized over the SGCT cluster.
* \pre syncable must not be nullptr
*/
void addSyncable(Syncable* syncable);
/**
* Add multiple Syncables to be synchronized over the SGCT cluster
*/
* Add multiple Syncables to be synchronized over the SGCT cluster
* \pre syncables must not contain any nullptr
*/
void addSyncables(const std::vector<Syncable*>& syncables);
/**
* Remove a Syncable from being synchronized over the SGCT cluster
*/
* Remove a Syncable from being synchronized over the SGCT cluster
*/
void removeSyncable(Syncable* syncable);
private:
/**
* Vector of Syncables. The vectors ensures consistent encode/decode order
*/
* Vector of Syncables. The vectors ensures consistent encode/decode order
*/
std::vector<Syncable*> _syncables;
/**
* Databuffer used in encoding/decoding
*/
std::unique_ptr<SyncBuffer> _syncBuffer;
* Databuffer used in encoding/decoding
*/
SyncBuffer _syncBuffer;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___SYNCENGINE___H__