OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
MemoryPoolSettings.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
27
29
31inline
32void
34 const Char* parameter)
35{
36 std::string reason;
37
38 reason += "Non-zero value is expected for '";
39 reason += parameter ? parameter : "<unknown>";
40 reason += "' parameter. ";
41
42 throw std::out_of_range(reason);
43}
44
50{
51 size_t blockIncrease_;
52
53 size_t increaseQty_;
54
55 size_t chunkSize_;
56
57 size_t chunkScaling_;
58
59public:
62 : blockIncrease_(48)
63 , increaseQty_(32)
64 , chunkSize_(20)
65 , chunkScaling_(2)
66 {
67 }
68
71 const MemoryPoolSettings& other)
72 : blockIncrease_(
73 other.blockIncrease_)
74 , increaseQty_(
75 other.increaseQty_)
76 , chunkSize_(
77 other.chunkSize_)
78 , chunkScaling_(
79 other.chunkScaling_)
80 {
81 }
82
87
92 size_t
94 {
95 return blockIncrease_;
96 }
97
102 void
104 size_t increase)
105 {
106 const Char*
107 const name =
108 "BlockIncrease";
109
110 if (0 < increase)
111 {
112 blockIncrease_ = increase;
113 }
114 else
115 {
116 throwZeroParameter(name);
117 }
118 }
119
128 size_t
130 {
131 return increaseQty_;
132 }
133
142 void
144 size_t qty)
145 {
146 const Char*
147 const name =
148 "IncreaseQty";
149
150 if (0 < qty)
151 {
152 increaseQty_ = qty;
153 }
154 else
155 {
156 throwZeroParameter(name);
157 }
158 }
159
167 size_t
168 chunkSize() const
169 {
170 return chunkSize_;
171 }
172
180 void
182 size_t size)
183 {
184 const Char*
185 const name =
186 "ChunkSize";
187
188 if (0 < size)
189 {
190 chunkSize_ = size;
191 }
192 else
193 {
194 throwZeroParameter(name);
195 }
196 }
197
202 size_t
204 {
205 return chunkScaling_;
206 }
207
212 void
214 size_t factor)
215 {
216 const Char*
217 const name =
218 "ChunkScaling";
219
220 if (0 < factor)
221 {
222 chunkScaling_ = factor;
223 }
224 else
225 {
226 throwZeroParameter(name);
227 }
228 }
229
232 operator =(
233 const MemoryPoolSettings& other)
234 {
235 blockIncrease_ =
236 other.blockIncrease_;
237
238 increaseQty_ =
239 other.increaseQty_;
240
241 chunkSize_ =
242 other.chunkSize_;
243
244 chunkScaling_ =
245 other.chunkScaling_;
246
247 return *this;
248 }
249};
250
252ONIXS_CONFLATEDUDP_EXPORTED
253void
255 std::string&,
256 const
258
260inline
261std::string
263 const
264 MemoryPoolSettings& settings)
265{
266 std::string str;
267
268 toStr(str, settings);
269
270 return str;
271}
272
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
MemoryPoolSettings()
Initializes parameters with default values.
MemoryPoolSettings(const MemoryPoolSettings &other)
Initializes as a copy.
void throwZeroParameter(const Char *parameter)
Raises exception on zero parameter value.
ONIXS_CONFLATEDUDP_EXPORTED void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
char Char
Character type alias.
Definition String.h:36