/* * AsyncOperation.hpp * * Created on: Nov 11, 2011 * Author: heber */ #ifndef FRAGMENTCONTROLLER_ASYNCOPERATION_HPP_ #define FRAGMENTCONTROLLER_ASYNCOPERATION_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Connection.hpp" class AsyncOperation { public: AsyncOperation(const std::string &_name, Connection &_connection); virtual ~AsyncOperation(); public: /// The Connection to the server. Connection &connection_; // virtual function pointer to the operation to do void operator()(const std::string& _host, const std::string& _service); // virtual function pointer to the connection handler virtual void handle_connect(const boost::system::error_code& e, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) = 0; /// Handle completion of an operation. void handle_FinishOperation(const boost::system::error_code& e); enum Exitflag_t { OkFlag = 0, ErrorFlag = 255 }; /** Getter for Exitflag. * * @return Exitflag */ size_t getExitflag() const { return Exitflag; } std::string getName() const { return name; } private: /// Name of this Operation (required for Registry pattern) std::string name; protected: /// internal function to disconnect from server void disconnect(); // exit flag of this operation enum Exitflag_t Exitflag; }; #endif /* FRAGMENTCONTROLLER_ASYNCOPERATION_HPP_ */