Files
pip/utils/cloud_dispatcher/cloudserver.h
2024-03-25 21:17:05 +03:00

34 lines
808 B
C++

#ifndef CLOUDSERVER_H
#define CLOUDSERVER_H
#include "dispatcherclient.h"
class CloudServer: public PIObject {
PIOBJECT(CloudServer)
public:
CloudServer(DispatcherClient * c, const PIByteArray & sname);
~CloudServer();
PIByteArray serverUUID() const;
void addClient(DispatcherClient * c);
void removeClient(DispatcherClient * c);
PIVector<DispatcherClient *> getClients();
EVENT_HANDLER0(void, printStatus);
const DispatcherClient * getConnection() const { return server; }
double lastPing();
void close();
void stop();
private:
PIVector<PIObject::Connection> connects;
DispatcherClient * server;
PIVector<DispatcherClient *> clients;
PIMap<uint, DispatcherClient *> index_clients;
PIByteArray server_uuid;
PITimeMeasurer last_ping;
PIMutex mutex_clients;
};
#endif // CLOUDSERVER_H