Move presync callback functionality from SkyBrowserModule to ServerModule in order to expose the functionality to other topics as well

This commit is contained in:
Ylva Selling
2022-06-01 15:06:40 -04:00
parent fed07a0847
commit c9a63274a8
5 changed files with 44 additions and 43 deletions

View File

@@ -49,6 +49,8 @@ struct Message {
class ServerModule : public OpenSpaceModule {
public:
static constexpr const char* Name = "Server";
using CallbackHandle = int;
using CallbackFunction = std::function<void()>;
ServerModule();
virtual ~ServerModule();
@@ -57,6 +59,9 @@ public:
int skyBrowserUpdateTime() const;
CallbackHandle addPreSyncCallback(CallbackFunction cb);
void removePreSyncCallback(CallbackHandle handle);
protected:
void internalInitialize(const ghoul::Dictionary& configuration) override;
@@ -79,6 +84,10 @@ private:
std::vector<std::unique_ptr<ServerInterface>> _interfaces;
properties::PropertyOwner _interfaceOwner;
int _skyBrowserUpdateTime = 100;
// Callbacks for tiggering topic
int _nextCallbackHandle = 0;
std::vector<std::pair<CallbackHandle, CallbackFunction>> _preSyncCallbacks;
};
} // namespace openspace