asrt
Automated System Runtime Testing library
Loading...
Searching...
No Matches
diag.hpp
1
11#pragma once
12
13#include "../asrtc/diag.h"
14#include "../asrtl/asrt_assert.h"
15#include "../asrtl/log.h"
16#include "../asrtl/status_to_str.h"
17#include "../asrtlpp/util.hpp"
18
19#include <memory>
20
21namespace asrt
22{
23
24using diag_record = asrt_diag_record;
25
28{
29 struct asrt_allocator* alloc;
30 void operator()( asrt_diag_record* rec ) const { asrt_diag_free_record( alloc, rec ); }
31};
32
34ASRT_NODISCARD inline status init(
35 ref< asrt_diag_server > d,
36 asrt_node& prev,
37 asrt_allocator alloc )
38{
39 return asrt_diag_server_init( d, &prev, alloc );
40}
41
44ASRT_NODISCARD inline std::unique_ptr< diag_record, diag_record_deleter > take_record(
45 ref< asrt_diag_server > d )
46{
47 return { asrt_diag_server_take_record( d ), diag_record_deleter{ &d->alloc } };
48}
49
51inline void deinit( ref< asrt_diag_server > d )
52{
53 asrt_diag_server_deinit( d );
54}
55
56
57} // namespace asrt
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: callback.hpp:17
ASRT_NODISCARD std::unique_ptr< diag_record, diag_record_deleter > take_record(ref< asrt_diag_server > d)
Remove and return the oldest buffered record as an owning unique_ptr.
Definition: diag.hpp:44
ASRT_NODISCARD enum asrt_status init(ref< asrt_cntr_assm > assm, asrt_allocator alloc)
Initialise the controller assembly — wires controller, diag, param, collect and stream channels.
Definition: cntr_assm.hpp:25
void deinit(ref< asrt_cntr_assm > assm)
Release all resources owned by the assembly.
Definition: cntr_assm.hpp:52
Custom deleter for diag_record unique_ptr; uses the server's allocator.
Definition: diag.hpp:28
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: allocator.h:28
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: diag.h:27
A node in a doubly-linked channel chain.
Definition: chann.h:122