00001 #ifndef QPID_CLUSTER_TYPES_H
00002 #define QPID_CLUSTER_TYPES_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <utility>
00025 #include <iosfwd>
00026 #include <stdint.h>
00027
00028 extern "C" {
00029 #include <openais/cpg.h>
00030 }
00031
00032 namespace qpid {
00033 namespace cluster {
00034
00035 class Connection;
00036
00038 struct MemberId : std::pair<uint32_t, uint32_t> {
00039 MemberId(uint32_t node=0, uint32_t pid=0) : std::pair<uint32_t,uint32_t>(node, pid) {}
00040 MemberId(const cpg_address& caddr) : std::pair<uint32_t,uint32_t>(caddr.nodeid, caddr.pid) {}
00041 uint32_t getNode() const { return first; }
00042 uint32_t getPid() const { return second; }
00043 };
00044
00045 inline bool operator==(const cpg_address& caddr, const MemberId& id) { return id == MemberId(caddr); }
00046
00047 std::ostream& operator<<(std::ostream&, const MemberId&);
00048
00049 struct ConnectionId : public std::pair<MemberId, Connection*> {
00050 ConnectionId(const MemberId& m=MemberId(), Connection* c=0) : std::pair<MemberId, Connection*> (m,c) {}
00051 MemberId getMember() const { return first; }
00052 Connection* getConnectionPtr() const { return second; }
00053 };
00054 std::ostream& operator<<(std::ostream&, const ConnectionId&);
00055
00056 }}
00057
00058 #endif