From 00211ddc3d8e9fb7d40110705b3087b3157e1a8e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 19 Feb 2013 17:08:32 -0800 Subject: [PATCH] add an overloaded << operator to simplify address debugging --- shared/src/AgentList.cpp | 1 + shared/src/AgentSocket.cpp | 3 ++- shared/src/AgentSocket.h | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/shared/src/AgentList.cpp b/shared/src/AgentList.cpp index a83da3e438..0e965e406d 100644 --- a/shared/src/AgentList.cpp +++ b/shared/src/AgentList.cpp @@ -25,6 +25,7 @@ int AgentList::updateList(char *packetData) { agentLocalSocket.address, &agentLocalSocket.port ))) { + std::vector::iterator it; for(it = agents.begin(); it != agents.end(); ++it) { diff --git a/shared/src/AgentSocket.cpp b/shared/src/AgentSocket.cpp index e44c00394f..6a7a7ab852 100644 --- a/shared/src/AgentSocket.cpp +++ b/shared/src/AgentSocket.cpp @@ -34,4 +34,5 @@ void AgentSocket::swap(AgentSocket &first, AgentSocket &second) { AgentSocket::~AgentSocket() { delete address; -} \ No newline at end of file +} + diff --git a/shared/src/AgentSocket.h b/shared/src/AgentSocket.h index 6c9277ff0f..de828aec30 100644 --- a/shared/src/AgentSocket.h +++ b/shared/src/AgentSocket.h @@ -17,10 +17,18 @@ class AgentSocket { AgentSocket(const AgentSocket &otherAgentSocket); AgentSocket& operator=(AgentSocket otherAgentSocket); ~AgentSocket(); + + + char *address; unsigned short port; private: void swap(AgentSocket &first, AgentSocket &second); }; +inline std::ostream& operator<<(std::ostream & Str, AgentSocket const &socket) { + Str << socket.address << ":" << socket.port; + return Str; +} + #endif /* defined(__hifi__AgentSocket__) */