add an overloaded << operator to simplify address debugging

This commit is contained in:
Stephen Birarda 2013-02-19 17:08:32 -08:00
parent bd02f48943
commit 00211ddc3d
3 changed files with 11 additions and 1 deletions

View file

@ -25,6 +25,7 @@ int AgentList::updateList(char *packetData) {
agentLocalSocket.address,
&agentLocalSocket.port
))) {
std::vector<Agent>::iterator it;
for(it = agents.begin(); it != agents.end(); ++it) {

View file

@ -34,4 +34,5 @@ void AgentSocket::swap(AgentSocket &first, AgentSocket &second) {
AgentSocket::~AgentSocket() {
delete address;
}
}

View file

@ -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__) */