source: ThirdParty/JobMarket/src/JobMarket/Operations/Workers/ObtainJobOperation.hpp

Candidate_v1.6.1
Last change on this file was 363f28, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '404d2be35f6544290132fcbe8f79a4ff9c6584ad' as 'ThirdParty/JobMarket'

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * ObtainJobOperation.hpp
3 *
4 * Created on: Feb 26, 2012
5 * Author: heber
6 */
7
8#ifndef OBTAINJOBOPERATION_HPP_
9#define OBTAINJOBOPERATION_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
17#include <boost/asio.hpp>
18#include <string>
19#include <vector>
20
21#include "JobMarket/Connection.hpp"
22
23#include "JobMarket/Jobs/FragmentJob.hpp"
24#include "JobMarket/Operations/AsyncOperation.hpp"
25#include "JobMarket/Results/FragmentResult.hpp"
26
27class ObtainJobOperation : public AsyncOperation {
28public:
29 /// Constructor for class ObtainJobOperation.
30 ObtainJobOperation(Connection &_connection,
31 const boost::function<void ()> _callback_on_success = NoOpCallback,
32 const boost::function<void ()> _callback_on_failure = NoOpCallback) :
33 AsyncOperation(std::string("obtainjob"),_connection, _callback_on_success, _callback_on_failure)
34 {}
35 /// Destructor for class ObtainJobOperation
36 ~ObtainJobOperation() {}
37
38 /** Getter for the obtained job.
39 *
40 * @return obtained FragmentJob
41 */
42 FragmentJob::ptr getJob()
43 {
44 return job;
45 }
46
47protected:
48 // virtual function pointer to the connection handler
49 void handle_connect(const boost::system::error_code& e,
50 boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
51
52 /// Callback function when job has been received.
53 void handle_ReceiveJob(const boost::system::error_code& e);
54
55private:
56 /// The data received from the server.
57 FragmentJob::ptr job;
58};
59
60
61#endif /* OBTAINJOBOPERATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.