| [a8f54b6] | 1 | /* | 
|---|
|  | 2 | * RemoveFromPoolOperation.hpp | 
|---|
|  | 3 | * | 
|---|
|  | 4 | *  Created on: Mar 01, 2012 | 
|---|
|  | 5 | *      Author: heber | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #ifndef FRAGMENTCONTROLLER_REMOVEFROMPOOLOPERATION_HPP_ | 
|---|
|  | 9 | #define FRAGMENTCONTROLLER_REMOVEFROMPOOLOPERATION_HPP_ | 
|---|
|  | 10 |  | 
|---|
|  | 11 | // include config.h | 
|---|
|  | 12 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 13 | #include <config.h> | 
|---|
|  | 14 | #endif | 
|---|
|  | 15 |  | 
|---|
|  | 16 | #include <boost/asio.hpp> | 
|---|
|  | 17 | #include <string> | 
|---|
|  | 18 | #include <vector> | 
|---|
|  | 19 |  | 
|---|
|  | 20 | #include "Connection.hpp" | 
|---|
|  | 21 |  | 
|---|
| [bff93d] | 22 | #include "Operations/AsyncOperation.hpp" | 
|---|
| [a8f54b6] | 23 | #include "WorkerAddress.hpp" | 
|---|
|  | 24 |  | 
|---|
| [bff93d] | 25 | class RemoveFromPoolOperation : public AsyncOperation  { | 
|---|
| [a8f54b6] | 26 | public: | 
|---|
|  | 27 | /// Constructor for class RemoveFromPoolOperation. | 
|---|
| [bff93d] | 28 | RemoveFromPoolOperation(Connection &_connection, const WorkerAddress &_address, | 
|---|
|  | 29 | const boost::function<void ()> &_callback_on_success = NoOpCallback, | 
|---|
|  | 30 | const boost::function<void ()> &_callback_on_failure = NoOpCallback) : | 
|---|
|  | 31 | AsyncOperation(std::string("shutdownworker"),_connection, _callback_on_success, _callback_on_failure), | 
|---|
| [a8f54b6] | 32 | address(_address) | 
|---|
|  | 33 | {} | 
|---|
|  | 34 | /// Destructor for class RemoveFromPoolOperation | 
|---|
|  | 35 | ~RemoveFromPoolOperation() {} | 
|---|
|  | 36 |  | 
|---|
|  | 37 | public: | 
|---|
| [bff93d] | 38 | // virtual function pointer to the connection handler | 
|---|
|  | 39 | void handle_connect(const boost::system::error_code& e, | 
|---|
|  | 40 | boost::asio::ip::tcp::resolver::iterator endpoint_iterator); | 
|---|
|  | 41 |  | 
|---|
|  | 42 | /// Callback function when address has been sent and we ask for removal | 
|---|
|  | 43 | void handle_SendChoice(const boost::system::error_code& e); | 
|---|
|  | 44 |  | 
|---|
|  | 45 | /// Callback function when receiving flag indication succesful removal | 
|---|
|  | 46 | void handle_ReceiveFlag(const boost::system::error_code& e); | 
|---|
|  | 47 |  | 
|---|
|  | 48 | /// Callback function when op is finished. | 
|---|
|  | 49 | void handle_FinishOperation(const boost::system::error_code& e); | 
|---|
| [a8f54b6] | 50 |  | 
|---|
|  | 51 | private: | 
|---|
|  | 52 | //!> address to enroll with | 
|---|
|  | 53 | WorkerAddress address; | 
|---|
| [bff93d] | 54 |  | 
|---|
|  | 55 | //!> flag indication successful removal from server | 
|---|
|  | 56 | bool RemovalFlag; | 
|---|
| [a8f54b6] | 57 | }; | 
|---|
|  | 58 |  | 
|---|
|  | 59 | #endif /* FRAGMENTCONTROLLER_REMOVEFROMPOOLOPERATION_HPP_ */ | 
|---|