NetworkTableEntry

class ntcore.NetworkTableEntry

Bases: pybind11_object

NetworkTables Entry

Note

For backwards compatibility, the NetworkTableEntry destructor does not release the entry.

@ingroup ntcore_cpp_api

clear_persistent() None

Stop making value persistent through program restarts.

exists() bool

Determines if the entry currently exists.

Returns:

True if the entry exists, false otherwise.

get_boolean(default_value: object) object

Gets the entry’s value as a boolean. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

get_boolean_array(default_value: object) object

Gets the entry’s value as a boolean array. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

Note

This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

Note

The returned array is std::vector<int> instead of std::vector<bool> because std::vector<bool> is special-cased in C++. 0 is false, any non-zero value is true.

get_double(default_value: object) object

Gets the entry’s value as a double. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

get_double_array(default_value: object) object

Gets the entry’s value as a double array. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

Note

This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

get_float(default_value: object) object

Gets the entry’s value as a float. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

get_float_array(default_value: object) object

Gets the entry’s value as a float array. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

Note

This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

get_instance() ntcore._ntcore.NetworkTableInstance

Gets the instance for the entry.

Returns:

Instance

get_integer(default_value: object) object

Gets the entry’s value as a integer. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

get_integer_array(default_value: object) object

Gets the entry’s value as a integer array. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

Note

This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

get_last_change() int

Gets the last time the entry’s value was changed.

Returns:

Entry last change time

get_name() str

Gets the name of the entry (the key).

Returns:

the entry’s name

get_raw(default_value: object) object

Gets the entry’s value as a raw. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

get_string(default_value: object) object

Gets the entry’s value as a string. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

get_string_array(default_value: object) object

Gets the entry’s value as a string array. If the entry does not exist or is of different type, it will return the default value.

Parameters:

default_value – the value to be returned if no value is found

Returns:

the entry’s value or the given default value

Note

This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

get_topic() ntcore._ntcore.Topic

Gets the entry’s topic.

Returns:

Topic

get_type() ntcore._ntcore.NetworkTableType

Gets the type of the entry.

Returns:

the entry’s type

get_value() ntcore._ntcore.Value

Gets the entry’s value. If the entry does not exist, returns an empty value.

Returns:

the entry’s value or an empty value if it does not exist.

is_persistent() bool

Returns whether the value is persistent through program restarts.

Returns:

True if the value is persistent.

read_queue() list[ntcore._ntcore.Value]

Get an array of all value changes since the last call to ReadQueue.

The “poll storage” subscribe option can be used to set the queue depth.

Returns:

Array of values; empty array if no new changes have been published since the previous call.

set_boolean(value: bool, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_boolean_array(value: List[bool], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_default_boolean(default_value: bool) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_boolean_array(default_value: List[SupportsInt | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_double(default_value: SupportsFloat | SupportsIndex) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_double_array(default_value: List[SupportsFloat | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_float(default_value: SupportsFloat | SupportsIndex) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_float_array(default_value: List[SupportsFloat | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_integer(default_value: SupportsInt | SupportsIndex) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_integer_array(default_value: List[SupportsInt | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_raw(default_value: Buffer) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_string(default_value: str) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_string_array(default_value: List[str]) bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

set_default_value(*args, **kwargs)

Overloaded function.

  1. set_default_value(self: ntcore._ntcore.NetworkTableEntry, default_value: ntcore._ntcore.Value) -> bool

Sets the entry’s value if it does not exist.

Parameters:

default_value – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

  1. set_default_value(self: ntcore._ntcore.NetworkTableEntry, value: typing.SupportsFloat | typing.SupportsIndex) -> bool

  2. set_default_value(self: ntcore._ntcore.NetworkTableEntry, value: bool) -> bool

  3. set_default_value(self: ntcore._ntcore.NetworkTableEntry, value: bytes) -> bool

  4. set_default_value(self: ntcore._ntcore.NetworkTableEntry, value: str) -> bool

  5. set_default_value(self: ntcore._ntcore.NetworkTableEntry, value: collections.abc.Sequence) -> bool

set_double(value: SupportsFloat | SupportsIndex, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_double_array(value: List[SupportsFloat | SupportsIndex], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_float(value: SupportsFloat | SupportsIndex, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_float_array(value: List[SupportsFloat | SupportsIndex], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_integer(value: SupportsInt | SupportsIndex, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_integer_array(value: List[SupportsInt | SupportsIndex], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_persistent() None

Make value persistent through program restarts.

set_raw(value: Buffer, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_string(value: str, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_string_array(value: List[str], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

set_value(*args, **kwargs)

Overloaded function.

  1. set_value(self: ntcore._ntcore.NetworkTableEntry, value: ntcore._ntcore.Value) -> bool

Sets the entry’s value.

Parameters:

value – the value to set

Returns:

False if the entry exists with a different type

  1. set_value(self: ntcore._ntcore.NetworkTableEntry, value: typing.SupportsFloat | typing.SupportsIndex) -> bool

  2. set_value(self: ntcore._ntcore.NetworkTableEntry, value: bool) -> bool

  3. set_value(self: ntcore._ntcore.NetworkTableEntry, value: bytes) -> bool

  4. set_value(self: ntcore._ntcore.NetworkTableEntry, value: str) -> bool

  5. set_value(self: ntcore._ntcore.NetworkTableEntry, value: collections.abc.Sequence) -> bool

unpublish() None

Stops publishing the entry if it’s been published.

property value