/* * ObtainJobOperation.hpp * * Created on: Feb 26, 2012 * Author: heber */ #ifndef OBTAINJOBOPERATION_HPP_ #define OBTAINJOBOPERATION_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Connection.hpp" #include "Jobs/FragmentJob.hpp" #include "Operations/AsyncOperation.hpp" #include "Results/FragmentResult.hpp" class ObtainJobOperation : public AsyncOperation { public: /// Constructor for class ObtainJobOperation. ObtainJobOperation(Connection &_connection, const boost::function &_callback_on_success = NoOpCallback, const boost::function &_callback_on_failure = NoOpCallback) : AsyncOperation(std::string("obtainjob"),_connection, _callback_on_success, _callback_on_failure) {} /// Destructor for class ObtainJobOperation ~ObtainJobOperation() {} /** Getter for the obtained job. * * @return obtained FragmentJob */ FragmentJob::ptr getJob() { return job; } protected: // virtual function pointer to the connection handler void handle_connect(const boost::system::error_code& e, boost::asio::ip::tcp::resolver::iterator endpoint_iterator); /// Callback function when job has been received. void handle_ReceiveJob(const boost::system::error_code& e); private: /// The data received from the server. FragmentJob::ptr job; }; #endif /* OBTAINJOBOPERATION_HPP_ */