mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Folder restructuring in software integration module
This commit is contained in:
@@ -27,31 +27,31 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
|
||||
set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/softwareintegrationmodule.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/softwareintegrationmodule.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/messagehandler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/messagehandler.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/messagehandler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/messagehandler.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/network.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/softwareconnection.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablepointscloud.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/syncablestorage.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/syncablestorage.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/interruptibleconcurrentqueue.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/interruptibleconcurrentqueue.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assethelper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simp/simp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simp/simp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/syncablestorage.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/syncablestorage.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/interruptibleconcurrentqueue.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/interruptibleconcurrentqueue.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/session/session.h
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/softwareintegrationmodule.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/softwareintegrationmodule_lua.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/messagehandler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/messagehandler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/network.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/network/softwareconnection.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablepointscloud.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/syncablestorage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assethelper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simp/simp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/syncablestorage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/session/session.cpp
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/softwareintegration/messagehandler.h>
|
||||
#include <modules/softwareintegration/softwareintegrationmodule.h>
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/network/messagehandler.h>
|
||||
|
||||
#include <modules/softwareintegration/softwareintegrationmodule.h>
|
||||
#include <openspace/navigation/navigationhandler.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
@@ -27,9 +27,10 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <modules/softwareintegration/network/softwareconnection.h>
|
||||
#include <modules/softwareintegration/utils/syncablestorage.h>
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
namespace openspace::softwareintegration::messagehandler {
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
|
||||
#include <modules/softwareintegration/network/network.h>
|
||||
|
||||
#include <modules/softwareintegration/messagehandler.h>
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/network/messagehandler.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/globalscallbacks.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#define __OPENSPACE_MODULE_SOFTWAREINTEGRATION___NETWORKENGINE___H__
|
||||
|
||||
#include <modules/softwareintegration/network/softwareconnection.h>
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/simp/simp.h>
|
||||
#include <ghoul/io/socket/tcpsocketserver.h>
|
||||
#include <modules/softwareintegration/interruptibleconcurrentqueue.h>
|
||||
#include <modules/softwareintegration/utils/interruptibleconcurrentqueue.h>
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <modules/softwareintegration/network/softwareconnection.h>
|
||||
|
||||
#include <modules/softwareintegration/network/network.h>
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/syncengine.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWARECONNECTION___H__
|
||||
#define __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWARECONNECTION___H__
|
||||
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/simp/simp.h>
|
||||
#include <openspace/network/messagestructures.h>
|
||||
#include <ghoul/io/socket/tcpsocket.h>
|
||||
#include <openspace/properties/property.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <modules/softwareintegration/rendering/renderablepointscloud.h>
|
||||
|
||||
#include <modules/softwareintegration/softwareintegrationmodule.h>
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/simp/simp.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/windowdelegate.h>
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/softwareintegration/assethelper.h>
|
||||
#include <modules/softwareintegration/session/session.h>
|
||||
|
||||
#include <modules/softwareintegration/softwareintegrationmodule.h>
|
||||
#include <modules/softwareintegration/syncablestorage.h>
|
||||
#include <modules/softwareintegration/utils/syncablestorage.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr const char* _loggerCat = "SoftwareIntegrationAssetHelper";
|
||||
constexpr const char* _loggerCat = "SoftwareIntegrationSession";
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -112,9 +112,9 @@ bool saveSessionData(SyncableStorage& storage,
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namepsace
|
||||
} // namespace
|
||||
|
||||
bool AssetHelper::loadSessionData(SoftwareIntegrationModule* module,
|
||||
bool softwareintegration::Session::loadSessionData(SoftwareIntegrationModule* module,
|
||||
const std::string& filePathString,
|
||||
std::string& errorMessage
|
||||
) {
|
||||
@@ -159,7 +159,7 @@ bool AssetHelper::loadSessionData(SoftwareIntegrationModule* module,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetHelper::saveSession(const std::string& wantedFileName, std::string& errorMessage) {
|
||||
bool softwareintegration::Session::saveSession(const std::string& wantedFileName, std::string& errorMessage) {
|
||||
auto softwareIntegrationModule = global::moduleEngine->module<SoftwareIntegrationModule>();
|
||||
if (!softwareIntegrationModule) {
|
||||
errorMessage = "Software Integration Module not found.";
|
||||
@@ -22,25 +22,29 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_MODULE_SOFTWAREINTEGRATION___ASSETHELPER___H__
|
||||
#define __OPENSPACE_MODULE_SOFTWAREINTEGRATION___ASSETHELPER___H__
|
||||
#ifndef __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWAREINTEGRATIONSESSION___H__
|
||||
#define __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWAREINTEGRATIONSESSION___H__
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class SoftwareIntegrationModule;
|
||||
|
||||
class AssetHelper {
|
||||
namespace softwareintegration {
|
||||
|
||||
class Session {
|
||||
public:
|
||||
AssetHelper() = delete;
|
||||
Session() = delete;
|
||||
|
||||
static bool loadSessionData(SoftwareIntegrationModule* module,
|
||||
const std::string& filePathString,
|
||||
std::string& errorMessage);
|
||||
const std::string& filePathString,
|
||||
std::string& errorMessage);
|
||||
|
||||
static bool saveSession(const std::string& wantedFileName, std::string& errorMessage);
|
||||
|
||||
};
|
||||
|
||||
} // namespace softwareintegration
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SOFTWAREINTEGRATION___ASSETHELPER___H__
|
||||
#endif // __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWAREINTEGRATIONSESSION___H__
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/simp/simp.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/dictionaryluaformatter.h>
|
||||
@@ -33,52 +33,9 @@ namespace {
|
||||
constexpr const char* _loggerCat = "SoftwareIntegrationMessageFormat";
|
||||
} // namespace
|
||||
|
||||
namespace openspace::softwareintegration {
|
||||
namespace openspace::softwareintegration::simp {
|
||||
|
||||
|
||||
namespace storage {
|
||||
|
||||
// Anonymous namespace
|
||||
namespace {
|
||||
|
||||
const std::unordered_map<std::string, Key> _keyStringFromKey{
|
||||
{ "DataPoints", Key::DataPoints },
|
||||
{ "VelocityData", Key::VelocityData },
|
||||
{ "Colormap", Key::Colormap },
|
||||
{ "ColormapAttributeData", Key::ColormapAttrData },
|
||||
{ "LinearSizeAttributeData", Key::LinearSizeAttrData },
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
bool hasStorageKey(const std::string& key) {
|
||||
return _keyStringFromKey.count(key) > 0;
|
||||
}
|
||||
|
||||
Key getStorageKey(const std::string& key) {
|
||||
if (hasStorageKey(key)) {
|
||||
return _keyStringFromKey.at(key);
|
||||
}
|
||||
|
||||
return Key::Unknown;
|
||||
}
|
||||
|
||||
std::string getStorageKeyString(const Key key) {
|
||||
auto it = std::find_if(
|
||||
_keyStringFromKey.begin(),
|
||||
_keyStringFromKey.end(),
|
||||
[key](const std::pair<const std::string, Key>& p) {
|
||||
return key == p.second;
|
||||
}
|
||||
);
|
||||
if (it == _keyStringFromKey.end()) return "";
|
||||
return it->first;
|
||||
}
|
||||
|
||||
} // namespace storage
|
||||
|
||||
namespace simp {
|
||||
|
||||
// Anonymous namespace
|
||||
namespace {
|
||||
|
||||
@@ -425,6 +382,4 @@ void toByteBuffer(std::vector<std::byte>& byteBuffer, size_t& offset, const std:
|
||||
}
|
||||
|
||||
|
||||
} // namespace simp
|
||||
|
||||
} // namespace openspace::softwareintegration
|
||||
} // namespace openspace::softwareintegration::simp
|
||||
@@ -27,28 +27,8 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace openspace::softwareintegration {
|
||||
namespace openspace::softwareintegration::simp {
|
||||
|
||||
namespace storage {
|
||||
|
||||
enum class Key : uint8_t {
|
||||
DataPoints = 0,
|
||||
VelocityData,
|
||||
Colormap,
|
||||
ColormapAttrData,
|
||||
LinearSizeAttrData,
|
||||
Unknown
|
||||
};
|
||||
|
||||
Key getStorageKey(const std::string& key);
|
||||
|
||||
std::string getStorageKeyString(const Key key);
|
||||
|
||||
bool hasStorageKey(const std::string& key);
|
||||
|
||||
} // namespace storage
|
||||
|
||||
namespace simp {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -189,10 +169,9 @@ void toByteBuffer(std::vector<std::byte>& byteBuffer, size_t& offset, const std:
|
||||
void toByteBuffer(std::vector<std::byte>& byteBuffer, const size_t& offset, const std::vector<std::byte>& value);
|
||||
void toByteBuffer(std::vector<std::byte>& byteBuffer, size_t& offset, const std::vector<std::byte>& value);
|
||||
|
||||
} // namespace simp
|
||||
|
||||
} // namespace openspace::softwareintegration
|
||||
} // namespace openspace::softwareintegration::simp
|
||||
|
||||
#include "utils.inl"
|
||||
#include "simp.inl"
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SIMP___H__
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <modules/softwareintegration/softwareintegrationmodule.h>
|
||||
|
||||
#include <modules/softwareintegration/messagehandler.h>
|
||||
#include <modules/softwareintegration/network/messagehandler.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/syncengine.h>
|
||||
#include <modules/softwareintegration/rendering/renderablepointscloud.h>
|
||||
|
||||
@@ -26,16 +26,20 @@
|
||||
#define __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWAREINTEGRATIONMODULE___H__
|
||||
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
#include <modules/softwareintegration/syncablestorage.h>
|
||||
#include <modules/softwareintegration/utils/syncablestorage.h>
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <modules/softwareintegration/network/network.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class AssetHelper;
|
||||
namespace softwareintegration {
|
||||
|
||||
class Session;
|
||||
|
||||
} // namespace softwareintegration
|
||||
|
||||
class SoftwareIntegrationModule : public OpenSpaceModule {
|
||||
friend class AssetHelper;
|
||||
friend class softwareintegration::Session;
|
||||
|
||||
public:
|
||||
constexpr static const char* Name = "SoftwareIntegration";
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/softwareintegration/assethelper.h>
|
||||
#include <modules/softwareintegration/session/session.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/engine/windowdelegate.h>
|
||||
@@ -47,7 +47,7 @@ namespace {
|
||||
}
|
||||
|
||||
std::string errorMessage;
|
||||
if (!AssetHelper::loadSessionData(softwareIntegrationModule, filePath, errorMessage)) {
|
||||
if (!softwareintegration::Session::loadSessionData(softwareIntegrationModule, filePath, errorMessage)) {
|
||||
return errorMessage;
|
||||
}
|
||||
else {
|
||||
@@ -67,7 +67,7 @@ namespace {
|
||||
}
|
||||
|
||||
std::string errorMessage;
|
||||
if (!AssetHelper::saveSession(wantedFilePath, errorMessage)) {
|
||||
if (!softwareintegration::Session::saveSession(wantedFilePath, errorMessage)) {
|
||||
LERRORC("SoftwareIntegration::saveSession", errorMessage);
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/softwareintegration/syncablestorage.h>
|
||||
#include <modules/softwareintegration/utils/syncablestorage.h>
|
||||
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <openspace/util/syncbuffer.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
@@ -37,6 +36,47 @@ constexpr const char* _loggerCat = "SyncableStorage";
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace softwareintegration::storage {
|
||||
|
||||
// Anonymous namespace
|
||||
namespace {
|
||||
|
||||
const std::unordered_map<std::string, Key> _keyStringFromKey{
|
||||
{ "DataPoints", Key::DataPoints },
|
||||
{ "VelocityData", Key::VelocityData },
|
||||
{ "Colormap", Key::Colormap },
|
||||
{ "ColormapAttributeData", Key::ColormapAttrData },
|
||||
{ "LinearSizeAttributeData", Key::LinearSizeAttrData },
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
bool hasStorageKey(const std::string& key) {
|
||||
return _keyStringFromKey.count(key) > 0;
|
||||
}
|
||||
|
||||
Key getStorageKey(const std::string& key) {
|
||||
if (hasStorageKey(key)) {
|
||||
return _keyStringFromKey.at(key);
|
||||
}
|
||||
|
||||
return Key::Unknown;
|
||||
}
|
||||
|
||||
std::string getStorageKeyString(const Key key) {
|
||||
auto it = std::find_if(
|
||||
_keyStringFromKey.begin(),
|
||||
_keyStringFromKey.end(),
|
||||
[key](const std::pair<const std::string, Key>& p) {
|
||||
return key == p.second;
|
||||
}
|
||||
);
|
||||
if (it == _keyStringFromKey.end()) return "";
|
||||
return it->first;
|
||||
}
|
||||
|
||||
} // namespace softwareintegration::storage
|
||||
|
||||
using namespace softwareintegration;
|
||||
|
||||
/* ============== SyncEngine functions ============== */
|
||||
@@ -27,13 +27,32 @@
|
||||
|
||||
|
||||
#include <openspace/util/syncable.h>
|
||||
#include <modules/softwareintegration/utils.h>
|
||||
#include <modules/softwareintegration/simp/simp.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace softwareintegration::storage {
|
||||
|
||||
enum class Key : uint8_t {
|
||||
DataPoints = 0,
|
||||
VelocityData,
|
||||
Colormap,
|
||||
ColormapAttrData,
|
||||
LinearSizeAttrData,
|
||||
Unknown
|
||||
};
|
||||
|
||||
Key getStorageKey(const std::string& key);
|
||||
|
||||
std::string getStorageKeyString(const Key key);
|
||||
|
||||
bool hasStorageKey(const std::string& key);
|
||||
|
||||
} // namespace softwareintegration::storage
|
||||
|
||||
using namespace softwareintegration;
|
||||
|
||||
class SyncableStorage : public Syncable {
|
||||
Reference in New Issue
Block a user