001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
006
007package edu.wpi.first.networktables;
008
009import java.util.function.Supplier;
010
011/** NetworkTables generic subscriber. */
012@SuppressWarnings("PMD.MissingOverride")
013public interface GenericSubscriber extends Subscriber, Supplier<NetworkTableValue> {
014  /**
015   * Get the corresponding topic.
016   *
017   * @return Topic
018   */
019  @Override
020  Topic getTopic();
021
022  /**
023   * Get the last published value.
024   * If no value has been published, returns a value with type NetworkTableType.kUnassigned.
025   *
026   * @return value
027   */
028  NetworkTableValue get();
029
030  /**
031   * Gets the entry's value as a boolean. If the entry does not exist or is of different type, it
032   * will return the default value.
033   *
034   * @param defaultValue the value to be returned if no value is found
035   * @return the entry's value or the given default value
036   */
037  boolean getBoolean(boolean defaultValue);
038
039  /**
040   * Gets the entry's value as a long. If the entry does not exist or is of different type, it
041   * will return the default value.
042   *
043   * @param defaultValue the value to be returned if no value is found
044   * @return the entry's value or the given default value
045   */
046  long getInteger(long defaultValue);
047
048  /**
049   * Gets the entry's value as a float. If the entry does not exist or is of different type, it
050   * will return the default value.
051   *
052   * @param defaultValue the value to be returned if no value is found
053   * @return the entry's value or the given default value
054   */
055  float getFloat(float defaultValue);
056
057  /**
058   * Gets the entry's value as a double. If the entry does not exist or is of different type, it
059   * will return the default value.
060   *
061   * @param defaultValue the value to be returned if no value is found
062   * @return the entry's value or the given default value
063   */
064  double getDouble(double defaultValue);
065
066  /**
067   * Gets the entry's value as a String. If the entry does not exist or is of different type, it
068   * will return the default value.
069   *
070   * @param defaultValue the value to be returned if no value is found
071   * @return the entry's value or the given default value
072   */
073  String getString(String defaultValue);
074
075  /**
076   * Gets the entry's value as a byte[]. If the entry does not exist or is of different type, it
077   * will return the default value.
078   *
079   * @param defaultValue the value to be returned if no value is found
080   * @return the entry's value or the given default value
081   */
082  byte[] getRaw(byte[] defaultValue);
083
084  /**
085   * Gets the entry's value as a boolean[]. If the entry does not exist or is of different type, it
086   * will return the default value.
087   *
088   * @param defaultValue the value to be returned if no value is found
089   * @return the entry's value or the given default value
090   */
091  boolean[] getBooleanArray(boolean[] defaultValue);
092
093  /**
094   * Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
095   * it will return the default value.
096   *
097   * @param defaultValue the value to be returned if no value is found
098   * @return the entry's value or the given default value
099   */
100  Boolean[] getBooleanArray(Boolean[] defaultValue);
101
102  /**
103   * Gets the entry's value as a long[]. If the entry does not exist or is of different type, it
104   * will return the default value.
105   *
106   * @param defaultValue the value to be returned if no value is found
107   * @return the entry's value or the given default value
108   */
109  long[] getIntegerArray(long[] defaultValue);
110
111  /**
112   * Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
113   * it will return the default value.
114   *
115   * @param defaultValue the value to be returned if no value is found
116   * @return the entry's value or the given default value
117   */
118  Long[] getIntegerArray(Long[] defaultValue);
119
120  /**
121   * Gets the entry's value as a float[]. If the entry does not exist or is of different type, it
122   * will return the default value.
123   *
124   * @param defaultValue the value to be returned if no value is found
125   * @return the entry's value or the given default value
126   */
127  float[] getFloatArray(float[] defaultValue);
128
129  /**
130   * Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
131   * it will return the default value.
132   *
133   * @param defaultValue the value to be returned if no value is found
134   * @return the entry's value or the given default value
135   */
136  Float[] getFloatArray(Float[] defaultValue);
137
138  /**
139   * Gets the entry's value as a double[]. If the entry does not exist or is of different type, it
140   * will return the default value.
141   *
142   * @param defaultValue the value to be returned if no value is found
143   * @return the entry's value or the given default value
144   */
145  double[] getDoubleArray(double[] defaultValue);
146
147  /**
148   * Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
149   * it will return the default value.
150   *
151   * @param defaultValue the value to be returned if no value is found
152   * @return the entry's value or the given default value
153   */
154  Double[] getDoubleArray(Double[] defaultValue);
155
156  /**
157   * Gets the entry's value as a String[]. If the entry does not exist or is of different type, it
158   * will return the default value.
159   *
160   * @param defaultValue the value to be returned if no value is found
161   * @return the entry's value or the given default value
162   */
163  String[] getStringArray(String[] defaultValue);
164
165  /**
166   * Get an array of all value changes since the last call to readQueue.
167   * Also provides a timestamp for each value.
168   *
169   * <p>The "poll storage" subscribe option can be used to set the queue
170   * depth.
171   *
172   * @return Array of timestamped values; empty array if no new changes have
173   *     been published since the previous call.
174   */
175  NetworkTableValue[] readQueue();
176}