CClientRegistry

Name

CClientRegistry -- Registry of clients.

Synopsis


#include <stdexcept>
#include <CClientRegistry>

class CClientRegistry {
public:
    void add(uint64_t newId);
    void remove(uint64_t existingId);
    bool hasClient(uint64_t id);
    bool empty();
};
        

DESCRIPTION

Some transports need to be able to identify clients. For example, a fanout transport must, when there's no data remaining, send an end to all remaining clients. The CClientRegistry allows each client to have a unique uint64_t identifier.

It provides the facility to add and remove clients, to test for the presence of clients and to test for an empty client registry.

The class prevents client duplication and removal of nonexistent clients by throwing std::logic_error exceptions.

METHODS

void add(uint64_t newId);

Adds newId to the set of identifiers that are registered. If newId has already been registered, std::logic_error is thrown.

void remove(uint64_t existingId);

Removes the id existingId from the registry. If that id was not yet registered, a std::logic_error is thrown.

bool hasClient(uint64_t id);

Returns true if id is in the registry otherwise false is returned.

bool empty();

Return true if the registry has no entryies.