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

class Flags(value: int)

Bases: pybind11_object

Flag values (as returned by GetFlags()).

Deprecated:

Use IsPersistent() instead.

Members:

kPersistent

kPersistent = <Flags.kPersistent: 1>
property name
property value
clearFlags(flags: int) None

Clears flags.

Deprecated:

Use SetPersistent() or topic properties instead

Parameters:

flags – the flags to clear (bitmask)

clearPersistent() None

Stop making value persistent through program restarts.

delete() None

Deletes the entry.

Deprecated:

Use Unpublish() instead.

exists() bool

Determines if the entry currently exists.

Returns:

True if the entry exists, false otherwise.

getBoolean(defaultValue: 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:

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

Returns:

the entry’s value or the given default value

getBooleanArray(defaultValue: 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:

defaultValue – 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.

getDouble(defaultValue: 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:

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

Returns:

the entry’s value or the given default value

getDoubleArray(defaultValue: 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:

defaultValue – 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.

getFlags() int

Returns the flags.

Deprecated:

Use IsPersistent() or topic properties instead

Returns:

the flags (bitmask)

getFloat(defaultValue: 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:

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

Returns:

the entry’s value or the given default value

getFloatArray(defaultValue: 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:

defaultValue – 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.

getInstance() ntcore._ntcore.NetworkTableInstance

Gets the instance for the entry.

Returns:

Instance

getInteger(defaultValue: 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:

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

Returns:

the entry’s value or the given default value

getIntegerArray(defaultValue: 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:

defaultValue – 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.

getLastChange() int

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

Returns:

Entry last change time

getName() str

Gets the name of the entry (the key).

Returns:

the entry’s name

getRaw(defaultValue: 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:

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

Returns:

the entry’s value or the given default value

getString(defaultValue: 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:

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

Returns:

the entry’s value or the given default value

getStringArray(defaultValue: 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:

defaultValue – 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.

getTopic() ntcore._ntcore.Topic

Gets the entry’s topic.

Returns:

Topic

getType() ntcore._ntcore.NetworkTableType

Gets the type of the entry.

Returns:

the entry’s type

getValue() 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.

isPersistent() bool

Returns whether the value is persistent through program restarts.

Returns:

True if the value is persistent.

readQueue() 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.

setBoolean(value: bool, time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setBooleanArray(value: List[bool], time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setDefaultBoolean(defaultValue: bool) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultBooleanArray(defaultValue: List[int]) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultDouble(defaultValue: float) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultDoubleArray(defaultValue: List[float]) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultFloat(defaultValue: float) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultFloatArray(defaultValue: List[float]) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultInteger(defaultValue: int) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultIntegerArray(defaultValue: List[int]) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultRaw(defaultValue: buffer) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultString(defaultValue: str) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultStringArray(defaultValue: List[str]) bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

setDefaultValue(*args, **kwargs)

Overloaded function.

  1. setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, defaultValue: ntcore._ntcore.Value) -> bool

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

Parameters:

defaultValue – the default value to set

Returns:

False if the entry exists with a different type

  1. setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, value: float) -> bool

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

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

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

  5. setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, value: sequence) -> bool

setDouble(value: float, time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setDoubleArray(value: List[float], time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setFlags(flags: int) None

Sets flags.

Deprecated:

Use SetPersistent() or topic properties instead

Parameters:

flags – the flags to set (bitmask)

setFloat(value: float, time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setFloatArray(value: List[float], time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setInteger(value: int, time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setIntegerArray(value: List[int], time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setPersistent() None

Make value persistent through program restarts.

setRaw(value: buffer, time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setString(value: str, time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setStringArray(value: List[str], time: int = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

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

Returns:

False if the entry exists with a different type

setValue(*args, **kwargs)

Overloaded function.

  1. setValue(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. setValue(self: ntcore._ntcore.NetworkTableEntry, value: float) -> bool

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

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

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

  5. setValue(self: ntcore._ntcore.NetworkTableEntry, value: sequence) -> bool

unpublish() None

Stops publishing the entry if it’s been published.

property value