]> git.llucax.com Git - software/posixx.git/blob - src/linux/tipc/print.hpp
Implement operator == for all tipc objects
[software/posixx.git] / src / linux / tipc / print.hpp
1 #ifndef POSIXX_LINUX_TIPC_PRINT_HPP_
2 #define POSIXX_LINUX_TIPC_PRINT_HPP_
3
4 #include "../tipc.hpp" // posixx::linux::tipc::sockaddr
5 #include <ostream> // std::ostream
6
7 inline
8 std::ostream& operator << (std::ostream& os,
9                 const posixx::linux::tipc::sockaddr& sa) throw()
10 {
11         using posixx::linux::tipc::sockaddr;
12         os << "tipc::sockaddr(scope=" << unsigned(sa.scope) << ", ";
13         switch (sa.type())
14         {
15         case sockaddr::ID:
16                 os << "id(ref=" << sa.addr.id.ref
17                                 << ", node=" << sa.addr.id.node << ")";
18                 break;
19         case sockaddr::NAME:
20                 os << "name(type=" << sa.addr.name.name.type
21                                 << ", instance=" << sa.addr.name.name.instance
22                                 << ", domain=" << sa.addr.name.domain << ")";
23                 break;
24         case sockaddr::NAMESEQ:
25                 os << "nameseq(type=" << sa.addr.nameseq.type
26                                 << ", lower=" << sa.addr.nameseq.lower
27                                 << ", upper=" << sa.addr.nameseq.upper << ")";
28                 break;
29         default:
30                 os << "UNKNOWN!";
31         }
32         return os << ")";
33 }
34
35 #endif // POSIXX_LINUX_TIPC_PRINT_HPP_