---
name: "hwlocality_conversion"
section: "3"
platform: "linux"
package: "libhwloc-doc"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_conversion"
---

# hwlocality\_conversion(3)

## NAME

Object/String Conversion -

### Functions

 const char \* **hwloc\_obj\_type\_string** (**hwloc\_obj\_type\_t** type) \
  **hwloc\_obj\_type\_t** **hwloc\_obj\_type\_of\_string** (const char \*string) \
  int **hwloc\_obj\_type\_snprintf** (char \*restrict string, size\_t size, **hwloc\_obj\_t** obj, int verbose)\
  int **hwloc\_obj\_attr\_snprintf** (char \*restrict string, size\_t size, **hwloc\_obj\_t** obj, const char \*restrict separator, int verbose)\
  int **hwloc\_obj\_snprintf** (char \*restrict string, size\_t size, **hwloc\_topology\_t** topology, **hwloc\_obj\_t** obj, const char \*restrict indexprefix, int verbose)\
  int **hwloc\_obj\_cpuset\_snprintf** (char \*restrict str, size\_t size, size\_t nobj, const **hwloc\_obj\_t** \*restrict objs)\
 static inline const char \* **hwloc\_obj\_get\_info\_by\_name** (**hwloc\_obj\_t** obj, const char \*name) \
  void **hwloc\_obj\_add\_info** (**hwloc\_obj\_t** obj, const char \*name, const char \*value)\

## Function Documentation

### void hwloc\_obj\_add\_info (hwloc\_obj\_tobj, const char \*name, const char \*value)

Add the given info name and value pair to the given object. The info is appended to the existing info array even if another key with the same name already exists.

The input strings are copied before being added in the object infos.

### int hwloc\_obj\_attr\_snprintf (char \*restrictstring, size\_tsize, hwloc\_obj\_tobj, const char \*restrictseparator, intverbose)

Stringify the attributes of a given topology object into a human-readable form. Attribute values are separated by `separator`.

Only the major attributes are printed in non-verbose mode.

If `size` is 0, `string` may safely be `NULL`.

**Returns:**

the number of character that were actually written if not truncating, or that would have been written (not including the ending \\0).

### int hwloc\_obj\_cpuset\_snprintf (char \*restrictstr, size\_tsize, size\_tnobj, const hwloc\_obj\_t \*restrictobjs)

Stringify the cpuset containing a set of objects. If `size` is 0, `string` may safely be `NULL`.

**Returns:**

the number of character that were actually written if not truncating, or that would have been written (not including the ending \\0).

### static inline const char \* hwloc\_obj\_get\_info\_by\_name (hwloc\_obj\_tobj, const char \*name)` [static]`

Search the given key name in object infos and return the corresponding value. If multiple keys match the given name, only the first one is returned.

**Returns:**

`NULL` if no such key exists.

### int hwloc\_obj\_snprintf (char \*restrictstring, size\_tsize, hwloc\_topology\_ttopology, hwloc\_obj\_tobj, const char \*restrictindexprefix, intverbose)

Stringify a given topology object into a human-readable form. **Note:**

This function is deprecated in favor of **hwloc\_obj\_type\_snprintf()** and **hwloc\_obj\_attr\_snprintf()** since it is not very flexible and only prints physical/OS indexes.

Fill string `string` up to `size` characters with the description of topology object `obj` in topology `topology`.

If `verbose` is set, a longer description is used. Otherwise a short description is used.

`indexprefix` is used to prefix the `os_index` attribute number of the object in the description. If `NULL`, the `#` character is used.

If `size` is 0, `string` may safely be `NULL`.

**Returns:**

the number of character that were actually written if not truncating, or that would have been written (not including the ending \\0).

### hwloc\_obj\_type\_t hwloc\_obj\_type\_of\_string (const char \*string)

Return an object type from the string. **Returns:**

\-1 if unrecognized.

### int hwloc\_obj\_type\_snprintf (char \*restrictstring, size\_tsize, hwloc\_obj\_tobj, intverbose)

Stringify the type of a given topology object into a human-readable form. It differs from **hwloc\_obj\_type\_string()** because it prints type attributes such as cache depth.

If `size` is 0, `string` may safely be `NULL`.

**Returns:**

the number of character that were actually written if not truncating, or that would have been written (not including the ending \\0).

### const char\* hwloc\_obj\_type\_string (hwloc\_obj\_type\_ttype) const

Return a stringified topology object type.

## Author

Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.
