65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
/*
|
|
* File: PeerList.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on May 10, 2010, 5:33 PM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef _PEERLIST_H
|
|
#define _PEERLIST_H
|
|
|
|
#include "common/Defines.h"
|
|
#include "ms/Peer.h"
|
|
#include "List.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Stores a number of peers
|
|
* @class PeerList
|
|
* @ingroup Moversight
|
|
* @author Jan Gäbler
|
|
*/
|
|
class PeerList {
|
|
friend class Cluster;
|
|
public:
|
|
|
|
PeerList();
|
|
virtual ~PeerList();
|
|
|
|
void add(Peer & peer);
|
|
void add(const Peer & peer);
|
|
void add(PeerList & list);
|
|
|
|
void clear();
|
|
|
|
void remove(const Peer & peer);
|
|
void remove(PeerID pId);
|
|
|
|
size_t size() const;
|
|
|
|
bool contains(Peer & peer) const;
|
|
bool contains(PeerID id) const;
|
|
|
|
Peer & get(size_t index);
|
|
const Peer & get(size_t index) const;
|
|
Peer & getByID(PeerID id);
|
|
const Peer & getByID(PeerID id) const;
|
|
Peer & getFirst();
|
|
|
|
private:
|
|
void setClusterReferrer(ClusterReferrer & cRef);
|
|
|
|
typedef List<Peer> PList;
|
|
PList queue;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endif /* _PEERLIST_H */
|
|
|