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
009/** NetworkTables BooleanArray topic. */
010public final class BooleanArrayTopic extends Topic {
011  /** The default type string for this topic type. */
012  public static final String kTypeString = "boolean[]";
013
014  /**
015   * Construct from a generic topic.
016   *
017   * @param topic Topic
018   */
019  public BooleanArrayTopic(Topic topic) {
020    super(topic.m_inst, topic.m_handle);
021  }
022
023  /**
024   * Constructor; use NetworkTableInstance.getBooleanArrayTopic() instead.
025   *
026   * @param inst Instance
027   * @param handle Native handle
028   */
029  public BooleanArrayTopic(NetworkTableInstance inst, int handle) {
030    super(inst, handle);
031  }
032
033  /**
034   * Create a new subscriber to the topic.
035   *
036   * <p>The subscriber is only active as long as the returned object
037   * is not closed.
038   *
039   * <p>Subscribers that do not match the published data type do not return
040   * any values. To determine if the data type matches, use the appropriate
041   * Topic functions.
042   *
043   * @param defaultValue default value used when a default is not provided to a
044   *        getter function
045   * @param options subscribe options
046   * @return subscriber
047   */
048  public BooleanArraySubscriber subscribe(
049      boolean[] defaultValue,
050      PubSubOption... options) {
051    return new BooleanArrayEntryImpl(
052        this,
053        NetworkTablesJNI.subscribe(
054            m_handle, NetworkTableType.kBooleanArray.getValue(),
055            "boolean[]", options),
056        defaultValue);
057  }
058
059  /**
060   * Create a new subscriber to the topic, with specified type string.
061   *
062   * <p>The subscriber is only active as long as the returned object
063   * is not closed.
064   *
065   * <p>Subscribers that do not match the published data type do not return
066   * any values. To determine if the data type matches, use the appropriate
067   * Topic functions.
068   *
069   * @param typeString type string
070   * @param defaultValue default value used when a default is not provided to a
071   *        getter function
072   * @param options subscribe options
073   * @return subscriber
074   */
075  public BooleanArraySubscriber subscribeEx(
076      String typeString,
077      boolean[] defaultValue,
078      PubSubOption... options) {
079    return new BooleanArrayEntryImpl(
080        this,
081        NetworkTablesJNI.subscribe(
082            m_handle, NetworkTableType.kBooleanArray.getValue(),
083            typeString, options),
084        defaultValue);
085  }
086
087  /**
088   * Create a new publisher to the topic.
089   *
090   * <p>The publisher is only active as long as the returned object
091   * is not closed.
092   *
093   * <p>It is not possible to publish two different data types to the same
094   * topic. Conflicts between publishers are typically resolved by the server on
095   * a first-come, first-served basis. Any published values that do not match
096   * the topic's data type are dropped (ignored). To determine if the data type
097   * matches, use the appropriate Topic functions.
098   *
099   * @param options publish options
100   * @return publisher
101   */
102  public BooleanArrayPublisher publish(
103      PubSubOption... options) {
104    return new BooleanArrayEntryImpl(
105        this,
106        NetworkTablesJNI.publish(
107            m_handle, NetworkTableType.kBooleanArray.getValue(),
108            "boolean[]", options),
109        new boolean[] {});
110  }
111
112  /**
113   * Create a new publisher to the topic, with type string and initial properties.
114   *
115   * <p>The publisher is only active as long as the returned object
116   * is not closed.
117   *
118   * <p>It is not possible to publish two different data types to the same
119   * topic. Conflicts between publishers are typically resolved by the server on
120   * a first-come, first-served basis. Any published values that do not match
121   * the topic's data type are dropped (ignored). To determine if the data type
122   * matches, use the appropriate Topic functions.
123   *
124   * @param typeString type string
125   * @param properties JSON properties
126   * @param options publish options
127   * @return publisher
128   * @throws IllegalArgumentException if properties is not a JSON object
129   */
130  public BooleanArrayPublisher publishEx(
131      String typeString,
132      String properties,
133      PubSubOption... options) {
134    return new BooleanArrayEntryImpl(
135        this,
136        NetworkTablesJNI.publishEx(
137            m_handle, NetworkTableType.kBooleanArray.getValue(),
138            typeString, properties, options),
139        new boolean[] {});
140  }
141
142  /**
143   * Create a new entry for the topic.
144   *
145   * <p>Entries act as a combination of a subscriber and a weak publisher. The
146   * subscriber is active as long as the entry is not closed. The publisher is
147   * created when the entry is first written to, and remains active until either
148   * unpublish() is called or the entry is closed.
149   *
150   * <p>It is not possible to use two different data types with the same
151   * topic. Conflicts between publishers are typically resolved by the server on
152   * a first-come, first-served basis. Any published values that do not match
153   * the topic's data type are dropped (ignored), and the entry will show no new
154   * values if the data type does not match. To determine if the data type
155   * matches, use the appropriate Topic functions.
156   *
157   * @param defaultValue default value used when a default is not provided to a
158   *        getter function
159   * @param options publish and/or subscribe options
160   * @return entry
161   */
162  public BooleanArrayEntry getEntry(
163      boolean[] defaultValue,
164      PubSubOption... options) {
165    return new BooleanArrayEntryImpl(
166        this,
167        NetworkTablesJNI.getEntry(
168            m_handle, NetworkTableType.kBooleanArray.getValue(),
169            "boolean[]", options),
170        defaultValue);
171  }
172
173  /**
174   * Create a new entry for the topic, with specified type string.
175   *
176   * <p>Entries act as a combination of a subscriber and a weak publisher. The
177   * subscriber is active as long as the entry is not closed. The publisher is
178   * created when the entry is first written to, and remains active until either
179   * unpublish() is called or the entry is closed.
180   *
181   * <p>It is not possible to use two different data types with the same
182   * topic. Conflicts between publishers are typically resolved by the server on
183   * a first-come, first-served basis. Any published values that do not match
184   * the topic's data type are dropped (ignored), and the entry will show no new
185   * values if the data type does not match. To determine if the data type
186   * matches, use the appropriate Topic functions.
187   *
188   * @param typeString type string
189   * @param defaultValue default value used when a default is not provided to a
190   *        getter function
191   * @param options publish and/or subscribe options
192   * @return entry
193   */
194  public BooleanArrayEntry getEntryEx(
195      String typeString,
196      boolean[] defaultValue,
197      PubSubOption... options) {
198    return new BooleanArrayEntryImpl(
199        this,
200        NetworkTablesJNI.getEntry(
201            m_handle, NetworkTableType.kBooleanArray.getValue(),
202            typeString, options),
203        defaultValue);
204  }
205
206}