Ignore:
Timestamp:
May 17, 2012, 3:21:15 PM (13 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
167b63
Parents:
1dc209
git-author:
Frederik Heber <heber@…> (12/11/11 16:00:42)
git-committer:
Frederik Heber <heber@…> (05/17/12 15:21:15)
Message:

Shifted all Controller stuff into own subfolder, extract class Operation.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/Controller/FragmentController.cpp

    r1dc209 r73d6fc  
    3535#include "ControllerChoices.hpp"
    3636
    37 #include "FragmentController.hpp"
     37#include "Controller/FragmentController.hpp"
     38#include "Controller/Commands/Operation.hpp"
    3839
    3940/** Constructor of class FragmentController.
     
    6465{}
    6566
    66 /** Constructor for class Operation.
    67  *
    68  * \param _connection connection to operate on
    69  */
    70 FragmentController::Operation::Operation(Connection &_connection, const std::string& _host, const std::string& _service) :
    71     connection_(_connection),
    72     host(_host),
    73     service(_service),
    74     Exitflag(OkFlag)
    75 {}
    76 
    77 /** Destructor for class Operation.
    78  *
    79  */
    80 FragmentController::Operation::~Operation()
    81 {}
    82 
    8367/** Handle connect operation to receive jobs from controller
    8468 *
     
    224208}
    225209
    226 /** Callback function when an operation has been completed.
    227  *
    228  * \param e error code if something went wrong
    229  */
    230 void FragmentController::Operation::handle_FinishOperation(const boost::system::error_code& e)
    231 {
    232   Info info(__FUNCTION__);
    233   if (!e)
    234   {
    235     LOG(1, "INFO: Operation completed.");
    236   }
    237   else
    238   {
    239     // An error occurred.
    240     Exitflag = ErrorFlag;
    241     ELOG(1, e.message());
    242   }
    243 
    244   // Since we are not starting a new operation the io_service will run out of
    245   // work to do and the client will exit.
    246 }
    247 
    248210/** Callback function when jobs have been sent.
    249211 *
     
    260222    LOG(1, "INFO: Sending "+toString(jobs.size())+" jobs ...");
    261223    connection_.async_write(jobs,
    262       boost::bind(&FragmentController::ReceiveJobsOperation::handle_FinishOperation, this,
     224      boost::bind(&ReceiveJobsOperation::handle_FinishOperation, this,
    263225      boost::asio::placeholders::error));
    264226  }
     
    326288    LOG(1, "INFO: Checking number of done jobs ...");
    327289    connection_.async_read(doneJobs,
    328       boost::bind(&FragmentController::Operation::handle_FinishOperation, this,
     290      boost::bind(&Operation::handle_FinishOperation, this,
    329291      boost::asio::placeholders::error));
    330292  }
     
    335297    ELOG(1, e.message());
    336298  }
    337 }
    338 
    339 /** Internal function to resolve all possible connection endpoints.
    340  *
    341  * \return endpoint iterator of connection
    342  */
    343 boost::asio::ip::tcp::resolver::iterator FragmentController::Operation::getEndpointIterator()
    344 {
    345   // Resolve the host name into an IP address.
    346   boost::asio::ip::tcp::resolver resolver(connection_.socket().get_io_service());
    347   boost::asio::ip::tcp::resolver::query query(host, service);
    348   boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
    349     resolver.resolve(query);
    350 
    351   return endpoint_iterator;
    352299}
    353300
     
    424371}
    425372
    426 /** Internal function to disconnect connection_ correctly.
    427  *
    428  */
    429 void FragmentController::Operation::disconnect()
    430 {
    431   //connection_.socket().close();
    432 }
    433 
    434373/** Place number of jobs into this controller.
    435374 *
Note: See TracChangeset for help on using the changeset viewer.