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