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
005package edu.wpi.first.networktables;
006
007import java.util.function.Consumer;
008
009/** NetworkTables StringArray publisher. */
010public interface StringArrayPublisher extends Publisher, Consumer<String[]> {
011  /**
012   * Get the corresponding topic.
013   *
014   * @return Topic
015   */
016  @Override
017  StringArrayTopic getTopic();
018
019  /**
020   * Publish a new value using current NT time.
021   *
022   * @param value value to publish
023   */
024  default void set(String[] value) {
025    set(value, 0);
026  }
027
028  /**
029   * Publish a new value.
030   *
031   * @param value value to publish
032   * @param time timestamp; 0 indicates current NT time should be used
033   */
034  void set(String[] value, long time);
035
036  /**
037   * Publish a default value.
038   * On reconnect, a default value will never be used in preference to a
039   * published value.
040   *
041   * @param value value
042   */
043  void setDefault(String[] value);
044
045  @Override
046  default void accept(String[] value) {
047    set(value);
048  }
049}