Skip to content

Commit 36df5fc

Browse files
Strengthen class interfaces. (#269)
Signed-off-by: Samuel K. Gutierrez <[email protected]>
1 parent f5cdfe4 commit 36df5fc

15 files changed

+139
-101
lines changed

src/qvi-bbuff-rmi.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ template<>
104104
inline void
105105
qvi_bbuff_rmi_pack_type_picture(
106106
std::string &picture,
107-
const qvi_hwloc_bitmap_s &
107+
const qvi_hwloc_bitmap &
108108
) {
109109
picture += "c";
110110
}
@@ -484,7 +484,7 @@ qvi_bbuff_rmi_pack_item(
484484
inline int
485485
qvi_bbuff_rmi_pack_item(
486486
qvi_bbuff *buff,
487-
const qvi_hwloc_bitmap_s &bitmap
487+
const qvi_hwloc_bitmap &bitmap
488488
) {
489489
return qvi_bbuff_rmi_pack_item_impl(buff, bitmap.cdata());
490490
}
@@ -781,7 +781,7 @@ qvi_bbuff_rmi_unpack_item(
781781
*/
782782
inline int
783783
qvi_bbuff_rmi_unpack_item(
784-
qvi_hwloc_bitmap_s &bitmap,
784+
qvi_hwloc_bitmap &bitmap,
785785
byte_t *buffpos,
786786
size_t *bytes_written
787787
) {

src/qvi-group-omp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "qvi-omp.h"
2626

2727
struct qvi_group_omp : public qvi_group {
28-
protected:
28+
private:
2929
/** Task associated with this group. */
3030
qvi_task *m_task = nullptr;
3131
/** Underlying group instance. */

src/qvi-hwloc.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ int
12481248
qvi_hwloc_get_devices_in_bitmap(
12491249
qvi_hwloc_t *hwl,
12501250
qv_hw_obj_type_t dev_type,
1251-
const qvi_hwloc_bitmap_s &bitmap,
1251+
const qvi_hwloc_bitmap &bitmap,
12521252
qvi_hwloc_dev_list_t &devs
12531253
) {
12541254
return get_devices_in_cpuset(hwl, dev_type, bitmap.cdata(), devs);

src/qvi-hwloc.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -419,48 +419,48 @@ qvi_hwloc_supported_devices(void);
419419
/**
420420
* hwloc bitmap object.
421421
*/
422-
struct qvi_hwloc_bitmap_s {
422+
struct qvi_hwloc_bitmap {
423423
private:
424424
/** Internal bitmap. */
425425
hwloc_bitmap_t m_data = nullptr;
426426
public:
427427
/** Default constructor. */
428-
qvi_hwloc_bitmap_s(void)
428+
qvi_hwloc_bitmap(void)
429429
{
430430
const int rc = qvi_hwloc_bitmap_calloc(&m_data);
431431
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
432432
}
433433
/** Construct via hwloc_const_bitmap_t. */
434-
explicit qvi_hwloc_bitmap_s(hwloc_const_bitmap_t bitmap)
434+
explicit qvi_hwloc_bitmap(hwloc_const_bitmap_t bitmap)
435435
{
436436
int rc = qvi_hwloc_bitmap_calloc(&m_data);
437437
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
438438
rc = set(bitmap);
439439
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
440440
}
441441
/** Copy constructor. */
442-
qvi_hwloc_bitmap_s(const qvi_hwloc_bitmap_s &src)
442+
qvi_hwloc_bitmap(const qvi_hwloc_bitmap &src)
443443
{
444444
int rc = qvi_hwloc_bitmap_calloc(&m_data);
445445
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
446446
rc = set(src.m_data);
447447
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
448448
}
449449
/** Destructor. */
450-
~qvi_hwloc_bitmap_s(void)
450+
~qvi_hwloc_bitmap(void)
451451
{
452452
qvi_hwloc_bitmap_delete(&m_data);
453453
}
454454
/** Equality operator. */
455455
bool
456456
operator==(
457-
const qvi_hwloc_bitmap_s &x
457+
const qvi_hwloc_bitmap &x
458458
) const {
459459
return hwloc_bitmap_compare(cdata(), x.cdata()) == 0;
460460
}
461461
/** Assignment operator. */
462462
void
463-
operator=(const qvi_hwloc_bitmap_s &src)
463+
operator=(const qvi_hwloc_bitmap &src)
464464
{
465465
const int rc = qvi_hwloc_bitmap_copy(src.m_data, m_data);
466466
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
@@ -494,13 +494,13 @@ struct qvi_hwloc_bitmap_s {
494494
/**
495495
* Vector of cpuset objects.
496496
*/
497-
using qvi_hwloc_cpusets_t = std::vector<qvi_hwloc_bitmap_s>;
497+
using qvi_hwloc_cpusets_t = std::vector<qvi_hwloc_bitmap>;
498498

499499
typedef struct qvi_hwloc_device_s {
500500
/** Device type. */
501501
qv_hw_obj_type_t type = QV_HW_OBJ_LAST;
502502
/** Device affinity. */
503-
qvi_hwloc_bitmap_s affinity;
503+
qvi_hwloc_bitmap affinity;
504504
/** Vendor ID. */
505505
int vendor_id = QVI_HWLOC_DEVICE_INVALID_ID;
506506
/** System Management Interface ID. */
@@ -531,7 +531,7 @@ int
531531
qvi_hwloc_get_devices_in_bitmap(
532532
qvi_hwloc_t *hwl,
533533
qv_hw_obj_type_t dev_type,
534-
const qvi_hwloc_bitmap_s &bitmap,
534+
const qvi_hwloc_bitmap &bitmap,
535535
qvi_hwloc_dev_list_t &devs
536536
);
537537

src/qvi-hwpool.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ qvi_hwpool_res::hints(void)
2323
return m_hints;
2424
}
2525

26-
qvi_hwloc_bitmap_s &
26+
qvi_hwloc_bitmap &
2727
qvi_hwpool_res::affinity(void)
2828
{
2929
return m_affinity;
3030
}
3131

32-
const qvi_hwloc_bitmap_s &
32+
const qvi_hwloc_bitmap &
3333
qvi_hwpool_res::affinity(void) const
3434
{
3535
return m_affinity;
@@ -256,7 +256,7 @@ qvi_hwpool::initialize(
256256
return add_devices_with_affinity(hwloc);
257257
}
258258

259-
const qvi_hwloc_bitmap_s &
259+
const qvi_hwloc_bitmap &
260260
qvi_hwpool::cpuset(void) const
261261
{
262262
return m_cpu.affinity();

src/qvi-hwpool.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ struct qvi_hwpool_res {
2727
/** Resource hint flags. */
2828
qv_scope_create_hints_t m_hints = QV_SCOPE_CREATE_HINT_NONE;
2929
/** The resource's affinity encoded as a bitmap. */
30-
qvi_hwloc_bitmap_s m_affinity;
30+
qvi_hwloc_bitmap m_affinity;
3131
public:
3232
/** Returns the resource's create hints. */
3333
qv_scope_create_hints_t
3434
hints(void);
3535
/**
3636
* Returns a reference to the resource's affinity encoded by a bitmap.
3737
*/
38-
qvi_hwloc_bitmap_s &
38+
qvi_hwloc_bitmap &
3939
affinity(void);
4040
/**
4141
* Returns a const reference to the resource's affinity encoded by a bitmap.
4242
*/
43-
const qvi_hwloc_bitmap_s &
43+
const qvi_hwloc_bitmap &
4444
affinity(void) const;
4545
};
4646

@@ -72,7 +72,7 @@ struct qvi_hwpool_dev : qvi_hwpool_res {
7272
/** Device type. */
7373
qv_hw_obj_type_t m_type = QV_HW_OBJ_LAST;
7474
/** The bitmap encoding CPU affinity. */
75-
qvi_hwloc_bitmap_s m_affinity;
75+
qvi_hwloc_bitmap m_affinity;
7676
/** Device ID (ordinal). */
7777
int m_id = QVI_HWLOC_DEVICE_INVALID_ID;
7878
/** The PCI bus ID. */
@@ -164,7 +164,7 @@ struct qvi_hwpool {
164164
/**
165165
* Returns a const reference to the hardware pool's cpuset.
166166
*/
167-
const qvi_hwloc_bitmap_s &
167+
const qvi_hwloc_bitmap &
168168
cpuset(void) const;
169169
/**
170170
* Returns a const reference to the hardware pool's devices.

0 commit comments

Comments
 (0)