|
1 | 1 | /* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */
|
2 | 2 | /*
|
3 |
| - * Copyright (c) 2021-2023 Triad National Security, LLC |
| 3 | + * Copyright (c) 2021-2024 Triad National Security, LLC |
4 | 4 | * All rights reserved.
|
5 | 5 | *
|
6 | 6 | * This file is part of the quo-vadis project. See the LICENSE file at the
|
|
19 | 19 | * h = qvi_line_hwpool_t *
|
20 | 20 | * i = int
|
21 | 21 | * s = char *
|
| 22 | + * s = std::string |
22 | 23 | * t = qvi_task_id_t
|
23 | 24 | * z = qvi_bbuff_rmi_zero_msg_t
|
24 | 25 | */
|
|
30 | 31 | #include "qvi-hwloc.h"
|
31 | 32 | #include "qvi-hwpool.h"
|
32 | 33 |
|
33 |
| -#include <string> |
34 |
| - |
35 | 34 | // 'Null' cpuset representation as a string.
|
36 |
| -#define QV_BUFF_RMI_NULL_CPUSET "" |
| 35 | +static const cstr_t QV_BUFF_RMI_NULL_CPUSET = ""; |
37 | 36 |
|
38 | 37 | // Byte containers
|
39 | 38 | using qvi_bbuff_rmi_bytes_in_t = std::pair<void *, size_t>;
|
@@ -227,6 +226,15 @@ qvi_bbuff_rmi_pack_type_picture(
|
227 | 226 | picture += "s";
|
228 | 227 | }
|
229 | 228 |
|
| 229 | +template<> |
| 230 | +inline void |
| 231 | +qvi_bbuff_rmi_pack_type_picture( |
| 232 | + std::string &picture, |
| 233 | + std::string & |
| 234 | +) { |
| 235 | + picture += "s"; |
| 236 | +} |
| 237 | + |
230 | 238 | template<>
|
231 | 239 | inline void
|
232 | 240 | qvi_bbuff_rmi_pack_type_picture(
|
@@ -361,6 +369,17 @@ qvi_bbuff_rmi_pack_item_impl(
|
361 | 369 | return qvi_bbuff_append(buff, data, strlen(data) + 1);
|
362 | 370 | }
|
363 | 371 |
|
| 372 | +/** |
| 373 | + * Packs std::string |
| 374 | + */ |
| 375 | +inline int |
| 376 | +qvi_bbuff_rmi_pack_item( |
| 377 | + qvi_bbuff_t *buff, |
| 378 | + const std::string &data |
| 379 | +) { |
| 380 | + return qvi_bbuff_rmi_pack_item_impl(buff, data.c_str()); |
| 381 | +} |
| 382 | + |
364 | 383 | /**
|
365 | 384 | * Packs const char *
|
366 | 385 | */
|
@@ -798,7 +817,6 @@ qvi_bbuff_rmi_unpack_item(
|
798 | 817 | );
|
799 | 818 | if (rc != QV_SUCCESS) goto out;
|
800 | 819 | total_bw += bw;
|
801 |
| - buffpos += bw; |
802 | 820 | out:
|
803 | 821 | if (rc != QV_SUCCESS) {
|
804 | 822 | total_bw = 0;
|
@@ -901,7 +919,6 @@ qvi_bbuff_rmi_unpack_item(
|
901 | 919 | );
|
902 | 920 | if (rc != QV_SUCCESS) goto out;
|
903 | 921 | total_bw += bw;
|
904 |
| - buffpos += bw; |
905 | 922 | out:
|
906 | 923 | if (rc != QV_SUCCESS) {
|
907 | 924 | total_bw = 0;
|
|
0 commit comments