History

cleanup Node types, closes #1726

Stephen Birarda committed 12 years ago

Commit 4de270b1 parent fe410ae44 files · +176 −184Browse files

Showing the changes to interface/src/Application.cpp (1 of 44 files). Show all

Unified · Split

interface/src/Application.cpp+27−27
@@ -182,7 +182,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 181 unmodified lines
182182 _nodeThread->setPriority(QThread::TimeCriticalPriority);
183183
184184 // put the NodeList and datagram processing on the node thread
185− NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort);
185+ NodeList* nodeList = NodeList::createInstance(NodeType::Agent, listenPort);
186186
187187 nodeList->moveToThread(_nodeThread);
188188 _datagramProcessor.moveToThread(_nodeThread);
@@ -229,9 +229,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 40 unmodified lines
229229 #endif
230230
231231 // tell the NodeList instance who to tell the domain server we care about
232− nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
233− << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER
234− << NODE_TYPE_METAVOXEL_SERVER);
232+ nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NodeType_t>() << NodeType::AudioMixer << NodeType::AvatarMixer
233+ << NodeType::VoxelServer << NodeType::ParticleServer
234+ << NodeType::MetavoxelServer);
235235
236236 // connect to the packet sent signal of the _voxelEditSender and the _particleEditSender
237237 connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent);
@@ -649,24 +649,24 @@ void Application::resetProfile(const QString& username) { · 411 unmodified lines
649649 }
650650
651651 void Application::controlledBroadcastToNodes(const QByteArray& packet,
652− const QSet<NODE_TYPE>& destinationNodeTypes) {
653− foreach(NODE_TYPE type, destinationNodeTypes) {
652+ const QSet<NodeType_t>& destinationNodeTypes) {
653+ foreach(NodeType_t type, destinationNodeTypes) {
654654 // Intercept data to voxel server when voxels are disabled
655− if (type == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
655+ if (type == NodeType::VoxelServer && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
656656 continue;
657657 }
658658
659659 // Perform the broadcast for one type
660− int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NODE_TYPE>() << type);
660+ int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NodeType_t>() << type);
661661
662662 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
663663 BandwidthMeter::ChannelIndex channel;
664664 switch (type) {
665− case NODE_TYPE_AGENT:
666− case NODE_TYPE_AVATAR_MIXER:
665+ case NodeType::Agent:
666+ case NodeType::AvatarMixer:
667667 channel = BandwidthMeter::AVATARS;
668668 break;
669− case NODE_TYPE_VOXEL_SERVER:
669+ case NodeType::VoxelServer:
670670 channel = BandwidthMeter::VOXELS;
671671 break;
672672 default:
@@ -1332,10 +1332,10 @@ void Application::wheelEvent(QWheelEvent* event) { · 659 unmodified lines
13321332
13331333 void Application::sendPingPackets() {
13341334 QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
1335− getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NODE_TYPE>() << NODE_TYPE_VOXEL_SERVER
1336− << NODE_TYPE_PARTICLE_SERVER
1337− << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
1338− << NODE_TYPE_METAVOXEL_SERVER);
1335+ getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NodeType_t>() << NodeType::VoxelServer
1336+ << NodeType::ParticleServer
1337+ << NodeType::AudioMixer << NodeType::AvatarMixer
1338+ << NodeType::MetavoxelServer);
13391339 }
13401340
13411341 // Every second, check the frame rates and other stuff
@@ -2363,7 +2363,7 @@ void Application::updateAvatar(float deltaTime) { · 1021 unmodified lines
23632363 QByteArray avatarData = byteArrayWithPopluatedHeader(PacketTypeAvatarData);
23642364 avatarData.append(_myAvatar.toByteArray());
23652365
2366− controlledBroadcastToNodes(avatarData, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
2366+ controlledBroadcastToNodes(avatarData, QSet<NodeType_t>() << NodeType::AvatarMixer);
23672367
23682368 // Update _viewFrustum with latest camera and view frustum data...
23692369 // NOTE: we get this from the view frustum, to make it simpler, since the
@@ -2374,11 +2374,11 @@ void Application::updateAvatar(float deltaTime) { · 4 unmodified lines
23742374 loadViewFrustum(_myCamera, _viewFrustum);
23752375
23762376 // Update my voxel servers with my current voxel query...
2377− queryOctree(NODE_TYPE_VOXEL_SERVER, PacketTypeVoxelQuery, _voxelServerJurisdictions);
2378− queryOctree(NODE_TYPE_PARTICLE_SERVER, PacketTypeParticleQuery, _particleServerJurisdictions);
2377+ queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions);
2378+ queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions);
23792379 }
23802380
2381−void Application::queryOctree(NODE_TYPE serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
2381+void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
23822382
23832383 // if voxels are disabled, then don't send this at all...
23842384 if (!Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
@@ -3192,8 +3192,8 @@ void Application::displayStats() { · 807 unmodified lines
31923192 int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0;
31933193
31943194 NodeList* nodeList = NodeList::getInstance();
3195− SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
3196− SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
3195+ SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
3196+ SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
31973197
31983198 pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;
31993199 pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0;
@@ -3203,7 +3203,7 @@ void Application::displayStats() { · 3 unmodified lines
32033203 int voxelServerCount = 0;
32043204
32053205 foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
3206− if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
3206+ if (node->getType() == NodeType::VoxelServer) {
32073207 totalPingVoxel += node->getPingMs();
32083208 voxelServerCount++;
32093209 if (pingVoxelMax < node->getPingMs()) {
@@ -3274,7 +3274,7 @@ void Application::displayStats() { · 64 unmodified lines
32743274 drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarBodyYaw, .93f, .93f, .93f);
32753275
32763276 if (_statsExpanded) {
3277− SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
3277+ SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);
32783278 if (avatarMixer) {
32793279 sprintf(avatarMixerStats, "Avatar Mixer: %.f kbps, %.f pps",
32803280 roundf(avatarMixer->getAverageKilobitsPerSecond()),
@@ -3952,7 +3952,7 @@ void Application::domainChanged(const QString& domainHostname) { · 671 unmodified lines
39523952 }
39533953
39543954 void Application::nodeKilled(SharedNodePointer node) {
3955− if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
3955+ if (node->getType() == NodeType::VoxelServer) {
39563956 QUuid nodeUUID = node->getUUID();
39573957 // see if this is the first we've heard of this node...
39583958 if (_voxelServerJurisdictions.find(nodeUUID) != _voxelServerJurisdictions.end()) {
@@ -3983,7 +3983,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines
39833983 }
39843984 _voxelSceneStatsLock.unlock();
39853985
3986− } else if (node->getType() == NODE_TYPE_PARTICLE_SERVER) {
3986+ } else if (node->getType() == NodeType::ParticleServer) {
39873987 QUuid nodeUUID = node->getUUID();
39883988 // see if this is the first we've heard of this node...
39893989 if (_particleServerJurisdictions.find(nodeUUID) != _particleServerJurisdictions.end()) {
@@ -4014,7 +4014,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines
40144014 }
40154015 _voxelSceneStatsLock.unlock();
40164016
4017− } else if (node->getType() == NODE_TYPE_AVATAR_MIXER) {
4017+ } else if (node->getType() == NodeType::AvatarMixer) {
40184018 // our avatar mixer has gone away - clear the hash of avatars
40194019 _avatarManager.clearHash();
40204020 }
@@ -4066,7 +4066,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const HifiSockAddr& · 45 unmodified lines
40664066
40674067 // see if this is the first we've heard of this node...
40684068 NodeToJurisdictionMap* jurisdiction = NULL;
4069− if (server->getType() == NODE_TYPE_VOXEL_SERVER) {
4069+ if (server->getType() == NodeType::VoxelServer) {
40704070 jurisdiction = &_voxelServerJurisdictions;
40714071 } else {
40724072 jurisdiction = &_particleServerJurisdictions;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t