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.util.datalog; 006 007/** Log array of double values. */ 008public class DoubleArrayLogEntry extends DataLogEntry { 009 /** The data type for double array values. */ 010 public static final String kDataType = "double[]"; 011 012 /** 013 * Constructs a double array log entry. 014 * 015 * @param log datalog 016 * @param name name of the entry 017 * @param metadata metadata 018 * @param timestamp entry creation timestamp (0=now) 019 */ 020 public DoubleArrayLogEntry(DataLog log, String name, String metadata, long timestamp) { 021 super(log, name, kDataType, metadata, timestamp); 022 } 023 024 /** 025 * Constructs a double array log entry. 026 * 027 * @param log datalog 028 * @param name name of the entry 029 * @param metadata metadata 030 */ 031 public DoubleArrayLogEntry(DataLog log, String name, String metadata) { 032 this(log, name, metadata, 0); 033 } 034 035 /** 036 * Constructs a double array log entry. 037 * 038 * @param log datalog 039 * @param name name of the entry 040 * @param timestamp entry creation timestamp (0=now) 041 */ 042 public DoubleArrayLogEntry(DataLog log, String name, long timestamp) { 043 this(log, name, "", timestamp); 044 } 045 046 /** 047 * Constructs a double array log entry. 048 * 049 * @param log datalog 050 * @param name name of the entry 051 */ 052 public DoubleArrayLogEntry(DataLog log, String name) { 053 this(log, name, 0); 054 } 055 056 /** 057 * Appends a record to the log. 058 * 059 * @param value Value to record 060 * @param timestamp Time stamp (0 to indicate now) 061 */ 062 public void append(double[] value, long timestamp) { 063 m_log.appendDoubleArray(m_entry, value, timestamp); 064 } 065 066 /** 067 * Appends a record to the log. 068 * 069 * @param value Value to record 070 */ 071 public void append(double[] value) { 072 m_log.appendDoubleArray(m_entry, value, 0); 073 } 074}