Value

class ntcore.Value

Bases: pybind11_object

A network table entry value. @ingroup ntcore_cpp_api

get_boolean() bool

Get the entry’s boolean value.

Returns:

The boolean value.

get_boolean_array() object

Get the entry’s boolean array value.

Returns:

The boolean array value.

get_double() float

Get the entry’s double value.

Returns:

The double value.

get_double_array() List[float]

Get the entry’s double array value.

Returns:

The double array value.

static get_factory_by_type(type: ntcore._ntcore.NetworkTableType) collections.abc.Callable
get_float() float

Get the entry’s float value.

Returns:

The float value.

get_float_array() List[float]

Get the entry’s float array value.

Returns:

The float array value.

get_integer() int

Get the entry’s integer value.

Returns:

The integer value.

get_integer_array() List[int]

Get the entry’s integer array value.

Returns:

The integer array value.

get_raw() Buffer

Get the entry’s raw value.

Returns:

The raw value.

get_string() str

Get the entry’s string value.

Returns:

The string value.

get_string_array() List[str]

Get the entry’s string array value.

Returns:

The string array value.

is_boolean() bool

Determine if entry value contains a boolean.

Returns:

True if the entry value is of boolean type.

is_boolean_array() bool

Determine if entry value contains a boolean array.

Returns:

True if the entry value is of boolean array type.

is_double() bool

Determine if entry value contains a double.

Returns:

True if the entry value is of double type.

is_double_array() bool

Determine if entry value contains a double array.

Returns:

True if the entry value is of double array type.

is_float() bool

Determine if entry value contains a float.

Returns:

True if the entry value is of float type.

is_float_array() bool

Determine if entry value contains a float array.

Returns:

True if the entry value is of float array type.

is_integer() bool

Determine if entry value contains an integer.

Returns:

True if the entry value is of integer type.

is_integer_array() bool

Determine if entry value contains an integer array.

Returns:

True if the entry value is of integer array type.

is_raw() bool

Determine if entry value contains a raw.

Returns:

True if the entry value is of raw type.

is_string() bool

Determine if entry value contains a string.

Returns:

True if the entry value is of string type.

is_string_array() bool

Determine if entry value contains a string array.

Returns:

True if the entry value is of string array type.

is_valid() bool

Determine if entry value contains a value or is unassigned.

Returns:

True if the entry value contains a value.

last_change() int

Get the creation time of the value, in local time.

Returns:

The time, in the units returned by wpi::nt::Now().

static make_boolean(value: bool, time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a boolean entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_boolean_array(value: List[bool], time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a boolean array entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_double(value: SupportsFloat | SupportsIndex, time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a double entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_double_array(value: collections.abc.Sequence[SupportsFloat | SupportsIndex], time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a double array entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

Note

This function moves the values out of the vector.

static make_float(value: SupportsFloat | SupportsIndex, time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a float entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_float_array(value: collections.abc.Sequence[SupportsFloat | SupportsIndex], time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a float array entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

Note

This function moves the values out of the vector.

static make_integer(value: SupportsInt | SupportsIndex, time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates an integer entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_integer_array(value: collections.abc.Sequence[SupportsInt | SupportsIndex], time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates an integer array entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

Note

This function moves the values out of the vector.

static make_raw(value: Buffer, time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a raw entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_string(value: str, time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a string entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

static make_string_array(value: collections.abc.Sequence[str], time: SupportsInt | SupportsIndex = 0) ntcore._ntcore.Value

Creates a string array entry value.

Parameters:
  • value – the value

  • time – if nonzero, the creation time to use (instead of the current time)

Returns:

The entry value

Note

This function moves the values out of the vector.

static make_value(value: object) ntcore._ntcore.Value
server_time() int

Get the creation time of the value, in server time.

Returns:

The server time.

set_server_time(time: SupportsInt | SupportsIndex) None

Set the creation time of the value, in server time.

Parameters:

time – The server time.

set_time(time: SupportsInt | SupportsIndex) None

Set the local creation time of the value.

Parameters:

time – The time.

size() int

Get the approximate in-memory size of the value in bytes. This is zero for values that do not require additional memory beyond the memory of the Value itself.

Returns:

The size in bytes.

time() int

Get the creation time of the value, in local time.

Returns:

The time, in the units returned by wpi::nt::Now().

type() ntcore._ntcore.NetworkTableType

Get the data type.

Returns:

The type.

value() object

Get the data value stored.

Returns:

The type.