File tree 4 files changed +44
-0
lines changed
4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ install(
45
45
msg_handler.h
46
46
msg_queue.h
47
47
nco.h
48
+ pmt_fmt.h
48
49
pdu.h
49
50
prefs.h
50
51
pycallback_object.h
Original file line number Diff line number Diff line change
1
+ /* -*- c++ -*- */
2
+ /*
3
+ * Copyright 2023 Marcus Müller
4
+ *
5
+ * This file is part of GNU Radio
6
+ *
7
+ * SPDX-License-Identifier: GPL-3.0-or-later
8
+ *
9
+ */
10
+ #ifndef INCLUDED_GNURADIO_PMT_FMT_H
11
+ #define INCLUDED_GNURADIO_PMT_FMT_H
12
+ #include < gnuradio/api.h>
13
+ #include < pmt/pmt.h>
14
+ #include < spdlog/fmt/fmt.h>
15
+ #include < string_view>
16
+
17
+ // !\brief enables PMTs to be formatted with fmt
18
+ template <>
19
+ struct GR_RUNTIME_API fmt::formatter<pmt::pmt_t > : formatter<std::string_view> {
20
+ fmt::format_context::iterator format (const pmt::pmt_t & obj,
21
+ format_context& ctx) const ;
22
+ };
23
+ #endif
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ add_library(
71
71
msg_queue.cc
72
72
pagesize.cc
73
73
pdu.cc
74
+ pmt_fmt.cc
74
75
prefs.cc
75
76
realtime.cc
76
77
realtime_impl.cc
Original file line number Diff line number Diff line change
1
+ /* -*- c++ -*- */
2
+ /*
3
+ * Copyright 2023 Marcus Müller
4
+ *
5
+ * This file is part of GNU Radio
6
+ *
7
+ * SPDX-License-Identifier: GPL-3.0-or-later
8
+ *
9
+ */
10
+ #include < gnuradio/pmt_fmt.h>
11
+ #include < pmt/pmt.h>
12
+ #include < spdlog/fmt/fmt.h>
13
+ #include < string_view>
14
+
15
+ fmt::format_context::iterator
16
+ fmt::formatter<pmt::pmt_t >::format(const pmt::pmt_t & obj, fmt::format_context& ctx) const
17
+ {
18
+ return fmt::format_to (ctx.out (), " {}" , pmt::write_string (obj));
19
+ }
You can’t perform that action at this time.
0 commit comments