libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
exchange_connection_impl.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright © 2016 by J.M.McGuiness, isimud@hussar.me.uk
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Lesser General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2.1 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public
15 ** License along with this library; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
19 namespace isimud { namespace ISIMUD_VER_NAMESPACE { namespace exchanges { namespace common {
20 
21 template<class ClientCxn, class EchgCxn>
22 template<class LatencyTimestamps>
23 inline
24 exchange_connection<ClientCxn, EchgCxn>::exchange_connection(typename client_link_t::ctor_args const &client_cxn_details, typename exchg_link_t::ctor_args const &exchange_cxn_details, socket_priority to_exchg_priority, socket_priority to_client_priority, exchg_to_client_proc_rules_t const &proc_rules, LatencyTimestamps &timestamps, char const *svr_name)
33  timestamps,
34  svr_name,
37  }
38  ) {
39 }
40 
41 template<class ClientCxn, class EchgCxn> inline
42 exchange_connection<ClientCxn, EchgCxn>::~exchange_connection() noexcept(false) {
43  exit_=true;
44 }
45 
46 template<class ClientCxn, class EchgCxn> inline bool
47 exchange_connection<ClientCxn, EchgCxn>::is_logged_on() const noexcept(true) {
48  return exchg_link_.is_logged_on();
49 }
50 
51 template<class ClientCxn, class EchgCxn> inline std::sig_atomic_t
52 exchange_connection<ClientCxn, EchgCxn>::signal_status() const noexcept(true) {
53  return client_link.signal_status();
54 }
55 
56 template<class ClientCxn, class EchgCxn> inline std::string
57 exchange_connection<ClientCxn, EchgCxn>::to_string() const noexcept(false) {
58  std::ostringstream ss;
59  ss
60  <<thread_traits::demangle_name(typeid(*this))
61  <<",\nexit="<<static_cast<bool>(exit_)
62  <<". "<<mic_codes::to_string()
63  <<" "<<ccy_codes::to_string()
64  <<" "<<ctry_codes::to_string()
65  <<" Client link: "<<client_link
66  <<", client-to-exchange core: "<<common::thread_traits::client_to_exchange_thread
67  <<", exchange links: "<<exchg_link_;
68  return ss.str();
69 }
70 
71 template<class ClientCxn, class EchgCxn> inline std::ostream &
72 operator<<(std::ostream &os, exchange_connection<ClientCxn, EchgCxn> const &ec) noexcept(false) {
73  os<<ec.to_string();
74  return os;
75 }
76 
77 } } } }