RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
MathSharedStore.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.math.util;
6
7import org.wpilib.util.WPIUtilJNI;
8
10public final class MathSharedStore {
11 private static MathShared mathShared;
12
13 private MathSharedStore() {}
14
20 public static synchronized MathShared getMathShared() {
21 if (mathShared == null) {
22 mathShared =
23 new MathShared() {
24 @Override
25 public void reportError(String error, StackTraceElement[] stackTrace) {}
26
27 @Override
28 public double getTimestamp() {
29 return WPIUtilJNI.now() * 1.0e-9;
30 }
31 };
32 }
33 return mathShared;
34 }
35
41 public static synchronized void setMathShared(MathShared shared) {
42 mathShared = shared;
43 }
44
51 public static void reportError(String error, StackTraceElement[] stackTrace) {
52 getMathShared().reportError(error, stackTrace);
53 }
54
60 public static double getTimestamp() {
61 return getMathShared().getTimestamp();
62 }
63}
static void reportError(String error, StackTraceElement[] stackTrace)
static synchronized MathShared getMathShared()
static synchronized void setMathShared(MathShared shared)
void reportError(String error, StackTraceElement[] stackTrace)