RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
FileLogger.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5package org.wpilib.datalog;
6
7import java.util.concurrent.atomic.AtomicLong;
8
13public class FileLogger implements AutoCloseable {
14 private final AtomicLong m_impl;
15
24 public FileLogger(String file, DataLog log, String key) {
25 m_impl = new AtomicLong(DataLogJNI.createFileLogger(file, log.getImpl(), key));
26 }
27
28 @Override
29 public void close() {
30 long impl = m_impl.getAndSet(0);
31 if (impl != 0) {
32 DataLogJNI.freeFileLogger(impl);
33 }
34 }
35}
FileLogger(String file, DataLog log, String key)