Flow 2.0.0
Flow project: Full implementation reference.
blob.hpp
Go to the documentation of this file.
1/* Flow
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
19#pragma once
20
22
23namespace flow::util
24{
25
26// Types.
27
28/**
29 * Basic_blob that works in regular heap (and is itself placed in heap or stack) and memorizes a log::Logger,
30 * enabling easier logging albeit with a small perf trade-off. Most users will use the concrete types
31 * #Blob/#Sharing_blob which alias to Blob_with_log_context.
32 *
33 * @see Basic_blob. It supplies the core behavior of Blob_with_log_context. Note that while some APIs are shadowed in
34 * this (non-polymorphic) sub-class and thus documented inside the `class { braces }`, a significant number
35 * are simply inherited: namely the ones that do not log. Typically one would look at Basic_blob
36 * documentation and simply mentally remove any `Logger* logger_ptr` argument from the prototype, knowing
37 * the logging will occur with the log context established at Blob_with_log_context construction.
38 *
39 * In a vague sense Blob_with_log_context is to `Basic_blob<>` what `string` is to `basic_string`, in that it is a
40 * commonly used concrete type rather than a template. However, unlike that analogy, it also adds behavior and data.
41 * Basic_blob accomplishes (optional) logging by means of the user supplying (if desired) a non-null `Logger*`
42 * to each API they want to log. Blob_with_log_context, instead, takes a `Logger*` in any non-move/copy ctor and
43 * uses it for all subsequent logging. Basic_blob uses a little less memory and is a little bit faster, while
44 * Blob_with_log_context (#Blob, #Sharing_blob) is more convenient.
45 *
46 * It is possible, though somewhat exotic, to use any shadowed APIs (that take the `Logger* logger_ptr` optional
47 * arg) from Basic_blob (via cast of `this` to `Basic_blob*` perhaps).
48 *
49 * Lastly, reminder: Basic_blob, and hence Blob_with_log_context, log at TRACE log level or more verbose. If in any
50 * case there is no interest in logging at such a verbose level (checked against log::Logger::should_log() of course)
51 * then using #Blob_sans_log_context or #Sharing_blob_sans_log_context is straightforwardly superior.
52 *
53 * ### Historic note ###
54 * Originally `Blob` was the only class in the hierarchy and (1) could not be used with custom allocators (and was not
55 * SHM-friendly) unlike Basic_blob; and (2) stored a log context from construction unlike Basic_blob.
56 * Then when those 2 changes became required by some use cases, Basic_blob took the vast majority of what used to
57 * be `Blob` and added those 2 changes. Meanwhile `Blob` was rewritten in terms of Basic_blob in a way that
58 * exactly preserved its behavior (so that no call-site changes for Blob-using code were needed).
59 * Lastly, when #S_SHARING template param was added to Basic_blob, `Blob` became a template
60 * Blob_with_log_context, while #Blob aliased to `Blob_with_log_context<false>` thus staying functionally
61 * exactly the same as before, minus the share() feature. (`Sharing_blob` was added, aliasing to
62 * `Blob_with_log_context<true>`, being exactly idetical to `Blob` before; the rename was possible due to
63 * no production code using the sharing feature yet.)
64 *
65 * @internal
66 * ### Impl notes ###
67 * It is quite straightforward; we derive from Basic_blob, with `Allocator` set to the default `std::allocator`
68 * (heap alloc) and keep all of its behaviors except shadowing all APIs that take a `Logger*` having the shadows
69 * no longer take that but pass-through the ctor-supplied `Logger*` to the shadowee. As typical we use log::Log_context
70 * to store the necessary context including said `Logger*`. In some cases, also, a Basic_blob API is constrained
71 * (dtor, assignment) to not be able to even take a `Logger*` and therefore cannot log at all; we shadow such APIs
72 * as well and enable logging by judiciously calling something functionally equivalent to the shadowed thing.
73 * (See for example ~Blob_with_log_context() and the assignment operators.)
74 * @endinternal
75 *
76 * @tparam SHARING
77 * See Basic_blob.
78 */
79template<bool SHARING>
81 public log::Log_context,
82 public Basic_blob<std::allocator<uint8_t>, SHARING>
83{
84public:
85 // Types.
86
87 /// Short-hand for our main base.
89
90 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
91 using value_type = typename Base::value_type;
92 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
93 using size_type = typename Base::size_type;
94 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
96 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
97 using Iterator = typename Base::Iterator;
98 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
100 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
102 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
103 using pointer = typename Base::pointer;
104 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
106 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
107 using reference = typename Base::reference;
108 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
110 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
111 using iterator = typename Base::iterator;
112 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
114
115 // Constants.
116
117 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
118 static constexpr auto S_SHARING = Base::S_SHARING;
119
120 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
121 static constexpr auto S_UNCHANGED = Base::S_UNCHANGED;
122
123 /// Short-hand for base member (needed because base access to a template must be qualified otherwise).
125 static_assert(S_IS_VANILLA_ALLOC, "We derive from a std::allocator-driven thingie.");
126
127 // Constructors/destructor.
128
129 /**
130 * On top of the similar 2-arg Basic_blob ctor, memorizes the given log::Logger for all future logging
131 * in `*this`. (Except, technically, one can subsequently override this by using super-class APIs which take
132 * `Logger*`.)
133 *
134 * @param logger_ptr
135 * The Logger implementation to use subsequently.
136 */
137 Blob_with_log_context(log::Logger* logger_ptr = nullptr);
138
139 /**
140 * On top of the similar 3-arg Basic_blob ctor, memorizes the given log::Logger for all future logging
141 * in `*this`. (Except, technically, one can subsequently override this by using super-class APIs which take
142 * `Logger*`.)
143 *
144 * @param logger_ptr
145 * The Logger implementation to use subsequently.
146 * @param size
147 * See super-class API.
148 */
149 explicit Blob_with_log_context(log::Logger* logger_ptr, size_type size);
150
151 /**
152 * On top of the similar 4-arg Basic_blob ctor, memorizes the given log::Logger for all future logging
153 * in `*this`. (Except, technically, one can subsequently override this by using super-class APIs which take
154 * `Logger*`.)
155 *
156 * @param logger_ptr
157 * The Logger implementation to use subsequently.
158 * @param size
159 * See super-class API.
160 * @param coa_tag
161 * See super-class API.
162 */
163 explicit Blob_with_log_context(log::Logger* logger_ptr, size_type size, Clear_on_alloc coa_tag);
164
165 /**
166 * On top of the similar Basic_blob move ctor, moves the source object's log::Logger for all future logging
167 * in `*this`. (Except, technically, one can subsequently override this by using super-class APIs which take
168 * `Logger*`.)
169 *
170 * @note It is important this be `noexcept`, if a copying counterpart to us exists in this class; otherwise
171 * (e.g.) `vector<Blob_with_log_context>` will, on realloc, default to copying `*this`es around instead of
172 * moving: a terrible (in its stealthiness) perf loss.
173 *
174 * @param moved_src
175 * See super-class API.
176 */
177 Blob_with_log_context(Blob_with_log_context&& moved_src) noexcept;
178
179 /**
180 * On top of the similar Basic_blob copy ctor, copies the source object's log::Logger for all future logging
181 * in `*this`. (Except, technically, one can subsequently override this by using super-class APIs which take
182 * `Logger*`.)
183 *
184 * @param src
185 * See super-class API.
186 */
187 explicit Blob_with_log_context(const Blob_with_log_context& src);
188
189 /// On top of the similar Basic_blob dtor, adds some possible TRACE-logging.
191
192 // Methods.
193
194 /**
195 * On top of the similar Basic_blob method, logs using the stored log context.
196 *
197 * @note We do not shadow Basic_blob::assign() (move overload), as it would've been identical to the present
198 * operator. In Blob_with_log_context, unlike Basic_blob, there is no need for an extra `logger_ptr` optional
199 * arg.
200 *
201 * @note It is important this be `noexcept`, if a copying counterpart to us exists in this class; otherwise
202 * (e.g.) `vector<Blob_with_log_context>` will, on realloc, default to copying `*this`es around instead of
203 * moving: a terrible (in its stealthiness) perf loss.
204 *
205 * @param moved_src
206 * See super-class API.
207 * @return See super-class API.
208 */
210
211 /**
212 * On top of the similar Basic_blob method, logs using the stored log context.
213 *
214 * @note We do not shadow Basic_blob::assign() (copy overload), as it would've been identical to the present
215 * operator. In Blob_with_log_context, unlike Basic_blob, there is no need for an extra `logger_ptr` optional
216 * arg.
217 *
218 * @param src
219 * See super-class API.
220 * @return See super-class API.
221 */
223
224 /**
225 * On top of the similar Basic_blob method, logs using the stored log context.
226 *
227 * @param other
228 * See super-class API.
229 */
230 void swap(Blob_with_log_context& other) noexcept;
231
232 /**
233 * On top of the similar Basic_blob method, logs using the stored log context and copies it to the returned
234 * object as well.
235 *
236 * @param other
237 * See super-class API.
238 * @return See super-class API.
239 */
241
242 /**
243 * On top of the similar Basic_blob method, logs using the stored log context and copies it to the returned
244 * object as well.
245 *
246 * @param size
247 * See super-class API.
248 * @return See super-class API.
249 */
251
252 /**
253 * On top of the similar Basic_blob method, logs using the stored log context and copies it to the returned
254 * object as well.
255 *
256 * @param size
257 * See super-class API.
258 * @return See super-class API.
259 */
261
262 /**
263 * On top of the similar Basic_blob method, logs using the stored log context and copies it to the emitted
264 * objects as well.
265 *
266 * @tparam Emit_blob_func
267 * See super-class API. However in this version the arg type in the signature is `Blob_with_log_context&&`.
268 * @param size
269 * See super-class API.
270 * @param headless_pool
271 * See super-class API.
272 * @param emit_blob_func
273 * See `Emit_blob_func`.
274 */
275 template<typename Emit_blob_func>
276 void share_after_split_equally(size_type size, bool headless_pool, Emit_blob_func&& emit_blob_func);
277
278 /**
279 * On top of the similar Basic_blob method, logs using the stored log context and copies it to the emitted
280 * objects as well.
281 *
282 * @tparam Blob_container
283 * See super-class API. However in this version the container element type must be Blob_with_log_context.
284 * @param size
285 * See super-class API.
286 * @param headless_pool
287 * See super-class API.
288 * @param out_blobs
289 * See super-class API.
290 */
291 template<typename Blob_container>
292 void share_after_split_equally_emit_seq(size_type size, bool headless_pool, Blob_container* out_blobs);
293
294 /**
295 * On top of the similar Basic_blob method, logs using the stored log context and copes it to the emitted
296 * objects as well.
297 *
298 * @tparam Blob_ptr_container
299 * See super-class API. However in this version the container element pointer's type must be
300 * Blob_with_log_context.
301 * @param size
302 * See super-class API.
303 * @param headless_pool
304 * See super-class API.
305 * @param out_blobs
306 * See super-class API.
307 */
308 template<typename Blob_ptr_container>
309 void share_after_split_equally_emit_ptr_seq(size_type size, bool headless_pool, Blob_ptr_container* out_blobs);
310
311 /**
312 * On top of the similar Basic_blob method, logs using the stored log context.
313 *
314 * @param src
315 * See super-class API.
316 * @return See super-class API.
317 */
318 size_type assign_copy(const boost::asio::const_buffer& src);
319
320 /**
321 * On top of the similar Basic_blob method, logs using the stored log context.
322 *
323 * @param dest
324 * See super-class API.
325 * @param src
326 * See super-class API.
327 * @return See super-class API.
328 */
329 Iterator emplace_copy(Const_iterator dest, const boost::asio::const_buffer& src);
330
331 /**
332 * On top of the similar Basic_blob method, logs using the stored log context.
333 *
334 * @param src
335 * See super-class API.
336 * @param dest
337 * See super-class API.
338 * @return See super-class API.
339 */
340 Const_iterator sub_copy(Const_iterator src, const boost::asio::mutable_buffer& dest) const;
341
342 /**
343 * On top of the similar Basic_blob method, logs using the stored log context.
344 *
345 * @param capacity
346 * See super-class API.
347 */
349
350 /**
351 * On top of the similar Basic_blob method, logs using the stored log context.
352 *
353 * @param capacity
354 * See super-class API.
355 * @param coa_tag
356 * See super-class API.
357 */
359
360 /// On top of the similar Basic_blob method, logs using the stored log context.
361 void make_zero();
362
363 /**
364 * On top of the similar Basic_blob method, logs using the stored log context.
365 *
366 * @param size
367 * See super-class API.
368 * @param start_or_unchanged
369 * See super-class API.
370 */
371 void resize(size_type size, size_type start_or_unchanged = S_UNCHANGED);
372
373 /**
374 * On top of the similar Basic_blob method, logs using the stored log context.
375 *
376 * @param size
377 * See super-class API.
378 * @param start_or_unchanged
379 * See super-class API.
380 * @param coa_tag
381 * See super-class API.
382 */
383 void resize(size_type size, Clear_on_alloc coa_tag, size_type start_or_unchanged = S_UNCHANGED);
384
385 // private: There are no added data per se, but there is the added base, log::Log_context, which stores some stuff.
386}; // class Blob_with_log_context
387
388// Free functions: in *_fwd.hpp.
389
390// Template implementations.
391
392template<bool SHARING>
394 log::Log_context(logger_ptr, Base::S_LOG_COMPONENT)
395 // And default-ct Base{}.
396{
397 // Nothing else.
398}
399
400template<bool SHARING>
402 log::Log_context(logger_ptr, Base::S_LOG_COMPONENT),
403 Base(size, get_logger())
404{
405 // Nothing else.
406}
407
408template<bool SHARING>
410 Clear_on_alloc coa_tag) :
411 log::Log_context(logger_ptr, Base::S_LOG_COMPONENT),
412 Base(size, coa_tag, get_logger())
413{
414 // Nothing else.
415}
416
417template<bool SHARING>
419 log::Log_context(static_cast<log::Log_context&&>(std::move(moved_src))),
420 Base(std::move(moved_src), get_logger())
421{
422 // Nothing else.
423}
424
425template<bool SHARING>
427 log::Log_context(static_cast<const log::Log_context&>(src)),
428 Base(src, get_logger())
429{
430 // Nothing else.
431}
432
433template<bool SHARING>
435{
436 /* ~Basic_blob() doesn't log at all -- no way to give a Logger* to it -- but a way to get some potentially
437 * useful logging is to make_zero(). It is redundant (which is why ~Basic_blob() does not bother) but in some
438 * cases usefully logs. */
439 make_zero();
440}
441
442template<bool SHARING>
445{
446 using log::Log_context;
447
448 Log_context::operator=(static_cast<const Log_context&>(src));
449 Base::assign(src, get_logger()); // Yay! We can leverage this to make operator=() log which Basic_blob can't do.
450 return *this;
451}
452
453template<bool SHARING>
456{
457 using log::Log_context;
458
459 Log_context::operator=(static_cast<Log_context&&>(std::move(moved_src)));
460 Base::assign(std::move(moved_src), get_logger()); // Same comment as in copy-assignment above.
461 return *this;
462}
463
464template<bool SHARING>
466{
467 using log::Log_context;
468 using std::swap;
469
470 if (this != &other)
471 {
472 swap(*static_cast<Log_context*>(this), static_cast<Log_context&>(other));
473 Base::swap(other, get_logger()); // Might as well keep this inside the `if` as a micro-optimization.
474 }
475}
476
477template<bool SHARING>
479{
480 return blob1.swap(blob2);
481}
482
483template<bool SHARING>
485{
486 Blob_with_log_context blob{get_logger()};
487 static_cast<Base&>(blob) = Base::share(get_logger());
488 return blob;
489}
490
491template<bool SHARING>
494{
495 Blob_with_log_context blob{get_logger()};
496 static_cast<Base&>(blob) = Base::share_after_split_left(lt_size, get_logger());
497 return blob;
498}
499
500template<bool SHARING>
503{
504 Blob_with_log_context blob{get_logger()};
505 static_cast<Base&>(blob) = Base::share_after_split_right(rt_size, get_logger());
506 return blob;
507}
508
509template<bool SHARING>
510template<typename Emit_blob_func>
512 Emit_blob_func&& emit_blob_func)
513{
514 Base::share_after_split_equally_impl(size, headless_pool, std::move(emit_blob_func), get_logger(),
515 [this](size_type lt_size, [[maybe_unused]] log::Logger* logger_ptr)
517 {
518 assert(logger_ptr == get_logger());
519 return share_after_split_left(lt_size);
520 });
521}
522
523template<bool SHARING>
524template<typename Blob_container>
526 Blob_container* out_blobs_ptr)
527{
528 // Almost copy-pasted from Basic_blob::<same method>(). It's short, though, so it seems fine. @todo Revisit.
529
530 assert(out_blobs_ptr);
531 share_after_split_equally(size, headless_pool, [&](Blob_with_log_context&& blob_moved)
532 {
533 out_blobs_ptr->push_back(std::move(blob_moved));
534 });
535}
536
537template<bool SHARING>
538template<typename Blob_ptr_container>
540 bool headless_pool,
541 Blob_ptr_container* out_blobs_ptr)
542{
543 // Almost copy-pasted from Basic_blob::<same method>(). It's short, though, so it seems fine. @todo Revisit.
544
545 // By documented requirements this should be, like, <...>_ptr<Blob_with_log_context>.
546 using Ptr = typename Blob_ptr_container::value_type;
547
548 assert(out_blobs_ptr);
549
550 share_after_split_equally(size, headless_pool, [&](Blob_with_log_context&& blob_moved)
551 {
552 out_blobs_ptr->push_back(Ptr{new Blob_with_log_context{std::move(blob_moved)}});
553 });
554}
555
556template<bool SHARING>
558{
559 Base::reserve(new_capacity, get_logger());
560}
561
562template<bool SHARING>
564{
565 Base::reserve(new_capacity, coa_tag, get_logger());
566}
567
568template<bool SHARING>
569void Blob_with_log_context<SHARING>::resize(size_type new_size, size_type new_start_or_unchanged)
570{
571 Base::resize(new_size, new_start_or_unchanged, get_logger());
572}
573
574template<bool SHARING>
576 size_type new_start_or_unchanged)
577{
578 Base::resize(new_size, coa_tag, new_start_or_unchanged, get_logger());
579}
580
581template<bool SHARING>
583{
584 Base::make_zero(get_logger());
585}
586
587template<bool SHARING>
589 Blob_with_log_context<SHARING>::assign_copy(const boost::asio::const_buffer& src)
590{
591 return Base::assign_copy(src, get_logger());
592}
593
594template<bool SHARING>
596 Blob_with_log_context<SHARING>::emplace_copy(Const_iterator dest, const boost::asio::const_buffer& src)
597{
598 return Base::emplace_copy(dest, src, get_logger());
599}
600
601template<bool SHARING>
603 Blob_with_log_context<SHARING>::sub_copy(Const_iterator src, const boost::asio::mutable_buffer& dest) const
604{
605 return Base::sub_copy(src, dest, get_logger());
606}
607
608} // namespace flow::util
Convenience class that simply stores a Logger and/or Component passed into a constructor; and returns...
Definition: log.hpp:1638
Interface that the user should implement, passing the implementing Logger into logging classes (Flow'...
Definition: log.hpp:1286
A hand-optimized and API-tweaked replacement for vector<uint8_t>, i.e., buffer of bytes inside an all...
Definition: basic_blob.hpp:276
std::allocator< uint8_t > Allocator_raw
Short-hand for the allocator type specified at compile-time. Its element type is our value_type.
Definition: basic_blob.hpp:296
value_type const * Const_iterator
Type for iterator pointing into an immutable structure of this type.
Definition: basic_blob.hpp:293
value_type * Iterator
Type for iterator pointing into a mutable structure of this type.
Definition: basic_blob.hpp:290
size_type capacity() const
Returns the number of elements in the internally allocated buffer, which is 1 or more; or 0 if no buf...
const value_type & const_reference
For container compliance (hence the irregular capitalization): reference to const element.
Definition: basic_blob.hpp:307
std::size_t size_type
Type for index into blob or length of blob or sub-blob.
Definition: basic_blob.hpp:284
Iterator pointer
For container compliance (hence the irregular capitalization): pointer to element.
Definition: basic_blob.hpp:301
Iterator iterator
For container compliance (hence the irregular capitalization): Iterator type.
Definition: basic_blob.hpp:309
value_type & reference
For container compliance (hence the irregular capitalization): reference to element.
Definition: basic_blob.hpp:305
static constexpr bool S_IS_VANILLA_ALLOC
true if Allocator_raw underlying allocator template is simply std::allocator; false otherwise.
Definition: basic_blob.hpp:359
static constexpr size_type S_UNCHANGED
Special value indicating an unchanged size_type value; such as in resize().
Definition: basic_blob.hpp:319
uint8_t value_type
Short-hand for values, which in this case are unsigned bytes.
Definition: basic_blob.hpp:281
Const_iterator const_pointer
For container compliance (hence the irregular capitalization): pointer to const element.
Definition: basic_blob.hpp:303
std::ptrdiff_t difference_type
Type for difference of size_types.
Definition: basic_blob.hpp:287
Const_iterator const_iterator
For container compliance (hence the irregular capitalization): Const_iterator type.
Definition: basic_blob.hpp:311
static constexpr bool S_SHARING
Value of template parameter SHARING (for generic programming).
Definition: basic_blob.hpp:316
size_type size() const
Returns number of elements stored, namely end() - begin().
Basic_blob that works in regular heap (and is itself placed in heap or stack) and memorizes a log::Lo...
Definition: blob.hpp:83
typename Base::iterator iterator
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:111
typename Base::pointer pointer
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:103
void swap(Blob_with_log_context &other) noexcept
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:465
typename Base::value_type value_type
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:91
static constexpr auto S_IS_VANILLA_ALLOC
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:124
size_type assign_copy(const boost::asio::const_buffer &src)
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:589
void share_after_split_equally(size_type size, bool headless_pool, Emit_blob_func &&emit_blob_func)
On top of the similar Basic_blob method, logs using the stored log context and copies it to the emitt...
Definition: blob.hpp:511
static constexpr auto S_UNCHANGED
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:121
typename Base::const_pointer const_pointer
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:105
void make_zero()
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:582
Const_iterator sub_copy(Const_iterator src, const boost::asio::mutable_buffer &dest) const
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:603
void resize(size_type size, size_type start_or_unchanged=S_UNCHANGED)
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:569
typename Base::Iterator Iterator
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:97
Blob_with_log_context share() const
On top of the similar Basic_blob method, logs using the stored log context and copies it to the retur...
Definition: blob.hpp:484
typename Base::Allocator_raw Allocator_raw
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:101
typename Base::difference_type difference_type
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:95
Blob_with_log_context share_after_split_right(size_type size)
On top of the similar Basic_blob method, logs using the stored log context and copies it to the retur...
Definition: blob.hpp:502
typename Base::const_reference const_reference
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:109
void reserve(size_type capacity)
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:557
static constexpr auto S_SHARING
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:118
Iterator emplace_copy(Const_iterator dest, const boost::asio::const_buffer &src)
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:596
void share_after_split_equally_emit_seq(size_type size, bool headless_pool, Blob_container *out_blobs)
On top of the similar Basic_blob method, logs using the stored log context and copies it to the emitt...
Definition: blob.hpp:525
typename Base::Const_iterator Const_iterator
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:99
Blob_with_log_context share_after_split_left(size_type size)
On top of the similar Basic_blob method, logs using the stored log context and copies it to the retur...
Definition: blob.hpp:493
typename Base::reference reference
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:107
typename Base::size_type size_type
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:93
~Blob_with_log_context()
On top of the similar Basic_blob dtor, adds some possible TRACE-logging.
Definition: blob.hpp:434
Blob_with_log_context(log::Logger *logger_ptr=nullptr)
On top of the similar 2-arg Basic_blob ctor, memorizes the given log::Logger for all future logging i...
Definition: blob.hpp:393
typename Base::const_iterator const_iterator
Short-hand for base member (needed because base access to a template must be qualified otherwise).
Definition: blob.hpp:113
Blob_with_log_context & operator=(Blob_with_log_context &&moved_src) noexcept
On top of the similar Basic_blob method, logs using the stored log context.
Definition: blob.hpp:455
void share_after_split_equally_emit_ptr_seq(size_type size, bool headless_pool, Blob_ptr_container *out_blobs)
On top of the similar Basic_blob method, logs using the stored log context and copes it to the emitte...
Definition: blob.hpp:539
Flow module containing miscellaneous general-use facilities that don't fit into any other Flow module...
Definition: basic_blob.hpp:31
void swap(Blob_with_log_context< SHARING > &blob1, Blob_with_log_context< SHARING > &blob2) noexcept
On top of the similar Basic_blob related function, logs using the stored log context of blob1.
Definition: blob.hpp:478
void swap(Basic_blob< Allocator, SHARING > &blob1, Basic_blob< Allocator, SHARING > &blob2, log::Logger *logger_ptr) noexcept
Equivalent to blob1.swap(blob2).
Tag type used at least in Basic_blob and Blob_with_log_context to specify that an allocated buffer be...
Definition: basic_blob.hpp:40