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
- clearPersistent() None
Stop making value persistent through program restarts.
- 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.
- 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:
True if the entry did not already have a value, otherwise False
- setDefaultBooleanArray(defaultValue: List[int]) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultDouble(defaultValue: float) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultDoubleArray(defaultValue: List[float]) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultFloat(defaultValue: float) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultFloatArray(defaultValue: List[float]) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultInteger(defaultValue: int) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultIntegerArray(defaultValue: List[int]) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultRaw(defaultValue: Buffer) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultString(defaultValue: str) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultStringArray(defaultValue: List[str]) bool
Sets the entry’s value if it does not exist.
- Parameters:
defaultValue – the default value to set
- Returns:
True if the entry did not already have a value, otherwise False
- setDefaultValue(*args, **kwargs)
Overloaded function.
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:
True if the entry did not already have a value, otherwise False
setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, value: float) -> bool
setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, value: bool) -> bool
setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, value: bytes) -> bool
setDefaultValue(self: ntcore._ntcore.NetworkTableEntry, value: str) -> bool
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
- 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.
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
setValue(self: ntcore._ntcore.NetworkTableEntry, value: float) -> bool
setValue(self: ntcore._ntcore.NetworkTableEntry, value: bool) -> bool
setValue(self: ntcore._ntcore.NetworkTableEntry, value: bytes) -> bool
setValue(self: ntcore._ntcore.NetworkTableEntry, value: str) -> bool
setValue(self: ntcore._ntcore.NetworkTableEntry, value: Sequence) -> bool
- unpublish() None
Stops publishing the entry if it’s been published.
- property value