Index: src/Fragmentation/Automation/Controller/Commands/Operation.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/Commands/Operation.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/Commands/Operation.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,97 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Operation.cpp
+ *
+ *  Created on: Nov 11, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <boost/bind.hpp>
+#include <vector>
+#include "Connection.hpp" // Must come before boost/serialization headers.
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "types.hpp"
+
+#include "Controller/Commands/Operation.hpp"
+
+
+/** Constructor for class Operation.
+ *
+ * \param _connection connection to operate on
+ */
+Operation::Operation(Connection &_connection, const std::string& _host, const std::string& _service) :
+    connection_(_connection),
+    host(_host),
+    service(_service),
+    Exitflag(OkFlag)
+{}
+
+/** Destructor for class Operation.
+ *
+ */
+Operation::~Operation()
+{}
+
+/** Callback function when an operation has been completed.
+ *
+ * \param e error code if something went wrong
+ */
+void Operation::handle_FinishOperation(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    LOG(1, "INFO: Operation completed.");
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+
+  // Since we are not starting a new operation the io_service will run out of
+  // work to do and the client will exit.
+}
+
+/** Internal function to resolve all possible connection endpoints.
+ *
+ * \return endpoint iterator of connection
+ */
+boost::asio::ip::tcp::resolver::iterator Operation::getEndpointIterator()
+{
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver resolver(connection_.socket().get_io_service());
+  boost::asio::ip::tcp::resolver::query query(host, service);
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
+    resolver.resolve(query);
+
+  return endpoint_iterator;
+}
+
+/** Internal function to disconnect connection_ correctly.
+ *
+ */
+void Operation::disconnect()
+{
+  //connection_.socket().close();
+}
+
Index: src/Fragmentation/Automation/Controller/Commands/Operation.hpp
===================================================================
--- src/Fragmentation/Automation/Controller/Commands/Operation.hpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/Commands/Operation.hpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,68 @@
+/*
+ * Operation.hpp
+ *
+ *  Created on: Nov 11, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTCONTROLLER_OPERATION_HPP_
+#define FRAGMENTCONTROLLER_OPERATION_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/asio.hpp>
+#include <string>
+#include <vector>
+
+#include "Connection.hpp"
+
+class Operation {
+public:
+  Operation(Connection &_connection, const std::string& _host, const std::string& _service);
+  virtual ~Operation();
+public:
+  /// The Connection to the server.
+  Connection &connection_;
+
+  // virtual function pointer to the operation to do
+  virtual void operator()() = 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;
+  }
+
+protected:
+  /// internal function to resolve host name and ip address
+  boost::asio::ip::tcp::resolver::iterator getEndpointIterator();
+
+  /// internal function to disconnect from server
+  void disconnect();
+
+protected:
+  /// host name of server
+  const std::string host;
+
+  // service to connect to to
+  const std::string service;
+
+  // exit flag of this operation
+  enum Exitflag_t Exitflag;
+};
+
+#endif /* FRAGMENTCONTROLLER_OPERATION_HPP_ */
Index: src/Fragmentation/Automation/Controller/FragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/FragmentController.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/FragmentController.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,456 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * FragmentController.cpp
+ *
+ *  Created on: Nov 27, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <boost/bind.hpp>
+#include <boost/foreach.hpp>
+#include <iostream>
+#include <vector>
+#include "Connection.hpp" // Must come before boost/serialization headers.
+#include <boost/serialization/vector.hpp>
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+#include "ControllerChoices.hpp"
+
+#include "Controller/FragmentController.hpp"
+#include "Controller/Commands/Operation.hpp"
+
+/** Constructor of class FragmentController.
+ *
+ * \param io_service io_service for the asynchronous operations
+ * \param _host hostname of server that accepts jobs
+ * \param _service of server
+ */
+FragmentController::FragmentController(
+    boost::asio::io_service& io_service,
+    const std::string& _host,
+    const std::string& _service) :
+    connection_(io_service),
+    host(_host),
+    service(_service),
+    recjobs(connection_, _host, _service),
+    checkres(connection_, _host, _service),
+    sendres(connection_, _host, _service),
+    shutdown(connection_, _host, _service)
+{
+  Info info(__FUNCTION__);
+}
+
+/** Destructor of class FragmentController.
+ *
+ */
+FragmentController::~FragmentController()
+{}
+
+/** Handle connect operation to receive jobs from controller
+ *
+ * \param e error code if something went wrong
+ * \param endpoint_iterator endpoint of the connection
+ */
+void FragmentController::ReceiveJobsOperation::handle_connect_calc(const boost::system::error_code& e,
+    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = ReceiveJobs;
+    connection_.async_write(choice,
+      boost::bind(&FragmentController::ReceiveJobsOperation::handle_SendJobs, this,
+      boost::asio::placeholders::error));
+  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
+    // Try the next endpoint.
+    connection_.socket().close();
+    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+    connection_.socket().async_connect(endpoint,
+      boost::bind(&FragmentController::ReceiveJobsOperation::handle_connect_calc, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+  } else {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
+/** Callback function when an operation has been completed.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::ReceiveJobsOperation::handle_FinishOperation(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+
+  LOG(1, "INFO: Jobs have been sent. Clearing.");
+  jobs.clear();
+
+  Operation::handle_FinishOperation(e);
+}
+
+
+/** Handle connect operation to send number of done jobs.
+ *
+ * \param e error code if something went wrong
+ * \param endpoint_iterator endpoint of the connection
+ */
+void FragmentController::CheckResultsOperation::handle_connect_check(const boost::system::error_code& e,
+    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = CheckState;
+    connection_.async_write(choice,
+      boost::bind(&FragmentController::CheckResultsOperation::handle_ReceiveDoneJobs, this,
+      boost::asio::placeholders::error));
+  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
+    // Try the next endpoint.
+    connection_.socket().close();
+    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+    connection_.socket().async_connect(endpoint,
+      boost::bind(&FragmentController::CheckResultsOperation::handle_connect_check, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+  } else {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
+/** Handle connect operation to send results.
+ *
+ * \param e error code if something went wrong
+ * \param endpoint_iterator endpoint of the connection
+ */
+void FragmentController::SendResultsOperation::handle_connect_get(const boost::system::error_code& e,
+    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = SendResults;
+    connection_.async_write(choice,
+      boost::bind(&FragmentController::SendResultsOperation::handle_ReceivingResults, this,
+      boost::asio::placeholders::error));
+  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
+    // Try the next endpoint.
+    connection_.socket().close();
+    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+    connection_.socket().async_connect(endpoint,
+      boost::bind(&FragmentController::SendResultsOperation::handle_connect_get, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+  } else {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
+/** Handle connect operation to shutdown scheduler.
+ *
+ * \param e error code if something went wrong
+ * \param endpoint_iterator endpoint of the connection
+ */
+void FragmentController::ShutdownOperation::handle_connect_shutdown(const boost::system::error_code& e,
+    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = Shutdown;
+    connection_.async_write(choice,
+      boost::bind(&FragmentController::ShutdownOperation::handle_FinishOperation, this,
+      boost::asio::placeholders::error));
+  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
+    // Try the next endpoint.
+    connection_.socket().close();
+    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+    connection_.socket().async_connect(endpoint,
+      boost::bind(&FragmentController::ShutdownOperation::handle_connect_shutdown, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+  } else {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
+/** Callback function when jobs have been sent.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::ReceiveJobsOperation::handle_SendJobs(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Start operation to read the vector
+    // of jobs. The connection::async_write() function will automatically
+    // encode the data that is written to the underlying socket.
+    LOG(1, "INFO: Sending "+toString(jobs.size())+" jobs ...");
+    connection_.async_write(jobs,
+      boost::bind(&ReceiveJobsOperation::handle_FinishOperation, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+
+  // Since we are not starting a new operation the io_service will run out of
+  // work to do and the client will exit.
+}
+
+/** Callback function when results have been received.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::SendResultsOperation::handle_ReceivingResults(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // The connection::async_read() function will automatically
+    // decode the data that is written to the underlying socket.
+    connection_.async_read(results,
+      boost::bind(&FragmentController::SendResultsOperation::handle_ReceivedResults, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+
+  // Since we are not starting a new operation the io_service will run out of
+  // work to do and the client will exit.
+}
+
+/** Callback function when doneJobs have been received.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::SendResultsOperation::handle_ReceivedResults(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+
+  LOG(1, "INFO: Received "+toString(results.size())+" results ...");
+
+  handle_FinishOperation(e);
+}
+
+/** Callback function when doneJobs have been received.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::CheckResultsOperation::handle_ReceiveDoneJobs(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // The connection::async_read() function will automatically
+    // decode the data that is written to the underlying socket.
+    LOG(1, "INFO: Checking number of done jobs ...");
+    connection_.async_read(doneJobs,
+      boost::bind(&Operation::handle_FinishOperation, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
+/** Internal function to connect to the endpoint of the server asynchronuously.
+ *
+ * We require internal connetion_ and host and service to be set up for this.
+ */
+void FragmentController::ReceiveJobsOperation::connect_calc()
+{
+  Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  std::cout << "Connecting to endpoint " << endpoint << " to calc " << std::endl;
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentController::ReceiveJobsOperation::handle_connect_calc, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+}
+
+/** Internal function to connect to the endpoint of the server asynchronuously.
+ *
+ * We require internal connetion_ and host and service to be set up for this.
+ */
+void FragmentController::CheckResultsOperation::connect_check()
+{
+  Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  std::cout << "Connecting to endpoint " << endpoint << " to check " << std::endl;
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentController::CheckResultsOperation::handle_connect_check, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+}
+
+/** Internal function to connect to the endpoint of the server asynchronuously.
+ *
+ * We require internal connetion_ and host and service to be set up for this.
+ */
+void FragmentController::SendResultsOperation::connect_get()
+{
+  Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  std::cout << "Connecting to endpoint " << endpoint << " to get results " << std::endl;
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentController::SendResultsOperation::handle_connect_get, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+}
+
+/** Internal function to connect to the endpoint of the server asynchronuously.
+ *
+ * We require internal connetion_ and host and service to be set up for this.
+ */
+void FragmentController::ShutdownOperation::connect_shutdown()
+{
+  Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  std::cout << "Connecting to endpoint " << endpoint << " to get results " << std::endl;
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentController::ShutdownOperation::handle_connect_shutdown, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+}
+
+/** Place number of jobs into this controller.
+ *
+ * \param _jobs jobs to add
+ */
+void FragmentController::ReceiveJobsOperation::addJobs(const std::vector<FragmentJob> &_jobs)
+{
+  jobs.reserve(jobs.size()+_jobs.size());
+  BOOST_FOREACH(FragmentJob job, _jobs) {
+    jobs.push_back(job);
+  }
+}
+
+/** Prepares the calculation of the results for the current jobs.
+ */
+void FragmentController::ReceiveJobsOperation::operator()()
+{
+  Info info(__FUNCTION__);
+  // connect
+  connect_calc();
+  //disconnect
+  disconnect();
+}
+
+/** Prepares the calculation of the results for the current jobs.
+ */
+void FragmentController::CheckResultsOperation::operator()()
+{
+  Info info(__FUNCTION__);
+  // connect
+  connect_check();
+  //disconnect
+  disconnect();
+}
+
+/** Getter for results.
+ *
+ * \return vector of results for the added jobs (\sa addJobs()).
+ */
+std::vector<FragmentResult> FragmentController::SendResultsOperation::getResults()
+{
+  Info info(__FUNCTION__);
+  return results;
+}
+
+/** Function to initiate receival of results.
+ *
+ */
+void FragmentController::SendResultsOperation::operator()()
+{
+  // connect
+  connect_get();
+  //disconnect
+  disconnect();
+}
+
+/** Function to initiate shutdown of server.
+ *
+ */
+void FragmentController::ShutdownOperation::operator()()
+{
+  // connect
+  connect_shutdown();
+  //disconnect
+  disconnect();
+}
+
+/** Getter for doneJobs.
+ *
+ * \sa checkResults()
+ * \param doneJobs
+ */
+size_t FragmentController::CheckResultsOperation::getDoneJobs() const
+{
+  return doneJobs;
+}
+
+/** Getter for number of jobs present in the queue.
+ *
+ * \return jobs.size()
+ */
+size_t FragmentController::ReceiveJobsOperation::getPresentJobs() const
+{
+  return jobs.size();
+}
Index: src/Fragmentation/Automation/Controller/FragmentController.hpp
===================================================================
--- src/Fragmentation/Automation/Controller/FragmentController.hpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/FragmentController.hpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,223 @@
+/*
+ * FragmentController.hpp
+ *
+ *  Created on: Nov 27, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTCONTROLLER_HPP_
+#define FRAGMENTCONTROLLER_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/asio.hpp>
+#include <string>
+#include <vector>
+
+#include "Connection.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+#include "Controller/Commands/Operation.hpp"
+
+/** The FragmentController sends bunches of jobs to a FragmentScheduler,
+ *  waits for their calculation and is called when they are done. Then,
+ *  he loads the bunch of results from the Scheduler.
+ *
+ * While the FragmentScheduler and FragmentWorker rather act on their own
+ * this is the piece to implant into the user software to allow for
+ * communication with the Server/Worker duo to perform the calculation
+ * of the fragments on distant computers.
+ */
+class FragmentController
+{
+public:
+  FragmentController(boost::asio::io_service& io_service, const std::string& _host, const std::string& _service);
+  ~FragmentController();
+
+  class ReceiveJobsOperation : public Operation {
+  public:
+    /// Constructor for class ReceiveJobsOperation.
+    ReceiveJobsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
+      Operation(_connection, _host, _service) {}
+    /// Destructor for class ReceiveJobsOperation
+    ~ReceiveJobsOperation() {}
+
+  public:
+    /// Placing receive jobs operations into an io_service
+    virtual void operator()();
+
+    /// Handle completion of a calculate operation.
+    void handle_connect_calc(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);
+
+    /// Handle completion of an operation.
+    void handle_FinishOperation(const boost::system::error_code& e);
+
+    /// internal function to connect to server and send jobs for calculation
+    void connect_calc();
+
+    /// Setter for jobs
+    void addJobs(const std::vector<FragmentJob> &jobs);
+
+    /// Getter for number of size of jobs
+    size_t getPresentJobs() const;
+
+  protected:
+    /// bunch of jobs
+    std::vector<FragmentJob> jobs;
+  };
+
+  struct CheckResultsOperation : public Operation  {
+  public:
+    /// Constructor for class CheckResultsOperation.
+    CheckResultsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
+      Operation(_connection, _host, _service),
+      doneJobs(0)
+    {}
+    /// Destructor for class CheckResultsOperation
+    ~CheckResultsOperation() {}
+
+  public:
+    // placing receive jobs operations into an io_service
+    virtual void operator()();
+
+    /// Handle completion of a CheckResults operation.
+    void handle_connect_check(const boost::system::error_code& e,
+        boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
+    /// Callback function when doneJobs have been received.
+    void handle_ReceiveDoneJobs(const boost::system::error_code& e);
+
+    /// Handle completion of an operation.
+    void handle_FinishOperation(const boost::system::error_code& e);
+
+    /// internal function to connect to server and check done jobs
+    void connect_check();
+
+    /// Getter for doneJobs
+    size_t getDoneJobs() const;
+
+  protected:
+    /// currently calculated results
+    size_t doneJobs;
+  };
+
+  struct SendResultsOperation : public Operation  {
+  public:
+    /// Constructor for class SendResultsOperation.
+    SendResultsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
+      Operation(_connection, _host, _service) {}
+    /// Destructor for class SendResultsOperation
+    ~SendResultsOperation() {}
+
+  public:
+    // placing receive jobs operations into an io_service
+    virtual void operator()();
+
+    /// Handle completion of a GetResults operation.
+    void handle_connect_get(const boost::system::error_code& e,
+        boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
+    /// Callback function when results are about to be received.
+    void handle_ReceivingResults(const boost::system::error_code& e);
+
+    /// Callback function when results have been received.
+    void handle_ReceivedResults(const boost::system::error_code& e);
+
+    /// internal function to connect to server and receive calculated results
+    void connect_get();
+
+    /// Getter for results
+    std::vector<FragmentResult> getResults();
+
+  protected:
+    /// bunch of results
+    std::vector<FragmentResult> results;
+  };
+
+  struct ShutdownOperation : public Operation  {
+  public:
+    /// Constructor for class ShutdownOperation.
+    ShutdownOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
+      Operation(_connection, _host, _service) {}
+    /// Destructor for class ShutdownOperation
+    ~ShutdownOperation() {}
+
+  public:
+    // placing receive jobs operations into an io_service
+    virtual void operator()();
+
+    /// Handle completion of a Shutdown operation.
+    void handle_connect_shutdown(const boost::system::error_code& e,
+        boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
+    /// internal function to connect to server and receive calculated results
+    void connect_shutdown();
+
+  };
+
+protected:
+  /// The Connection to the server.
+  Connection connection_;
+
+public:
+
+  ReceiveJobsOperation recjobs;
+  CheckResultsOperation checkres;
+  SendResultsOperation  sendres;
+  ShutdownOperation shutdown;
+
+  // get the exit flag of the last operations
+  size_t getExitflag() const
+  {
+    if (recjobs.getExitflag() != 0)
+      return recjobs.getExitflag();
+    if (checkres.getExitflag() != 0)
+      return checkres.getExitflag();
+    if (sendres.getExitflag() != 0)
+      return sendres.getExitflag();
+    if (shutdown.getExitflag() != 0)
+      return shutdown.getExitflag();
+    return 0;
+  }
+
+  /// place number of jobs into this controller
+  void addJobs(const std::vector<FragmentJob> &jobs)
+  {
+    recjobs.addJobs(jobs);
+  }
+
+  /// get the results for the current jobs
+  std::vector<FragmentResult> getResults()
+  {
+    return sendres.getResults();
+  }
+
+  /// Getter for doneJobs
+  size_t getDoneJobs() const
+  {
+    return checkres.getDoneJobs();
+  }
+
+  /// Getter for number of jobs in the queue
+  size_t getPresentJobs() const
+  {
+    return recjobs.getPresentJobs();
+  }
+
+private:
+  /// host name of server
+  const std::string host;
+
+  // service to connect to to
+  const std::string service;
+};
+
+#endif /* FRAGMENTCONTROLLER_HPP_ */
Index: src/Fragmentation/Automation/Controller/JobAdder.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/JobAdder.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/JobAdder.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,82 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file JobAdder.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp)
+ *
+ *  Created on: Nov 27, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+#include <vector>
+#include <boost/lexical_cast.hpp>
+
+#include "atexit.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Controller/FragmentController.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+
+int main(int argc, char* argv[])
+{
+  // from this moment on, we need to be sure to deeinitialize in the correct order
+  // this is handled by the cleanup function
+  atexit(cleanUp);
+
+  setVerbosity(3);
+
+  size_t Exitflag = 0;
+  try
+  {
+    // Check command line arguments.
+    if (argc != 4)
+    {
+      std::cerr << "Usage: " << argv[0] << " <host> <port> <number of jobs>" << std::endl;
+      return 1;
+    }
+    const int NoJobs = boost::lexical_cast<int>(argv[3]);
+    boost::asio::io_service io_service;
+    FragmentController controller(io_service, argv[1], argv[2]);
+
+    LOG(1, "INFO: Creating " << NoJobs << " jobs for the server.");
+    std::vector<FragmentJob> jobs;
+    for (JobId_t i = 1; i <= NoJobs; ++i) {
+      FragmentJob testJob(std::string("do something"), i);
+      jobs.push_back(testJob);
+    }
+    controller.addJobs(jobs);
+    controller.recjobs();
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+    Exitflag = controller.getExitflag();
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+
+  return Exitflag;
+}
Index: src/Fragmentation/Automation/Controller/ResultChecker.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/ResultChecker.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/ResultChecker.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,76 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file ResultChecker.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp)
+ *
+ *  Created on: Nov 27, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+#include <vector>
+
+#include "atexit.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Controller/FragmentController.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+
+int main(int argc, char* argv[])
+{
+  // from this moment on, we need to be sure to deeinitialize in the correct order
+  // this is handled by the cleanup function
+  atexit(cleanUp);
+
+  setVerbosity(3);
+
+  size_t Exitflag = 0;
+  try
+  {
+    // Check command line arguments.
+    if (argc != 3)
+    {
+      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
+      return 1;
+    }
+
+    boost::asio::io_service io_service;
+    FragmentController controller(io_service, argv[1], argv[2]);
+
+    controller.checkres();
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+    size_t doneJobs = controller.getDoneJobs();
+    LOG(1, "INFO: " << doneJobs << " jobs are calculated so far.");
+    Exitflag = controller.getExitflag();
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+
+  return Exitflag;
+}
Index: src/Fragmentation/Automation/Controller/ResultGetter.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/ResultGetter.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/ResultGetter.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,86 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file ResultGetter.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp)
+ *
+ *  Created on: Nov 27, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+#include <vector>
+
+#include "atexit.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Controller/FragmentController.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+
+int main(int argc, char* argv[])
+{
+  // from this moment on, we need to be sure to deeinitialize in the correct order
+  // this is handled by the cleanup function
+  atexit(cleanUp);
+
+  setVerbosity(3);
+
+  size_t Exitflag = 0;
+  try
+  {
+    // Check command line arguments.
+    if (argc != 3)
+    {
+      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
+      return 1;
+    }
+
+    boost::asio::io_service io_service;
+    FragmentController controller(io_service, argv[1], argv[2]);
+
+    std::vector<FragmentJob> jobs;
+    {
+      FragmentJob testJob(std::string("do something"), 1);
+      FragmentJob othertestJob(std::string("do something else"), 2);
+      jobs.push_back(testJob);
+      jobs.push_back(othertestJob);
+    }
+
+    controller.sendres();
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+    std::vector<FragmentResult> results = controller.getResults();
+    for (std::vector<FragmentResult>::const_iterator iter = results.begin();
+        iter != results.end(); ++iter)
+      LOG(1, "RESULT: job #"+toString((*iter).getId())+": "+toString((*iter).result));
+    Exitflag = controller.getExitflag();
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+
+  return Exitflag;
+}
Index: src/Fragmentation/Automation/Controller/Shutdowner.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/Shutdowner.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
+++ src/Fragmentation/Automation/Controller/Shutdowner.cpp	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -0,0 +1,74 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file Shutdowner.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp)
+ *
+ *  Created on: Dez 09, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+#include <vector>
+
+#include "atexit.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Controller/FragmentController.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+
+int main(int argc, char* argv[])
+{
+  // from this moment on, we need to be sure to deeinitialize in the correct order
+  // this is handled by the cleanup function
+  atexit(cleanUp);
+
+  setVerbosity(3);
+
+  size_t Exitflag = 0;
+  try
+  {
+    // Check command line arguments.
+    if (argc != 3)
+    {
+      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
+      return 1;
+    }
+
+    boost::asio::io_service io_service;
+    FragmentController controller(io_service, argv[1], argv[2]);
+
+    controller.shutdown();
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+    Exitflag = controller.getExitflag();
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+
+  return Exitflag;
+}
Index: src/Fragmentation/Automation/FragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentController.cpp	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ 	(revision )
@@ -1,517 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * FragmentController.cpp
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
-#include <iostream>
-#include <vector>
-#include "Connection.hpp" // Must come before boost/serialization headers.
-#include <boost/serialization/vector.hpp>
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-#include "ControllerChoices.hpp"
-
-#include "FragmentController.hpp"
-
-/** Constructor of class FragmentController.
- *
- * \param io_service io_service for the asynchronous operations
- * \param _host hostname of server that accepts jobs
- * \param _service of server
- */
-FragmentController::FragmentController(
-    boost::asio::io_service& io_service,
-    const std::string& _host,
-    const std::string& _service) :
-    connection_(io_service),
-    host(_host),
-    service(_service),
-    recjobs(connection_, _host, _service),
-    checkres(connection_, _host, _service),
-    sendres(connection_, _host, _service),
-    shutdown(connection_, _host, _service)
-{
-  Info info(__FUNCTION__);
-}
-
-/** Destructor of class FragmentController.
- *
- */
-FragmentController::~FragmentController()
-{}
-
-/** Constructor for class Operation.
- *
- * \param _connection connection to operate on
- */
-FragmentController::Operation::Operation(Connection &_connection, const std::string& _host, const std::string& _service) :
-    connection_(_connection),
-    host(_host),
-    service(_service),
-    Exitflag(OkFlag)
-{}
-
-/** Destructor for class Operation.
- *
- */
-FragmentController::Operation::~Operation()
-{}
-
-/** Handle connect operation to receive jobs from controller
- *
- * \param e error code if something went wrong
- * \param endpoint_iterator endpoint of the connection
- */
-void FragmentController::ReceiveJobsOperation::handle_connect_calc(const boost::system::error_code& e,
-    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Successfully established connection. Give choice.
-    enum ControllerChoices choice = ReceiveJobs;
-    connection_.async_write(choice,
-      boost::bind(&FragmentController::ReceiveJobsOperation::handle_SendJobs, this,
-      boost::asio::placeholders::error));
-  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
-    // Try the next endpoint.
-    connection_.socket().close();
-    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-    connection_.socket().async_connect(endpoint,
-      boost::bind(&FragmentController::ReceiveJobsOperation::handle_connect_calc, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-  } else {
-    // An error occurred. Log it and return. Since we are not starting a new
-    // operation the io_service will run out of work to do and the client will
-    // exit.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-}
-
-/** Callback function when an operation has been completed.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::ReceiveJobsOperation::handle_FinishOperation(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-
-  LOG(1, "INFO: Jobs have been sent. Clearing.");
-  jobs.clear();
-
-  Operation::handle_FinishOperation(e);
-}
-
-
-/** Handle connect operation to send number of done jobs.
- *
- * \param e error code if something went wrong
- * \param endpoint_iterator endpoint of the connection
- */
-void FragmentController::CheckResultsOperation::handle_connect_check(const boost::system::error_code& e,
-    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Successfully established connection. Give choice.
-    enum ControllerChoices choice = CheckState;
-    connection_.async_write(choice,
-      boost::bind(&FragmentController::CheckResultsOperation::handle_ReceiveDoneJobs, this,
-      boost::asio::placeholders::error));
-  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
-    // Try the next endpoint.
-    connection_.socket().close();
-    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-    connection_.socket().async_connect(endpoint,
-      boost::bind(&FragmentController::CheckResultsOperation::handle_connect_check, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-  } else {
-    // An error occurred. Log it and return. Since we are not starting a new
-    // operation the io_service will run out of work to do and the client will
-    // exit.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-}
-
-/** Handle connect operation to send results.
- *
- * \param e error code if something went wrong
- * \param endpoint_iterator endpoint of the connection
- */
-void FragmentController::SendResultsOperation::handle_connect_get(const boost::system::error_code& e,
-    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Successfully established connection. Give choice.
-    enum ControllerChoices choice = SendResults;
-    connection_.async_write(choice,
-      boost::bind(&FragmentController::SendResultsOperation::handle_ReceivingResults, this,
-      boost::asio::placeholders::error));
-  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
-    // Try the next endpoint.
-    connection_.socket().close();
-    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-    connection_.socket().async_connect(endpoint,
-      boost::bind(&FragmentController::SendResultsOperation::handle_connect_get, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-  } else {
-    // An error occurred. Log it and return. Since we are not starting a new
-    // operation the io_service will run out of work to do and the client will
-    // exit.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-}
-
-/** Handle connect operation to shutdown scheduler.
- *
- * \param e error code if something went wrong
- * \param endpoint_iterator endpoint of the connection
- */
-void FragmentController::ShutdownOperation::handle_connect_shutdown(const boost::system::error_code& e,
-    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Successfully established connection. Give choice.
-    enum ControllerChoices choice = Shutdown;
-    connection_.async_write(choice,
-      boost::bind(&FragmentController::ShutdownOperation::handle_FinishOperation, this,
-      boost::asio::placeholders::error));
-  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
-    // Try the next endpoint.
-    connection_.socket().close();
-    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-    connection_.socket().async_connect(endpoint,
-      boost::bind(&FragmentController::ShutdownOperation::handle_connect_shutdown, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-  } else {
-    // An error occurred. Log it and return. Since we are not starting a new
-    // operation the io_service will run out of work to do and the client will
-    // exit.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-}
-
-/** Callback function when an operation has been completed.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::Operation::handle_FinishOperation(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    LOG(1, "INFO: Operation completed.");
-  }
-  else
-  {
-    // An error occurred.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-
-  // Since we are not starting a new operation the io_service will run out of
-  // work to do and the client will exit.
-}
-
-/** Callback function when jobs have been sent.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::ReceiveJobsOperation::handle_SendJobs(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Successfully established connection. Start operation to read the vector
-    // of jobs. The connection::async_write() function will automatically
-    // encode the data that is written to the underlying socket.
-    LOG(1, "INFO: Sending "+toString(jobs.size())+" jobs ...");
-    connection_.async_write(jobs,
-      boost::bind(&FragmentController::ReceiveJobsOperation::handle_FinishOperation, this,
-      boost::asio::placeholders::error));
-  }
-  else
-  {
-    // An error occurred.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-
-  // Since we are not starting a new operation the io_service will run out of
-  // work to do and the client will exit.
-}
-
-/** Callback function when results have been received.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::SendResultsOperation::handle_ReceivingResults(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // The connection::async_read() function will automatically
-    // decode the data that is written to the underlying socket.
-    connection_.async_read(results,
-      boost::bind(&FragmentController::SendResultsOperation::handle_ReceivedResults, this,
-      boost::asio::placeholders::error));
-  }
-  else
-  {
-    // An error occurred.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-
-  // Since we are not starting a new operation the io_service will run out of
-  // work to do and the client will exit.
-}
-
-/** Callback function when doneJobs have been received.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::SendResultsOperation::handle_ReceivedResults(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-
-  LOG(1, "INFO: Received "+toString(results.size())+" results ...");
-
-  handle_FinishOperation(e);
-}
-
-/** Callback function when doneJobs have been received.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::CheckResultsOperation::handle_ReceiveDoneJobs(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    // The connection::async_read() function will automatically
-    // decode the data that is written to the underlying socket.
-    LOG(1, "INFO: Checking number of done jobs ...");
-    connection_.async_read(doneJobs,
-      boost::bind(&FragmentController::Operation::handle_FinishOperation, this,
-      boost::asio::placeholders::error));
-  }
-  else
-  {
-    // An error occurred.
-    Exitflag = ErrorFlag;
-    ELOG(1, e.message());
-  }
-}
-
-/** Internal function to resolve all possible connection endpoints.
- *
- * \return endpoint iterator of connection
- */
-boost::asio::ip::tcp::resolver::iterator FragmentController::Operation::getEndpointIterator()
-{
-  // Resolve the host name into an IP address.
-  boost::asio::ip::tcp::resolver resolver(connection_.socket().get_io_service());
-  boost::asio::ip::tcp::resolver::query query(host, service);
-  boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
-    resolver.resolve(query);
-
-  return endpoint_iterator;
-}
-
-/** Internal function to connect to the endpoint of the server asynchronuously.
- *
- * We require internal connetion_ and host and service to be set up for this.
- */
-void FragmentController::ReceiveJobsOperation::connect_calc()
-{
-  Info info(__FUNCTION__);
-  // Resolve the host name into an IP address.
-  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
-  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-
-  // Start an asynchronous connect operation.
-  std::cout << "Connecting to endpoint " << endpoint << " to calc " << std::endl;
-  connection_.socket().async_connect(endpoint,
-    boost::bind(&FragmentController::ReceiveJobsOperation::handle_connect_calc, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-}
-
-/** Internal function to connect to the endpoint of the server asynchronuously.
- *
- * We require internal connetion_ and host and service to be set up for this.
- */
-void FragmentController::CheckResultsOperation::connect_check()
-{
-  Info info(__FUNCTION__);
-  // Resolve the host name into an IP address.
-  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
-  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-
-  // Start an asynchronous connect operation.
-  std::cout << "Connecting to endpoint " << endpoint << " to check " << std::endl;
-  connection_.socket().async_connect(endpoint,
-    boost::bind(&FragmentController::CheckResultsOperation::handle_connect_check, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-}
-
-/** Internal function to connect to the endpoint of the server asynchronuously.
- *
- * We require internal connetion_ and host and service to be set up for this.
- */
-void FragmentController::SendResultsOperation::connect_get()
-{
-  Info info(__FUNCTION__);
-  // Resolve the host name into an IP address.
-  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
-  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-
-  // Start an asynchronous connect operation.
-  std::cout << "Connecting to endpoint " << endpoint << " to get results " << std::endl;
-  connection_.socket().async_connect(endpoint,
-    boost::bind(&FragmentController::SendResultsOperation::handle_connect_get, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-}
-
-/** Internal function to connect to the endpoint of the server asynchronuously.
- *
- * We require internal connetion_ and host and service to be set up for this.
- */
-void FragmentController::ShutdownOperation::connect_shutdown()
-{
-  Info info(__FUNCTION__);
-  // Resolve the host name into an IP address.
-  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
-  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-
-  // Start an asynchronous connect operation.
-  std::cout << "Connecting to endpoint " << endpoint << " to get results " << std::endl;
-  connection_.socket().async_connect(endpoint,
-    boost::bind(&FragmentController::ShutdownOperation::handle_connect_shutdown, this,
-      boost::asio::placeholders::error, ++endpoint_iterator));
-}
-
-/** Internal function to disconnect connection_ correctly.
- *
- */
-void FragmentController::Operation::disconnect()
-{
-  //connection_.socket().close();
-}
-
-/** Place number of jobs into this controller.
- *
- * \param _jobs jobs to add
- */
-void FragmentController::ReceiveJobsOperation::addJobs(const std::vector<FragmentJob> &_jobs)
-{
-  jobs.reserve(jobs.size()+_jobs.size());
-  BOOST_FOREACH(FragmentJob job, _jobs) {
-    jobs.push_back(job);
-  }
-}
-
-/** Prepares the calculation of the results for the current jobs.
- */
-void FragmentController::ReceiveJobsOperation::operator()()
-{
-  Info info(__FUNCTION__);
-  // connect
-  connect_calc();
-  //disconnect
-  disconnect();
-}
-
-/** Prepares the calculation of the results for the current jobs.
- */
-void FragmentController::CheckResultsOperation::operator()()
-{
-  Info info(__FUNCTION__);
-  // connect
-  connect_check();
-  //disconnect
-  disconnect();
-}
-
-/** Getter for results.
- *
- * \return vector of results for the added jobs (\sa addJobs()).
- */
-std::vector<FragmentResult> FragmentController::SendResultsOperation::getResults()
-{
-  Info info(__FUNCTION__);
-  return results;
-}
-
-/** Function to initiate receival of results.
- *
- */
-void FragmentController::SendResultsOperation::operator()()
-{
-  // connect
-  connect_get();
-  //disconnect
-  disconnect();
-}
-
-/** Function to initiate shutdown of server.
- *
- */
-void FragmentController::ShutdownOperation::operator()()
-{
-  // connect
-  connect_shutdown();
-  //disconnect
-  disconnect();
-}
-
-/** Getter for doneJobs.
- *
- * \sa checkResults()
- * \param doneJobs
- */
-size_t FragmentController::CheckResultsOperation::getDoneJobs() const
-{
-  return doneJobs;
-}
-
-/** Getter for number of jobs present in the queue.
- *
- * \return jobs.size()
- */
-size_t FragmentController::ReceiveJobsOperation::getPresentJobs() const
-{
-  return jobs.size();
-}
Index: src/Fragmentation/Automation/FragmentController.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentController.hpp	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ 	(revision )
@@ -1,264 +1,0 @@
-/*
- * FragmentController.hpp
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-#ifndef FRAGMENTCONTROLLER_HPP_
-#define FRAGMENTCONTROLLER_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <boost/asio.hpp>
-#include <string>
-#include <vector>
-
-#include "Connection.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-/** The FragmentController sends bunches of jobs to a FragmentScheduler,
- *  waits for their calculation and is called when they are done. Then,
- *  he loads the bunch of results from the Scheduler.
- *
- * While the FragmentScheduler and FragmentWorker rather act on their own
- * this is the piece to implant into the user software to allow for
- * communication with the Server/Worker duo to perform the calculation
- * of the fragments on distant computers.
- */
-class FragmentController
-{
-public:
-  FragmentController(boost::asio::io_service& io_service, const std::string& _host, const std::string& _service);
-  ~FragmentController();
-
-  class Operation {
-  public:
-    Operation(Connection &_connection, const std::string& _host, const std::string& _service);
-    virtual ~Operation();
-  public:
-    /// The Connection to the server.
-    Connection &connection_;
-
-    // virtual function pointer to the operation to do
-    virtual void operator()() = 0;
-
-    /// Handle completion of an operation.
-    void handle_FinishOperation(const boost::system::error_code& e);
-
-    enum Exitflag_t {
-      OkFlag = 0,
-      ErrorFlag = 255
-    };
-
-    // get the exit flag of the last operations
-    size_t getExitflag() const
-    {
-      return Exitflag;
-    }
-
-  protected:
-    /// internal function to resolve host name and ip address
-    boost::asio::ip::tcp::resolver::iterator getEndpointIterator();
-
-    /// internal function to disconnect from server
-    void disconnect();
-
-  protected:
-    /// host name of server
-    const std::string host;
-
-    // service to connect to to
-    const std::string service;
-
-    /// flag of operation to give on program exit
-    enum Exitflag_t Exitflag;
-  };
-
-  class ReceiveJobsOperation : public Operation {
-  public:
-    /// Constructor for class ReceiveJobsOperation.
-    ReceiveJobsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
-      Operation(_connection, _host, _service) {}
-    /// Destructor for class ReceiveJobsOperation
-    ~ReceiveJobsOperation() {}
-
-  public:
-    /// Placing receive jobs operations into an io_service
-    virtual void operator()();
-
-    /// Handle completion of a calculate operation.
-    void handle_connect_calc(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);
-
-    /// Handle completion of an operation.
-    void handle_FinishOperation(const boost::system::error_code& e);
-
-    /// internal function to connect to server and send jobs for calculation
-    void connect_calc();
-
-    /// Setter for jobs
-    void addJobs(const std::vector<FragmentJob> &jobs);
-
-    /// Getter for number of size of jobs
-    size_t getPresentJobs() const;
-
-  protected:
-    /// bunch of jobs
-    std::vector<FragmentJob> jobs;
-  };
-
-  struct CheckResultsOperation : public Operation  {
-  public:
-    /// Constructor for class CheckResultsOperation.
-    CheckResultsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
-      Operation(_connection, _host, _service),
-      doneJobs(0)
-    {}
-    /// Destructor for class CheckResultsOperation
-    ~CheckResultsOperation() {}
-
-  public:
-    // placing receive jobs operations into an io_service
-    virtual void operator()();
-
-    /// Handle completion of a CheckResults operation.
-    void handle_connect_check(const boost::system::error_code& e,
-        boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
-
-    /// Callback function when doneJobs have been received.
-    void handle_ReceiveDoneJobs(const boost::system::error_code& e);
-
-    /// Handle completion of an operation.
-    void handle_FinishOperation(const boost::system::error_code& e);
-
-    /// internal function to connect to server and check done jobs
-    void connect_check();
-
-    /// Getter for doneJobs
-    size_t getDoneJobs() const;
-
-  protected:
-    /// currently calculated results
-    size_t doneJobs;
-  };
-
-  struct SendResultsOperation : public Operation  {
-  public:
-    /// Constructor for class SendResultsOperation.
-    SendResultsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
-      Operation(_connection, _host, _service) {}
-    /// Destructor for class SendResultsOperation
-    ~SendResultsOperation() {}
-
-  public:
-    // placing receive jobs operations into an io_service
-    virtual void operator()();
-
-    /// Handle completion of a GetResults operation.
-    void handle_connect_get(const boost::system::error_code& e,
-        boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
-
-          /// Callback function when results are about to be received.
-          void handle_ReceivingResults(const boost::system::error_code& e);
-
-          /// Callback function when results have been received.
-          void handle_ReceivedResults(const boost::system::error_code& e);
-
-    /// internal function to connect to server and receive calculated results
-    void connect_get();
-
-    /// Getter for results
-    std::vector<FragmentResult> getResults();
-
-  protected:
-    /// bunch of results
-    std::vector<FragmentResult> results;
-  };
-
-  struct ShutdownOperation : public Operation  {
-  public:
-    /// Constructor for class ShutdownOperation.
-    ShutdownOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
-      Operation(_connection, _host, _service) {}
-    /// Destructor for class ShutdownOperation
-    ~ShutdownOperation() {}
-
-  public:
-    // placing receive jobs operations into an io_service
-    virtual void operator()();
-
-    /// Handle completion of a Shutdown operation.
-    void handle_connect_shutdown(const boost::system::error_code& e,
-        boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
-
-    /// internal function to connect to server and receive calculated results
-    void connect_shutdown();
-
-  };
-
-protected:
-  /// The Connection to the server.
-  Connection connection_;
-
-public:
-
-  ReceiveJobsOperation recjobs;
-  CheckResultsOperation checkres;
-  SendResultsOperation  sendres;
-  ShutdownOperation shutdown;
-
-  // get the exit flag of the last operations
-  size_t getExitflag() const
-  {
-    if (recjobs.getExitflag() != 0)
-      return recjobs.getExitflag();
-    if (checkres.getExitflag() != 0)
-      return checkres.getExitflag();
-    if (sendres.getExitflag() != 0)
-      return sendres.getExitflag();
-    if (shutdown.getExitflag() != 0)
-      return shutdown.getExitflag();
-    return 0;
-  }
-
-  /// place number of jobs into this controller
-  void addJobs(const std::vector<FragmentJob> &jobs)
-  {
-    recjobs.addJobs(jobs);
-  }
-
-  /// get the results for the current jobs
-  std::vector<FragmentResult> getResults()
-  {
-    return sendres.getResults();
-  }
-
-  /// Getter for doneJobs
-  size_t getDoneJobs() const
-  {
-    return checkres.getDoneJobs();
-  }
-
-  /// Getter for number of jobs in the queue
-  size_t getPresentJobs() const
-  {
-    return recjobs.getPresentJobs();
-  }
-
-private:
-  /// host name of server
-  const std::string host;
-
-  // service to connect to to
-  const std::string service;
-};
-
-#endif /* FRAGMENTCONTROLLER_HPP_ */
Index: src/Fragmentation/Automation/JobAdder.cpp
===================================================================
--- src/Fragmentation/Automation/JobAdder.cpp	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file JobAdder.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-#include <boost/lexical_cast.hpp>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 4)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port> <number of jobs>" << std::endl;
-      return 1;
-    }
-    const int NoJobs = boost::lexical_cast<int>(argv[3]);
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service, argv[1], argv[2]);
-
-    LOG(1, "INFO: Creating " << NoJobs << " jobs for the server.");
-    std::vector<FragmentJob> jobs;
-    for (JobId_t i = 1; i <= NoJobs; ++i) {
-      FragmentJob testJob(std::string("do something"), i);
-      jobs.push_back(testJob);
-    }
-    controller.addJobs(jobs);
-    controller.recjobs();
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/Makefile.am
===================================================================
--- src/Fragmentation/Automation/Makefile.am	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ src/Fragmentation/Automation/Makefile.am	(revision 73d6fce636ade8bb851250adf52ad79adf5225a2)
@@ -31,5 +31,6 @@
 FRAGMENTATIONAUTOMATIONSOURCE = \
   atexit.cpp \
-  FragmentController.cpp
+  Controller/FragmentController.cpp \
+  Controller/Commands/Operation.cpp
 
 FRAGMENTATIONAUTOMATIONHEADER = \
@@ -37,5 +38,6 @@
   Connection.hpp \
   ControllerChoices.hpp \
-  FragmentController.hpp
+  Controller/FragmentController.hpp \
+  Controller/Commands/Operation.hpp
 
 noinst_LTLIBRARIES += libMolecuilderFragmentationAutomation.la
@@ -72,5 +74,5 @@
   FragmentWorker.hpp
 
-JobAdder_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) JobAdder.cpp
+JobAdder_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/JobAdder.cpp
 JobAdder_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
 JobAdder_CXXFLAGS = $(AM_CPPFLAGS)
@@ -84,5 +86,5 @@
   ${CodePatterns_LIBS}
 
-ResultChecker_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) ResultChecker.cpp
+ResultChecker_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/ResultChecker.cpp
 ResultChecker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
 ResultChecker_CXXFLAGS = $(AM_CPPFLAGS)
@@ -96,5 +98,5 @@
   ${CodePatterns_LIBS}
 
-ResultGetter_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) ResultGetter.cpp
+ResultGetter_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/ResultGetter.cpp
 ResultGetter_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
 ResultGetter_CXXFLAGS = $(AM_CPPFLAGS)
@@ -120,5 +122,5 @@
   ${CodePatterns_LIBS}
 
-Shutdowner_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Shutdowner.cpp
+Shutdowner_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/Shutdowner.cpp
 Shutdowner_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
 Shutdowner_CXXFLAGS = $(AM_CPPFLAGS)
Index: src/Fragmentation/Automation/ResultChecker.cpp
===================================================================
--- src/Fragmentation/Automation/ResultChecker.cpp	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file ResultChecker.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service, argv[1], argv[2]);
-
-    controller.checkres();
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    size_t doneJobs = controller.getDoneJobs();
-    LOG(1, "INFO: " << doneJobs << " jobs are calculated so far.");
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/ResultGetter.cpp
===================================================================
--- src/Fragmentation/Automation/ResultGetter.cpp	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file ResultGetter.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service, argv[1], argv[2]);
-
-    std::vector<FragmentJob> jobs;
-    {
-      FragmentJob testJob(std::string("do something"), 1);
-      FragmentJob othertestJob(std::string("do something else"), 2);
-      jobs.push_back(testJob);
-      jobs.push_back(othertestJob);
-    }
-
-    controller.sendres();
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    std::vector<FragmentResult> results = controller.getResults();
-    for (std::vector<FragmentResult>::const_iterator iter = results.begin();
-        iter != results.end(); ++iter)
-      LOG(1, "RESULT: job #"+toString((*iter).getId())+": "+toString((*iter).result));
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/Shutdowner.cpp
===================================================================
--- src/Fragmentation/Automation/Shutdowner.cpp	(revision 1dc209b83f84861106021c6a70d51182a306d7fc)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file Shutdowner.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Dez 09, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service, argv[1], argv[2]);
-
-    controller.shutdown();
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
