OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
TcpRecovery.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 <stdexcept>
25
29
30
32
34inline
35void
37{
38 throw std::runtime_error
39 (
40 "Maximal number of TCP Recovery requests "
41 "per second must be greater than zero. "
42 );
43}
44
48{
49 std::string username_;
50 std::string password_;
51
52 UInt32 acquisitionTimeout_;
53
54 UInt32 maxRequests_;
55
56 WatchService* watch_;
57
58public:
61 : username_()
62 , password_()
63 , acquisitionTimeout_(500)
64 , maxRequests_(15)
65 , watch_(&UtcWatch::service())
66 {
67 }
68
73
76 const
77 std::string&
78 username() const
79 {
80 return username_;
81 }
82
85 void
87 const std::string& username)
88 {
89 username_ = username;
90 }
91
94 const
95 std::string&
96 password() const
97 {
98 return password_;
99 }
100
103 void
105 const std::string& password)
106 {
107 password_ = password;
108 }
109
121 UInt32
123 {
124 return acquisitionTimeout_;
125 }
126
139 void
142 {
143 acquisitionTimeout_ =
145 }
146
152 {
153 return maxRequests_;
154 }
155
160 void
163 {
164 if (0 < maxRequests)
165 {
166 maxRequests_ = maxRequests;
167 }
168 else
169 {
171 }
172 }
173
181 {
182 return *watch_;
183 }
184
188 void
191 {
192 watch_ = &watch;
193 }
194};
195
197ONIXS_CONFLATEDUDP_EXPORTED
198void
200 std::string&,
201 const
203
205inline
206std::string
208 const
209 TcpRecoverySettings& settings)
210{
211 std::string str;
212
213 toStr(str, settings);
214
215 return str;
216}
217
218// A bit of declarations.
220(
221 Handler
222);
223
226TcpRecoveryService
227{
228 class Details;
229
230 // Shared details.
231 Details* details_;
232
233 // Copying is not assumed.
234
235 TcpRecoveryService(
236 const TcpRecoveryService&);
237
238 TcpRecoveryService&
239 operator =(
240 const TcpRecoveryService&);
241
242protected:
244 struct NoDetails {};
245
247 explicit
249 const NoDetails&);
250
251public:
254 const TcpRecoverySettings&);
255
258
260 virtual
261 void
263 std::string&);
264
269 virtual
270 bool
272 const Handler&,
273 StrRef&, StrRef&);
274
276 virtual
277 void
279 const Handler&);
280};
281
#define ONIXS_CONFLATEDUDP_EXPORTED_CLASS
Definition Bootstrap.h:55
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:47
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
virtual ~TcpRecoveryService()
Finalizes instance and cleans everything up.
TcpRecoveryService(const NoDetails &)
Initializes without synchronization resource.
TcpRecoveryService(const TcpRecoverySettings &)
Initializes instance according to given settings.
virtual bool tryAcquire(const Handler &, StrRef &, StrRef &)
virtual void brief(std::string &)
Basic information on the service.
virtual void release(const Handler &)
Releases previously acquired lock on the service.
TCP recovery service configuration settings.
Definition TcpRecovery.h:48
void username(const std::string &username)
Definition TcpRecovery.h:86
TcpRecoverySettings()
Initializes parameters with default values.
Definition TcpRecovery.h:60
void password(const std::string &password)
void acquisitionTimeout(UInt32 acquisitionTimeout)
void throwZeroTcpRecoveryRequestLimit()
Throws error on zero TCP recovery request limit value.
Definition TcpRecovery.h:36
ONIXS_CONFLATEDUDP_EXPORTED void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
UInt32 UInt32
uInt32.
Definition Fields.h:261
Services as a marker for special construction.
Abstract watch service.
Definition Watch.h:30