OnixS C++ CME MDP Streamlined Market Data Handler 1.2.0
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
72 size_t blockIncrease() const
73 {
74 return blockIncrease_;
75 }
76
80 void
82 size_t increase)
83 {
84 if (0 < increase)
85 {
86 blockIncrease_ = increase;
87 }
88 else
89 {
90 throwZeroParameter("blockIncrease");
91 }
92 }
93
100 size_t increaseQty() const
101 {
102 return increaseQty_;
103 }
104
111 void
113 size_t qty)
114 {
115 if (0 < qty)
116 {
117 increaseQty_ = qty;
118 }
119 else
120 {
121 throwZeroParameter("increaseQty");
122 }
123 }
124
131 size_t chunkSize() const
132 {
133 return chunkSize_;
134 }
135
142 void
144 size_t size)
145 {
146 if (0 < size)
147 {
148 chunkSize_ = size;
149 }
150 else
151 {
152 throwZeroParameter("chunkSize");
153 }
154 }
155
160 size_t chunkScaling() const
161 {
162 return chunkScaling_;
163 }
164
169 void
171 size_t factor)
172 {
173 if (0 < factor)
174 {
175 chunkScaling_ = factor;
176 }
177 else
178 {
179 throwZeroParameter("chunkScaling");
180 }
181 }
182};
183
186void
188 std::string&,
189 const
191
193inline
194std::string
196 const
197 MemoryPoolSettings& settings)
198{
199 std::string str;
200
201 toStr(str, settings);
202
203 return str;
204}
205
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:169
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition Bootstrap.h:173
#define ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS
Definition Bootstrap.h:111
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED
Definition Compiler.h:160
size_t chunkScaling() const
Defines chunk scale factor.
MemoryPoolSettings()
Initializes parameters with default values.
void increaseQty(size_t qty)
Limits number of increases memory pool does.
size_t increaseQty() const
Limits number of increases memory pool does.
size_t blockIncrease() const
Memory block increase value.
void chunkSize(size_t size)
Number of blocks per chunk.
void chunkScaling(size_t factor)
Defines chunk scale factor.
size_t chunkSize() const
Number of blocks per chunk.
void blockIncrease(size_t increase)
Updates memory block increase value.
void throwZeroParameter(const char *parameter)
Raises exception on zero parameter value.
void toStr(std::string &str, const Decimal &number)
Definition Decimal.h:502