Fixes build errors and warnings

This commit is contained in:
Victor Lindquist
2022-06-29 15:56:55 -06:00
parent 0322d12425
commit 10724bb362
3 changed files with 25 additions and 26 deletions

View File

@@ -98,7 +98,7 @@ void SoftwareConnection::addPropertySubscription(
}
// Set new onChange handler
SceneGraphNodeInfo::OnChangeHandle onChangeHandle = property->onChange(newHandler);
connection::SceneGraphNodeInfo::OnChangeHandle onChangeHandle = property->onChange(newHandler);
auto propertySubscriptions = _sceneGraphNodes.find(identifier);
if (propertySubscriptions == _sceneGraphNodes.end()) {
@@ -118,7 +118,7 @@ void SoftwareConnection::addPropertySubscription(
}
else {
// Property subscription doesn't exist
SceneGraphNodeInfo::PropertySubscription newPropertySubscription{ onChangeHandle };
connection::SceneGraphNodeInfo::PropertySubscription newPropertySubscription{ onChangeHandle };
propertySubscriptions->second.propertySubscriptions.emplace(propertyName, newPropertySubscription);
}
}

View File

@@ -53,6 +53,27 @@ namespace connection {
std::shared_ptr<SoftwareConnection> connectionPtr
);
struct SceneGraphNodeInfo {
using OnChangeHandle = properties::Property::OnChangeHandle;
struct PropertySubscription {
OnChangeHandle onChangehandle;
bool shouldSendMessage{ false };
};
using PropertySubscriptions = std::unordered_map<std::string, PropertySubscription>;
/* /\
|
propertyName
*/
using OutgoingMessages = std::unordered_map<
softwareintegration::simp::DataKey,
std::tuple<std::vector<std::byte>, int32_t>
>;
OutgoingMessages outgoingMessages{};
PropertySubscriptions propertySubscriptions{};
};
} // namespace connection
} // namespace softwareintegration::network
@@ -61,8 +82,6 @@ using namespace softwareintegration::network;
class SoftwareConnection {
public:
struct SceneGraphNodeInfo;
explicit SoftwareConnection(std::unique_ptr<ghoul::io::TcpSocket> socket);
SoftwareConnection(SoftwareConnection&& p);
~SoftwareConnection();
@@ -139,7 +158,7 @@ private:
std::unique_ptr<ghoul::io::TcpSocket> _socket;
std::unordered_map<std::string, SceneGraphNodeInfo> _sceneGraphNodes;
std::unordered_map<std::string, connection::SceneGraphNodeInfo> _sceneGraphNodes;
std::mutex _outgoingMessagesMutex;
std::atomic_bool _shouldStopOutgoingMessagesThread;
std::unique_ptr<std::thread> _outgoingMessagesThread;
@@ -155,26 +174,6 @@ private:
bool _handshakeHasBeenMade = false;
};
struct SoftwareConnection::SceneGraphNodeInfo {
using OnChangeHandle = properties::Property::OnChangeHandle;
struct PropertySubscription {
OnChangeHandle onChangehandle;
bool shouldSendMessage{ false };
};
using PropertySubscriptions = std::unordered_map<std::string, PropertySubscription>;
// /\
// |
// propertyName
using OutgoingMessages = std::unordered_map<
softwareintegration::simp::DataKey,
std::tuple<std::vector<std::byte>, int32_t>
>;
OutgoingMessages outgoingMessages{};
PropertySubscriptions propertySubscriptions{};
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SOFTWAREINTEGRATION___SOFTWAREINTEGRATIONMODULE___H__

View File

@@ -35,7 +35,7 @@ bool hostIsBigEndian() {
// is placed at the byte with the lowest address
// Example: 4 byte int with with value 1 is as bytes
// is 0001 for big endian and 1000 for little endian
return *(char*)&i == 0;
return *(const char*)&i == 0;
}
template <typename T>