- Timestamp:
- Jun 29, 2012, 8:01:46 AM (13 years ago)
- 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:
- a8f54b6
- Parents:
- 7dd8bc
- git-author:
- Frederik Heber <heber@…> (03/04/12 15:59:32)
- git-committer:
- Frederik Heber <heber@…> (06/29/12 08:01:46)
- Location:
- src/Fragmentation/Automation
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Automation/Controller/CommandRegistry.cpp
r7dd8bc r701bbc 34 34 {} 35 35 36 CONSTRUCT_REGISTRY( AsyncOperation)36 CONSTRUCT_REGISTRY(Operation) -
src/Fragmentation/Automation/Controller/CommandRegistry.hpp
r7dd8bc r701bbc 14 14 #endif 15 15 16 #include "Controller/Commands/ AsyncOperation.hpp"16 #include "Controller/Commands/Operation.hpp" 17 17 #include "CodePatterns/Registry.hpp" 18 18 19 class CommandRegistry : public Registry< AsyncOperation>19 class CommandRegistry : public Registry<Operation> 20 20 { 21 21 public: -
src/Fragmentation/Automation/Controller/Commands/AsyncOperation.cpp
r7dd8bc r701bbc 31 31 32 32 #include "Controller/Commands/AsyncOperation.hpp" 33 34 35 /** Constructor for class AsyncOperation.36 *37 * \param _name name for this Operation for retrieval from a registry38 * \param _connection connection to operate on39 */40 AsyncOperation::AsyncOperation(const std::string &_name, Connection &_connection) :41 connection_(_connection),42 name(_name),43 Exitflag(OkFlag)44 {}45 46 /** Destructor for class AsyncOperation.47 *48 */49 AsyncOperation::~AsyncOperation()50 {}51 33 52 34 /** Callback function when an operation has been completed. … … 97 79 boost::asio::placeholders::error, ++endpoint_iterator)); 98 80 } 81 -
src/Fragmentation/Automation/Controller/Commands/AsyncOperation.hpp
r7dd8bc r701bbc 18 18 #include <vector> 19 19 20 #include " Connection.hpp"20 #include "Operation.hpp" 21 21 22 class AsyncOperation {22 class AsyncOperation : public Operation { 23 23 public: 24 AsyncOperation(const std::string &_name, Connection &_connection); 25 virtual ~AsyncOperation(); 24 /** Constructor for class AsyncOperation. 25 * 26 * \param _name name for this AsyncOperation for retrieval from a registry 27 * \param _connection connection to operate on 28 */ 29 AsyncOperation(const std::string &_name, Connection &_connection) : 30 Operation(_name, _connection) 31 {} 32 33 /** Destructor for class AsyncOperation. 34 * 35 */ 36 virtual ~AsyncOperation() 37 {} 38 26 39 public: 27 /// The Connection to the server.28 Connection &connection_;29 30 40 // virtual function pointer to the operation to do 31 41 void operator()(const std::string& _host, const std::string& _service); 32 42 43 protected: 33 44 // virtual function pointer to the connection handler 34 45 virtual void handle_connect(const boost::system::error_code& e, … … 38 49 void handle_FinishOperation(const boost::system::error_code& e); 39 50 40 enum Exitflag_t {41 OkFlag = 0,42 ErrorFlag = 25543 };44 45 /** Getter for Exitflag.46 *47 * @return Exitflag48 */49 size_t getExitflag() const50 {51 return Exitflag;52 }53 54 std::string getName() const {55 return name;56 }57 58 private:59 /// Name of this Operation (required for Registry pattern)60 std::string name;61 62 51 protected: 63 52 /// internal function to disconnect from server 64 53 void disconnect(); 65 66 // exit flag of this operation67 enum Exitflag_t Exitflag;68 54 }; 69 55 -
src/Fragmentation/Automation/Controller/Commands/ShutdownOperation.cpp
r7dd8bc r701bbc 27 27 #include "Connection.hpp" // Must come before boost/serialization headers. 28 28 #include "CodePatterns/Info.hpp" 29 #include "CodePatterns/Log.hpp"30 29 #include "ControllerChoices.hpp" 31 30 32 31 #include "Controller/Commands/ShutdownOperation.hpp" 33 32 34 /** Handle connect operation to shutdown scheduler.33 /** Virtual internal function to give shutdown choice. 35 34 * 36 * \param e error code if something went wrong37 * \param endpoint_iterator endpoint of the connection38 35 */ 39 void ShutdownOperation::handle_connect(const boost::system::error_code& e, 40 boost::asio::ip::tcp::resolver::iterator endpoint_iterator) 36 void ShutdownOperation::internal() 41 37 { 42 38 Info info(__FUNCTION__); 43 if (!e) 44 { 45 // Successfully established connection. Give choice. 46 enum ControllerChoices choice = ShutdownControllerSocket; 47 connection_.async_write(choice, 48 boost::bind(&ShutdownOperation::handle_FinishOperation, this, 49 boost::asio::placeholders::error)); 50 } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) { 51 // Try the next endpoint. 52 connection_.socket().close(); 53 boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; 54 connection_.socket().async_connect(endpoint, 55 boost::bind(&ShutdownOperation::handle_connect, this, 56 boost::asio::placeholders::error, ++endpoint_iterator)); 57 } else { 58 // An error occurred. Log it and return. Since we are not starting a new 59 // operation the io_service will run out of work to do and the client will 60 // exit. 61 Exitflag = ErrorFlag; 62 ELOG(1, e.message()); 63 } 39 enum ControllerChoices choice = ShutdownControllerSocket; 40 connection_.sync_write(choice); 64 41 } 42 -
src/Fragmentation/Automation/Controller/Commands/ShutdownOperation.hpp
r7dd8bc r701bbc 20 20 #include "Connection.hpp" 21 21 22 #include "Controller/Commands/ AsyncOperation.hpp"22 #include "Controller/Commands/SyncOperation.hpp" 23 23 24 class ShutdownOperation : public AsyncOperation { 24 /** Synchronous operation that gives shutdown command. 25 * 26 */ 27 class ShutdownOperation : public SyncOperation { 25 28 public: 26 29 /// Constructor for class ShutdownOperation. 27 30 ShutdownOperation(Connection &_connection) : 28 AsyncOperation(std::string("shutdown"),_connection) {}31 SyncOperation(std::string("shutdown"),_connection) {} 29 32 /// Destructor for class ShutdownOperation 30 33 ~ShutdownOperation() {} 31 34 32 35 public: 33 // virtual function pointer to the connection handler 34 virtual void handle_connect(const boost::system::error_code& e, 35 boost::asio::ip::tcp::resolver::iterator endpoint_iterator); 36 // function that implements read&writes in between connect/disconnect 37 virtual void internal(); 36 38 }; 37 39 -
src/Fragmentation/Automation/Makefile.am
r7dd8bc r701bbc 52 52 Controller/Commands/SendResultsOperation.cpp \ 53 53 Controller/Commands/ShutdownOperation.cpp \ 54 Controller/Commands/SubmitResultOperation.cpp 54 Controller/Commands/SubmitResultOperation.cpp \ 55 Controller/Commands/SyncOperation.cpp 55 56 56 57 FRAGMENTATIONCOMMANDSHEADER = \ … … 61 62 Controller/Commands/GetNextJobIdOperation.hpp \ 62 63 Controller/Commands/ObtainJobOperation.hpp \ 64 Controller/Commands/Operation.hpp \ 63 65 Controller/Commands/ReceiveJobsOperation.hpp \ 64 66 Controller/Commands/SendJobToWorkerOperation.hpp \ 65 67 Controller/Commands/SendResultsOperation.hpp \ 66 68 Controller/Commands/ShutdownOperation.hpp \ 67 Controller/Commands/SubmitResultOperation.hpp 69 Controller/Commands/SubmitResultOperation.hpp \ 70 Controller/Commands/SyncOperation.hpp 68 71 69 72 noinst_LTLIBRARIES += libMolecuilderFragmentationCommands.la
Note:
See TracChangeset
for help on using the changeset viewer.