OnixS C++ CME MDP Premium Market Data Handler  5.8.9
API Documentation
FeedConnection.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <string>
24 #include <vector>
25 
26 #include <OnixS/CME/MDH/Integral.h>
27 
29 
30 /// List of network interfaces.
31 typedef std::vector<std::string> NifList;
32 
33 /// Deserializes semicolon or comma-delimited
34 /// list of hosts and/or network interface names.
36 void fromStr(NifList&, const std::string&, const std::string& = std::string("; ,"));
37 
38 /// Network feed connection attributes.
40 {
41 public:
42  /// Initializes blank instance.
44  : port_(0)
45  , address_()
46  , nifs_()
47  {
48  }
49 
50  /// Initializes connection information
51  /// using its primary attributes.
52  NetFeedConnection(const std::string& address, UInt32 port)
53  : port_(port)
54  , address_(address)
55  , nifs_()
56  {
57  }
58 
59  /// Cleans everything up.
61 
62  /// Identifies connection port.
63  UInt32 port() const
64  {
65  return port_;
66  }
67 
68  /// Updates connection port.
69  void port(UInt32 port)
70  {
71  port_ = port;
72  }
73 
74  /// Identifies connection address.
75  const std::string& address() const
76  {
77  return address_;
78  }
79 
80  /// Updates connection address.
81  void address(const std::string& address)
82  {
83  address_ = address;
84  }
85 
86  /// List of network interfaces on which
87  /// connection is to be binded (if binding
88  /// to network interfaces is applicable).
90  {
91  return nifs_;
92  }
93 
94  /// List of network interfaces on which
95  /// connection is to be binded (if binding
96  /// to network interfaces is applicable).
97  const NifList& nifs() const
98  {
99  return nifs_;
100  }
101 
102 private:
103  UInt32 port_;
104 
105  std::string address_;
106 
107  NifList nifs_;
108 };
109 
110 /// Serializes feed connection attributes to a given string.
112 void toStr(std::string&, const NetFeedConnection&);
113 
114 /// Serializes feed connection attributes to a given string.
115 inline std::string toStr(const NetFeedConnection& connection)
116 {
117  std::string str;
118 
119  toStr(str, connection);
120 
121  return str;
122 }
123 
124 /// Establishes the order between two connections.
126 {
127  /// Establishes the order between two connections.
128  bool operator()(const NetFeedConnection&, const NetFeedConnection&) const;
129 };
130 
std::vector< std::string > NifList
List of network interfaces.
const std::string & address() const
Identifies connection address.
Network feed connection attributes.
UInt32 UInt32
uInt32.
Definition: Fields.h:192
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
~NetFeedConnection()
Cleans everything up.
NetFeedConnection()
Initializes blank instance.
const NifList & nifs() const
List of network interfaces on which connection is to be binded (if binding to network interfaces is a...
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
void port(UInt32 port)
Updates connection port.
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:160
UInt32 port() const
Identifies connection port.
void address(const std::string &address)
Updates connection address.
NifList & nifs()
List of network interfaces on which connection is to be binded (if binding to network interfaces is a...
NetFeedConnection(const std::string &address, UInt32 port)
Initializes connection information using its primary attributes.
Establishes the order between two connections.
std::string toStr(const NetFeedConnection &connection)
Serializes feed connection attributes to a given string.
void fromStr(NifList &, const std::string &, const std::string &=std::string("; ,"))
Deserializes semicolon or comma-delimited list of hosts and/or network interface names.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68