// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY

package org.wpilib.networktables;
{% if TypeName == "Raw" %}
import java.nio.ByteBuffer;
{% endif %}
/** NetworkTables {{ TypeName }} implementation. */
final class {{ TypeName }}EntryImpl extends EntryBase implements {{ TypeName }}Entry {
  /**
   * Constructor.
   *
   * @param topic Topic
   * @param handle Native handle
   * @param defaultValue Default value for get()
   */
  {{ TypeName }}EntryImpl({{ TypeName }}Topic topic, int handle, {{ java.ValueType }} defaultValue) {
    super(handle);
    m_topic = topic;
    m_defaultValue = defaultValue;
  }

  @Override
  public {{ TypeName }}Topic getTopic() {
    return m_topic;
  }

  @Override
  public {{ java.ValueType }} get() {
    return NetworkTablesJNI.get{{ TypeName }}(m_handle, m_defaultValue);
  }

  @Override
  public {{ java.ValueType }} get({{ java.ValueType }} defaultValue) {
    return NetworkTablesJNI.get{{TypeName}}(m_handle, defaultValue);
  }

  @Override
  public Timestamped{{ TypeName }} getAtomic() {
    return NetworkTablesJNI.getAtomic{{ TypeName }}(m_handle, m_defaultValue);
  }

  @Override
  public Timestamped{{ TypeName }} getAtomic({{ java.ValueType }} defaultValue) {
    return NetworkTablesJNI.getAtomic{{ TypeName }}(m_handle, defaultValue);
  }

  @Override
  public Timestamped{{ TypeName }}[] readQueue() {
    return NetworkTablesJNI.readQueue{{ TypeName }}(m_handle);
  }

  @Override
  public {{ java.ValueType }}[] readQueueValues() {
    return NetworkTablesJNI.readQueueValues{{ TypeName }}(m_handle);
  }
{% if TypeName == "Raw" %}
  @Override
  public void set(byte[] value, int start, int len, long time) {
    NetworkTablesJNI.setRaw(m_handle, time, value, start, len);
  }

  @Override
  public void set(ByteBuffer value, int start, int len, long time) {
    NetworkTablesJNI.setRaw(m_handle, time, value, start, len);
  }

  @Override
  public void setDefault(byte[] value, int start, int len) {
    NetworkTablesJNI.setDefaultRaw(m_handle, 0, value, start, len);
  }

  @Override
  public void setDefault(ByteBuffer value, int start, int len) {
    NetworkTablesJNI.setDefaultRaw(m_handle, 0, value, start, len);
  }
{% else %}
  @Override
  public void set({{ java.ValueType }} value, long time) {
    NetworkTablesJNI.set{{ TypeName }}(m_handle, time, value);
  }

  @Override
  public void setDefault({{ java.ValueType }} value) {
    NetworkTablesJNI.setDefault{{ TypeName }}(m_handle, 0, value);
  }
{% endif %}
  @Override
  public void unpublish() {
    NetworkTablesJNI.unpublish(m_handle);
  }

  private final {{ TypeName }}Topic m_topic;
  private final {{ java.ValueType }} m_defaultValue;
}

