From 450542b4b9a7cf6987c192abbf7e2cc44da286d2 Mon Sep 17 00:00:00 2001 From: athile Date: Fri, 2 Jul 2010 00:05:57 -0700 Subject: [PATCH] Fix Windows line feeds and chdmod --- apps/clientconsole/CMakeLists.txt | 4 +- apps/clientconsole/client.cpp | 2 +- components/commandserver/command.hpp | 38 ++++++------ components/misc/tsdeque.hpp | 90 ++++++++++++++-------------- 4 files changed, 67 insertions(+), 67 deletions(-) diff --git a/apps/clientconsole/CMakeLists.txt b/apps/clientconsole/CMakeLists.txt index e6885841f1..702fbbf8a5 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 119f8c5547..d7d93e0306 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 b221d512bf..128b87697a 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 d63a132ef3..88b2ce001c 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