use NodeSet in place of QSet<NodeType_t> where possible

This commit is contained in:
Stephen Birarda 2014-01-28 13:41:39 -08:00
parent 4de270b832
commit 423e1598f0
4 changed files with 9 additions and 10 deletions

View file

@ -144,7 +144,7 @@ void DomainServer::readAvailableDatagrams() {
} }
} }
const QSet<NodeType_t> STATICALLY_ASSIGNED_NODES = QSet<NodeType_t>() << NodeType::AudioMixer const NodeSet STATICALLY_ASSIGNED_NODES = NodeSet() << NodeType::AudioMixer
<< NodeType::AvatarMixer << NodeType::VoxelServer << NodeType::ParticleServer << NodeType::AvatarMixer << NodeType::VoxelServer << NodeType::ParticleServer
<< NodeType::MetavoxelServer; << NodeType::MetavoxelServer;

View file

@ -229,7 +229,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
#endif #endif
// tell the NodeList instance who to tell the domain server we care about // tell the NodeList instance who to tell the domain server we care about
nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NodeType_t>() << NodeType::AudioMixer << NodeType::AvatarMixer nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer
<< NodeType::VoxelServer << NodeType::ParticleServer << NodeType::VoxelServer << NodeType::ParticleServer
<< NodeType::MetavoxelServer); << NodeType::MetavoxelServer);
@ -648,8 +648,7 @@ void Application::resetProfile(const QString& username) {
updateWindowTitle(); updateWindowTitle();
} }
void Application::controlledBroadcastToNodes(const QByteArray& packet, void Application::controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes) {
const QSet<NodeType_t>& destinationNodeTypes) {
foreach(NodeType_t type, destinationNodeTypes) { foreach(NodeType_t type, destinationNodeTypes) {
// Intercept data to voxel server when voxels are disabled // Intercept data to voxel server when voxels are disabled
if (type == NodeType::VoxelServer && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { if (type == NodeType::VoxelServer && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
@ -657,7 +656,7 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet,
} }
// Perform the broadcast for one type // Perform the broadcast for one type
int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NodeType_t>() << type); int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, NodeSet() << type);
// Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
BandwidthMeter::ChannelIndex channel; BandwidthMeter::ChannelIndex channel;
@ -1332,7 +1331,7 @@ void Application::wheelEvent(QWheelEvent* event) {
void Application::sendPingPackets() { void Application::sendPingPackets() {
QByteArray pingPacket = NodeList::getInstance()->constructPingPacket(); QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NodeType_t>() << NodeType::VoxelServer getInstance()->controlledBroadcastToNodes(pingPacket, NodeSet() << NodeType::VoxelServer
<< NodeType::ParticleServer << NodeType::ParticleServer
<< NodeType::AudioMixer << NodeType::AvatarMixer << NodeType::AudioMixer << NodeType::AvatarMixer
<< NodeType::MetavoxelServer); << NodeType::MetavoxelServer);
@ -2363,7 +2362,7 @@ void Application::updateAvatar(float deltaTime) {
QByteArray avatarData = byteArrayWithPopluatedHeader(PacketTypeAvatarData); QByteArray avatarData = byteArrayWithPopluatedHeader(PacketTypeAvatarData);
avatarData.append(_myAvatar.toByteArray()); avatarData.append(_myAvatar.toByteArray());
controlledBroadcastToNodes(avatarData, QSet<NodeType_t>() << NodeType::AvatarMixer); controlledBroadcastToNodes(avatarData, NodeSet() << NodeType::AvatarMixer);
// Update _viewFrustum with latest camera and view frustum data... // Update _viewFrustum with latest camera and view frustum data...
// NOTE: we get this from the view frustum, to make it simpler, since the // NOTE: we get this from the view frustum, to make it simpler, since the

View file

@ -175,7 +175,7 @@ public:
Profile* getProfile() { return &_profile; } Profile* getProfile() { return &_profile; }
void resetProfile(const QString& username); void resetProfile(const QString& username);
void controlledBroadcastToNodes(const QByteArray& packet, const QSet<NodeType_t>& destinationNodeTypes); void controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes);
void setupWorldLight(); void setupWorldLight();

View file

@ -263,7 +263,7 @@ void NodeList::addNodeTypeToInterestSet(NodeType_t nodeTypeToAdd) {
_nodeTypesOfInterest << nodeTypeToAdd; _nodeTypesOfInterest << nodeTypeToAdd;
} }
void NodeList::addSetOfNodeTypesToNodeInterestSet(const QSet<NodeType_t>& setOfNodeTypes) { void NodeList::addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes) {
_nodeTypesOfInterest.unite(setOfNodeTypes); _nodeTypesOfInterest.unite(setOfNodeTypes);
} }
@ -621,7 +621,7 @@ SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
} }
unsigned NodeList::broadcastToNodes(const QByteArray& packet, unsigned NodeList::broadcastToNodes(const QByteArray& packet,
const QSet<NodeType_t>& destinationNodeTypes) { const NodeSet& destinationNodeTypes) {
unsigned n = 0; unsigned n = 0;
foreach (const SharedNodePointer& node, getNodeHash()) { foreach (const SharedNodePointer& node, getNodeHash()) {