SBValueMap#

This class exposes bindings for the SAMSON SDK SBValueMap class that describes a value map. This is a convenience class that contains a map from string to samson.SBValue, and can be used, for example, to pass into a function a map of parameters, or another data.

class samson.SBValueMap(*args, **kwargs)#

Bases: pybind11_object

This class describes a value map.

This is a convenience class that contains a map from string to SBValue, and can be used, for example, to pass into a function a map of parameters, or another data.

SAMSON API: Introspection, SBCMetaValueMap, SBCMetaValue

Overloaded function.

  1. __init__(self: samson.SBValueMap) -> None

Creates an empty map.

  1. __init__(self: samson.SBValueMap, n: int) -> None

Creates a map and preallocates storage.

Parameters:

n (int) – Expected number of entries.

  1. __init__(self: samson.SBValueMap, valueMap: samson.SBValueMap) -> None

Copy constructor.

Parameters:

valueMap (samson.SBValueMap) – Source map.

at(self: samson.SBValueMap, key: str) samson.SBValue#

Returns value for key; raises KeyError if key is missing.

clear(self: samson.SBValueMap) None#

Removes all entries from the map.

contains(self: samson.SBValueMap, key: str) bool#

Returns whether key exists in the map.

erase(self: samson.SBValueMap, key: str) bool#

Erases an entry by key and returns whether erasure succeeded.

get(*args, **kwargs)#

Overloaded function.

  1. get(self: samson.SBValueMap, key: str) -> samson.SBValue

Returns value for key or empty SBValue if key is missing.

Parameters:

key (str) – Map key.

Returns:

Value associated with key, or empty value if not found.

Return type:

samson.SBValue

  1. get(self: samson.SBValueMap, key: str, default: object) -> object

Returns value for key or default if key is missing.

Parameters:
  • key (str) – Map key.

  • default (object) – Fallback value returned when key does not exist.

Returns:

Stored value converted to Python, or default.

Return type:

object

insert(self: samson.SBValueMap, key: str, value: samson.SBValue) bool#

Inserts key and value only if key is missing.

Returns:

True if a new entry was inserted, False if key already existed.

Return type:

bool

items(self: samson.SBValueMap) list[tuple[str, samson.SBValue]]#

Returns a snapshot list of (key, value) pairs.

keys(self: samson.SBValueMap) list[str]#

Returns a snapshot list of keys.

pop(self: samson.SBValueMap, key: str, default: object = None) object#

Removes and returns value for key.

If key is missing, returns default.

set(self: samson.SBValueMap, key: str, value: samson.SBValue) None#

Sets key to value, replacing existing value if needed.

Parameters:
swap(self: samson.SBValueMap, valueMap: samson.SBValueMap) None#

Swaps maps in O(1)

toDict(self: samson.SBValueMap) dict[str, samson.SBValue]#

Creates a Python dictionary snapshot from this value map.

update(self: samson.SBValueMap, dict: dict) None#

Updates map from a Python dictionary (str -> SBValue).

values(self: samson.SBValueMap) list[samson.SBValue]#

Returns a snapshot list of values.