/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * FragmentJob.cpp * * Created on: Oct 19, 2011 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif // boost asio needs specific operator new #include #include #include "CodePatterns/MemDebug.hpp" #include "CodePatterns/Info.hpp" #include "CodePatterns/Log.hpp" #include "CodePatterns/toString.hpp" #include "FragmentJob.hpp" #include "FragmentResult.hpp" /** Constructor for class FragmentJob. * */ FragmentJob::FragmentJob() : JobId(-1), outputfile("") {} /** Constructor for class FragmentJob. * * \param _outputfile configuration file for solver * \param _JobId unique id of this job */ FragmentJob::FragmentJob(const std::string &_outputfile, const JobId_t _JobId) : JobId(_JobId), outputfile(_outputfile) {} /** Destructor for class FragmentJob. * */ FragmentJob::~FragmentJob() {} /** Work routine of this FragmentJob. * * This function encapsulates all the work that has to be done to generate * a FragmentResult. Hence, the FragmentWorker does not need to know anything * about the operation: it just receives it and executes this function. * * \return result of this job */ FragmentResult FragmentJob::Work() { Info info((std::string(__FUNCTION__)+std::string(", id #")+toString(getId())).c_str()); FragmentResult s(getId()); boost::asio::io_service io; boost::asio::deadline_timer t(io, boost::posix_time::seconds(1)); LOG(1, "INFO: Deadline timer will now wait for 1 seconds."); t.wait(); LOG(1, "INFO: Deadline timer is done."); return s; } /** Comparator for class FragmentJob. * \param other instance to compare to * \return every member variable is the same, else - is not */ bool FragmentJob::operator==(const FragmentJob &other) const { return (outputfile == other.outputfile) && (getId() == other.getId()); }