Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef CLIENT_HPP
- #define CLIENT_HPP
- #include <queue>
- #include <string>
- #include <boost/function.hpp>
- #include <boost/thread.hpp>
- #include <zmq.h>
- namespace GSLogger {
- class Client;
- }
- class GSLogger::Client
- {
- private:
- static const std::string MSG_RECEIVED;
- public:
- boost::function<void(const std::string &)> OnMessageSent;
- private:
- std::string m_id;
- bool m_running;
- size_t m_port;
- std::queue<std::string> m_requests;
- boost::thread *m_workerThread;
- boost::mutex m_workerMutex;
- boost::mutex m_dataMutex;
- void *m_context;
- void *m_socket;
- public:
- Client();
- Client(const std::string &id, size_t port);
- ~Client();
- public:
- void SetId(const std::string &id);
- void SetPort(const size_t port);
- bool IsRunning();
- void Start();
- void Stop();
- void SendMessage(const std::string &msg);
- private:
- void SendRequest(const std::string &req);
- void SendRequests();
- };
- #endif /* CLIENT_HPP */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement