Class StructArrayTopic<T>
- Type Parameters:
T
- value class
public final class StructArrayTopic<T> extends Topic
-
Field Summary
-
Method Summary
Modifier and Type Method Description boolean
equals(Object other)
StructArrayEntry<T>
getEntry(T[] defaultValue, PubSubOption... options)
Create a new entry for the topic.Struct<T>
getStruct()
Returns the struct.int
hashCode()
StructArrayPublisher<T>
publish(PubSubOption... options)
Create a new publisher to the topic.StructArrayPublisher<T>
publishEx(String properties, PubSubOption... options)
Create a new publisher to the topic, with type string and initial properties.StructArraySubscriber<T>
subscribe(T[] defaultValue, PubSubOption... options)
Create a new subscriber to the topic.static <T> StructArrayTopic<T>
wrap(NetworkTableInstance inst, int handle, Struct<T> struct)
Create a StructArrayTopic from a native handle; generally NetworkTableInstance.getStructArrayTopic() should be used instead.static <T> StructArrayTopic<T>
wrap(Topic topic, Struct<T> struct)
Create a StructArrayTopic from a generic topic.Methods inherited from class edu.wpi.first.networktables.Topic
deleteProperty, exists, genericPublish, genericPublishEx, genericSubscribe, genericSubscribe, getGenericEntry, getGenericEntry, getHandle, getInfo, getInstance, getName, getProperties, getProperty, getType, getTypeString, isCached, isPersistent, isRetained, isValid, setCached, setPersistent, setProperties, setProperty, setRetained
-
Method Details
-
wrap
Create a StructArrayTopic from a generic topic.- Type Parameters:
T
- value class (inferred from struct)- Parameters:
topic
- generic topicstruct
- struct serialization implementation- Returns:
- StructArrayTopic for value class
-
wrap
public static <T> StructArrayTopic<T> wrap(NetworkTableInstance inst, int handle, Struct<T> struct)Create a StructArrayTopic from a native handle; generally NetworkTableInstance.getStructArrayTopic() should be used instead.- Type Parameters:
T
- value class (inferred from struct)- Parameters:
inst
- Instancehandle
- Native handlestruct
- struct serialization implementation- Returns:
- StructArrayTopic for value class
-
subscribe
Create a new subscriber to the topic.The subscriber is only active as long as the returned object is not closed.
Subscribers that do not match the published data type do not return any values. To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
defaultValue
- default value used when a default is not provided to a getter functionoptions
- subscribe options- Returns:
- subscriber
-
publish
Create a new publisher to the topic.The publisher is only active as long as the returned object is not closed.
It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
options
- publish options- Returns:
- publisher
-
publishEx
Create a new publisher to the topic, with type string and initial properties.The publisher is only active as long as the returned object is not closed.
It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
properties
- JSON propertiesoptions
- publish options- Returns:
- publisher
- Throws:
IllegalArgumentException
- if properties is not a JSON object
-
getEntry
Create a new entry for the topic.Entries act as a combination of a subscriber and a weak publisher. The subscriber is active as long as the entry is not closed. The publisher is created when the entry is first written to, and remains active until either unpublish() is called or the entry is closed.
It is not possible to use two different data types with the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored), and the entry will show no new values if the data type does not match. To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
defaultValue
- default value used when a default is not provided to a getter functionoptions
- publish and/or subscribe options- Returns:
- entry
-
getStruct
Returns the struct.- Returns:
- The struct.
-
equals
-
hashCode
-