- Timestamp:
- May 4, 2012, 2:17:20 PM (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:
- 926a49
- Parents:
- c6bcd0
- git-author:
- Frederik Heber <heber@…> (11/18/11 20:29:36)
- git-committer:
- Frederik Heber <heber@…> (05/04/12 14:17:20)
- Location:
- src/Fragmentation/Automation
- Files:
-
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Automation/Connection.hpp
rc6bcd0 raf3aed 1 // 2 // connection.hpp 3 // ~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 // 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 // 1 /* 2 * Connection.hpp 3 * 4 * Created on: Oct 21, 2011 5 * Author: heber 6 */ 10 7 11 #ifndef SERIALIZATION_CONNECTION_HPP 12 #define SERIALIZATION_CONNECTION_HPP 8 #ifndef CONNECTION_HPP_ 9 #define CONNECTION_HPP_ 10 11 // include config.h 12 #ifdef HAVE_CONFIG_H 13 #include <config.h> 14 #endif 15 16 #include <boost/archive/text_iarchive.hpp> 17 #include <boost/archive/text_oarchive.hpp> 13 18 14 19 #include <boost/asio.hpp> 15 #include <boost/archive/text_iarchive.hpp>16 #include <boost/archive/text_oarchive.hpp>17 20 #include <boost/bind.hpp> 18 21 #include <boost/shared_ptr.hpp> … … 23 26 #include <vector> 24 27 25 /// The connection class provides serialization primitives on top of a socket. 26 /** 28 /** The Connection class provides serialization primitives on top of a socket. 27 29 * Each message sent using this class consists of: 28 30 * @li An 8-byte header containing the length of the serialized data in … … 30 32 * @li The serialized data. 31 33 */ 32 class connection34 class Connection 33 35 { 34 36 public: 35 37 /// Constructor. 36 connection(boost::asio::io_service& io_service)38 Connection(boost::asio::io_service& io_service) 37 39 : socket_(io_service) 38 40 { 39 41 } 40 42 41 /// Get the underlying socket. Used for making a connection or for accepting42 /// an incoming connection.43 /// Get the underlying socket. Used for making a Connection or for accepting 44 /// an incoming Connection. 43 45 boost::asio::ip::tcp::socket& socket() 44 46 { … … 82 84 { 83 85 // Issue a read operation to read exactly the number of bytes in a header. 84 void ( connection::*f)(86 void (Connection::*f)( 85 87 const boost::system::error_code&, 86 88 T&, boost::tuple<Handler>) 87 = & connection::handle_read_header<T, Handler>;89 = &Connection::handle_read_header<T, Handler>; 88 90 boost::asio::async_read(socket_, boost::asio::buffer(inbound_header_), 89 91 boost::bind(f, … … 118 120 // Start an asynchronous call to receive the data. 119 121 inbound_data_.resize(inbound_data_size); 120 void ( connection::*f)(122 void (Connection::*f)( 121 123 const boost::system::error_code&, 122 124 T&, boost::tuple<Handler>) 123 = & connection::handle_read_data<T, Handler>;125 = &Connection::handle_read_data<T, Handler>; 124 126 boost::asio::async_read(socket_, boost::asio::buffer(inbound_data_), 125 127 boost::bind(f, this, … … 180 182 }; 181 183 182 typedef boost::shared_ptr< connection> connection_ptr;184 typedef boost::shared_ptr<Connection> connection_ptr; 183 185 184 #endif / / SERIALIZATION_CONNECTION_HPP186 #endif /* CONNECTION_HPP_ */ -
src/Fragmentation/Automation/Makefile.am
rc6bcd0 raf3aed 13 13 14 14 servers11n_SOURCES = \ 15 connection.hpp \15 Connection.hpp \ 16 16 server.cpp \ 17 17 FragmentJob.cpp \ … … 30 30 clients11n_SOURCES = \ 31 31 client.cpp \ 32 connection.hpp \32 Connection.hpp \ 33 33 FragmentJob.cpp \ 34 34 FragmentJob.hpp \ -
src/Fragmentation/Automation/StockClient.cpp
rc6bcd0 raf3aed 19 19 #include <iostream> 20 20 #include <vector> 21 #include " connection.hpp" // Must come before boost/serialization headers.21 #include "Connection.hpp" // Must come before boost/serialization headers. 22 22 #include <boost/serialization/vector.hpp> 23 #include "CodePatterns/Info.hpp" 23 24 #include "FragmentJob.hpp" 24 25 #include "StockClient.hpp" … … 31 32 connection_(io_service) 32 33 { 34 Info info(__FUNCTION__); 33 35 // Resolve the host name into an IP address. 34 36 boost::asio::ip::tcp::resolver resolver(io_service); … … 47 49 void StockClient::handle_connect(const boost::system::error_code& e) 48 50 { 51 Info info(__FUNCTION__); 49 52 if (!e) 50 53 { … … 68 71 void StockClient::handle_read(const boost::system::error_code& e) 69 72 { 73 Info info(__FUNCTION__); 70 74 if (!e) 71 75 { -
src/Fragmentation/Automation/StockClient.hpp
rc6bcd0 raf3aed 17 17 #include <boost/asio.hpp> 18 18 #include <vector> 19 #include " connection.hpp" // Must come before boost/serialization headers.19 #include "Connection.hpp" // Must come before boost/serialization headers. 20 20 #include "FragmentJob.hpp" 21 21 … … 36 36 private: 37 37 /// The connection to the server. 38 connection connection_;38 Connection connection_; 39 39 40 40 /// The data received from the server. -
src/Fragmentation/Automation/StockServer.cpp
rc6bcd0 raf3aed 20 20 #include <iostream> 21 21 #include <vector> 22 #include " connection.hpp" // Must come before boost/serialization headers.22 #include "Connection.hpp" // Must come before boost/serialization headers. 23 23 #include <boost/serialization/vector.hpp> 24 #include "CodePatterns/Info.hpp" 24 25 #include "FragmentJob.hpp" 25 26 … … 31 32 ) 32 33 { 34 Info info(__FUNCTION__); 33 35 FragmentJob s(std::string("test"), 1); 34 36 jobs_.push_back(s); 35 37 36 38 // Start an accept operation for a new connection. 37 connection_ptr new_conn(new connection(acceptor_.get_io_service()));39 connection_ptr new_conn(new Connection(acceptor_.get_io_service())); 38 40 acceptor_.async_accept(new_conn->socket(), 39 41 boost::bind(&StockServer::handle_accept, this, … … 43 45 void StockServer::handle_accept(const boost::system::error_code& e, connection_ptr conn) 44 46 { 47 Info info(__FUNCTION__); 45 48 std::cout << "handle_accept called." << std::endl; 46 49 if (!e) … … 54 57 } 55 58 56 connection_ptr new_conn(new connection(acceptor_.get_io_service()));59 connection_ptr new_conn(new Connection(acceptor_.get_io_service())); 57 60 acceptor_.async_accept(new_conn->socket(), 58 61 boost::bind(&StockServer::handle_accept, this, … … 62 65 void StockServer::handle_write(const boost::system::error_code& e, connection_ptr conn) 63 66 { 67 Info info(__FUNCTION__); 64 68 // Nothing to do. The socket will be closed automatically when the last 65 69 // reference to the connection object goes away. -
src/Fragmentation/Automation/StockServer.hpp
rc6bcd0 raf3aed 17 17 #include <boost/asio.hpp> 18 18 #include <vector> 19 #include " connection.hpp" // Must come before boost/serialization headers.19 #include "Connection.hpp" // Must come before boost/serialization headers. 20 20 #include "FragmentJob.hpp" 21 21
Note:
See TracChangeset
for help on using the changeset viewer.