diff --git a/apps/clientconsole/CMakeLists.txt b/apps/clientconsole/CMakeLists.txt index e6885841f..702fbbf8a 100755 --- a/apps/clientconsole/CMakeLists.txt +++ b/apps/clientconsole/CMakeLists.txt @@ -1,2 +1,2 @@ -project(clientconsole) -add_executable(clientconsole client.cpp) +project(clientconsole) +add_executable(clientconsole client.cpp) diff --git a/apps/clientconsole/client.cpp b/apps/clientconsole/client.cpp index 119f8c554..d7d93e030 100755 --- a/apps/clientconsole/client.cpp +++ b/apps/clientconsole/client.cpp @@ -108,7 +108,7 @@ int main(int argc, char* argv[]) do { std::cout << "Client> "; - std::string buffer; + std::string buffer; std::getline(std::cin, buffer); if (buffer == "quit") diff --git a/components/commandserver/command.hpp b/components/commandserver/command.hpp index b221d512b..128b87697 100755 --- a/components/commandserver/command.hpp +++ b/components/commandserver/command.hpp @@ -1,19 +1,19 @@ -#ifndef COMMANDSERVER_COMMAND_HPP -#define COMMANDSERVER_COMMAND_HPP - -namespace OMW -{ - /// - /// A Command is currently defined as a string input that, when processed, - /// will generate a string output. The string output is passed to the - /// mReplyFunction as soon as the command has been processed. - /// - class Command - { - public: - std::string mCommand; - boost::function1 mReplyFunction; - }; -} - -#endif COMMANDSERVER_COMMAND_HPP +#ifndef COMMANDSERVER_COMMAND_HPP +#define COMMANDSERVER_COMMAND_HPP + +namespace OMW +{ + /// + /// A Command is currently defined as a string input that, when processed, + /// will generate a string output. The string output is passed to the + /// mReplyFunction as soon as the command has been processed. + /// + class Command + { + public: + std::string mCommand; + boost::function1 mReplyFunction; + }; +} + +#endif COMMANDSERVER_COMMAND_HPP diff --git a/components/misc/tsdeque.hpp b/components/misc/tsdeque.hpp index d63a132ef..88b2ce001 100755 --- a/components/misc/tsdeque.hpp +++ b/components/misc/tsdeque.hpp @@ -6,51 +6,51 @@ // // Adapted from http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html // -template -class TsDeque -{ -private: - std::deque the_queue; - mutable boost::mutex the_mutex; - boost::condition_variable the_condition_variable; - -public: - void push_back(Data const& data) - { - boost::mutex::scoped_lock lock(the_mutex); - the_queue.push_back(data); - lock.unlock(); - the_condition_variable.notify_one(); - } - - bool empty() const - { - boost::mutex::scoped_lock lock(the_mutex); - return the_queue.empty(); - } - - bool try_pop_front(Data& popped_value) - { - boost::mutex::scoped_lock lock(the_mutex); - if(the_queue.empty()) - return false; - - popped_value=the_queue.front(); - the_queue.pop_front(); - return true; - } - - void wait_and_pop_front(Data& popped_value) - { - boost::mutex::scoped_lock lock(the_mutex); - while(the_queue.empty()) - { - the_condition_variable.wait(lock); - } - - popped_value=the_queue.front(); - the_queue.pop_front(); - } +template +class TsDeque +{ +private: + std::deque the_queue; + mutable boost::mutex the_mutex; + boost::condition_variable the_condition_variable; + +public: + void push_back(Data const& data) + { + boost::mutex::scoped_lock lock(the_mutex); + the_queue.push_back(data); + lock.unlock(); + the_condition_variable.notify_one(); + } + + bool empty() const + { + boost::mutex::scoped_lock lock(the_mutex); + return the_queue.empty(); + } + + bool try_pop_front(Data& popped_value) + { + boost::mutex::scoped_lock lock(the_mutex); + if(the_queue.empty()) + return false; + + popped_value=the_queue.front(); + the_queue.pop_front(); + return true; + } + + void wait_and_pop_front(Data& popped_value) + { + boost::mutex::scoped_lock lock(the_mutex); + while(the_queue.empty()) + { + the_condition_variable.wait(lock); + } + + popped_value=the_queue.front(); + the_queue.pop_front(); + } }; #endif // TSDEQUE_H