• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/client/OperationStatus.hh

00001 /*
00002  * Copyright Staffan Gimåker 2007-2010.
00003  *
00004  * ---
00005  *
00006  * Distributed under the Boost Software License, Version 1.0.
00007  * (See accompanying file LICENSE_1_0.txt or copy at
00008  * http://www.boost.org/LICENSE_1_0.txt)
00009  */
00010 
00011 #ifndef PEEKABOT_CLIENT_OPERATION_STATUS_HH_INCLUDED
00012 #define PEEKABOT_CLIENT_OPERATION_STATUS_HH_INCLUDED
00013 
00014 
00015 #include <string>
00016 #include <boost/utility.hpp>
00017 #include <boost/thread/mutex.hpp>
00018 #include <boost/thread/condition.hpp>
00019 
00020 
00021 namespace peekabot
00022 {
00023     namespace client
00024     {
00028         enum OperationOutcome
00029         {
00033             OUTCOME_PENDING = 0,
00034 
00038             OPERATION_SUCCEEDED = 1,
00039 
00043             OPERATION_FAILED = 2
00044         };
00045 
00046 
00061         class OperationStatus : public boost::noncopyable
00062         {
00063         public:
00064             OperationStatus();
00065 
00066 
00067             virtual ~OperationStatus();
00068 
00069 
00073             OperationOutcome get_outcome() const;
00074 
00075 
00087             void set_outcome(
00088                 OperationOutcome outcome,
00089                 const std::string &error_msg = "");
00090 
00091 
00099             std::string get_error_msg() const;
00100 
00101 
00109             bool wait_until_completed() const;
00110 
00111 
00116             void wake() const;
00117 
00129             void client_disconnected();
00130 
00131         private:
00135             mutable boost::mutex m_mutex;
00136 
00142             OperationOutcome m_outcome;
00143 
00148             std::string m_error_msg;
00149 
00157             mutable boost::condition m_outcome_cond;
00158 
00167             volatile bool m_client_was_disconnected;
00168         };
00169     }
00170 }
00171 
00172 #endif // PEEKABOT_CLIENT_OPERATION_STATUS_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1