/* * SendJobsOperation.hpp * * Created on: Dec 11, 2011 * Author: heber */ #ifndef FRAGMENTCONTROLLER_SENDJOBSOPERATION_HPP_ #define FRAGMENTCONTROLLER_SENDJOBSOPERATION_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Connection.hpp" #include "Jobs/FragmentJob.hpp" #include "Operations/AsyncOperation.hpp" class SendJobsOperation : public AsyncOperation { public: /// Constructor for class SendJobsOperation. SendJobsOperation(Connection &_connection, const boost::function &_callback_on_success = NoOpCallback, const boost::function &_callback_on_failure = NoOpCallback) : AsyncOperation(std::string("sendjobs"), _connection, _callback_on_success, _callback_on_failure) {} /// Destructor for class SendJobsOperation ~SendJobsOperation() {} public: // 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); /// Callback function when bunch of jobs have been sent. void handle_SendJobs(const boost::system::error_code& e); /// Setter for jobs void addJobs(const std::vector &jobs); /** Getter for number of jobs present in the queue. * * \return jobs.size() */ size_t getPresentJobs() const { return jobs.size(); } protected: void handle_FinishOperation(const boost::system::error_code& e); /// bunch of jobs std::vector jobs; }; #endif /* FRAGMENTCONTROLLER_SENDJOBSOPERATION_HPP_ */