From d82422fbb3d9d34a0566197245376548ce3ef14e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 23 Jan 2015 10:15:34 +0100 Subject: Code indentation, minor corrections --- src/RemoteControl.h | 64 +++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 34 deletions(-) (limited to 'src/RemoteControl.h') diff --git a/src/RemoteControl.h b/src/RemoteControl.h index 7c830b2..905e153 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -93,40 +93,37 @@ class BaseRemoteController { virtual ~BaseRemoteController() {} }; -class RemoteControllers { /* Holds all our remote controllers, i.e. we may have more than * one type of controller running. -*/ + */ +class RemoteControllers { public: - RemoteControllers() {} - virtual ~RemoteControllers() {} - - void add_controller(BaseRemoteController *rc) { - m_controllers.push_back(rc); - } + void add_controller(BaseRemoteController *rc) { + m_controllers.push_back(rc); + } - void add_controllable(RemoteControllable *rc) { + void add_controllable(RemoteControllable *rc) { for (std::list::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it) { - (*it)->enrol(rc); - } - } - + (*it)->enrol(rc); + } + } + void check_faults() { for (std::list::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it) { - if ((*it)->fault_detected()) - { - fprintf(stderr, - "Detected Remote Control fault, restarting it\n"); - (*it)->restart(); - } - } - } - size_t get_no_controllers() { return m_controllers.size(); } - - private: - std::list m_controllers; + if ((*it)->fault_detected()) + { + fprintf(stderr, + "Detected Remote Control fault, restarting it\n"); + (*it)->restart(); + } + } + } + size_t get_no_controllers() { return m_controllers.size(); } + + private: + std::list m_controllers; }; /* Objects that support remote control must implement the following class */ @@ -306,15 +303,14 @@ class RemoteControllerZmq : public BaseRemoteController { public: RemoteControllerZmq() : m_running(false), m_fault(false), - m_zmqContext(1), + m_zmqContext(1), m_endpoint("") { } RemoteControllerZmq(std::string endpoint) : m_running(true), m_fault(false), m_child_thread(&RemoteControllerZmq::process, this), - m_zmqContext(1), - m_endpoint(endpoint) - { } + m_zmqContext(1), + m_endpoint(endpoint) { } ~RemoteControllerZmq() { m_running = false; @@ -336,9 +332,9 @@ class RemoteControllerZmq : public BaseRemoteController { private: void restart_thread(); - void recv_all(zmq::socket_t* pSocket, std::vector &message); - void send_ok_reply(zmq::socket_t *pSocket); - void send_fail_reply(zmq::socket_t *pSocket, const std::string &error); + void recv_all(zmq::socket_t* pSocket, std::vector &message); + void send_ok_reply(zmq::socket_t *pSocket); + void send_fail_reply(zmq::socket_t *pSocket, const std::string &error); void process(); @@ -377,8 +373,8 @@ class RemoteControllerZmq : public BaseRemoteController { /* This controller commands the controllables in the cohort */ std::list m_cohort; - zmq::context_t m_zmqContext; - std::string m_endpoint; + zmq::context_t m_zmqContext; + std::string m_endpoint; }; #endif -- cgit v1.2.3