RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
TunableTable.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.tunable;
6
7import java.util.function.BooleanSupplier;
8import java.util.function.Consumer;
9import java.util.function.DoubleConsumer;
10import java.util.function.DoubleSupplier;
11import java.util.function.IntConsumer;
12import java.util.function.IntSupplier;
13import java.util.function.LongConsumer;
14import java.util.function.LongSupplier;
15import java.util.function.Supplier;
16import org.wpilib.tunable.util.PathUtil;
17import org.wpilib.util.function.BooleanConsumer;
18import org.wpilib.util.function.FloatConsumer;
19import org.wpilib.util.function.FloatSupplier;
20
29public final class TunableTable {
30 private final String m_path;
31
37 TunableTable(String path) {
38 m_path = path;
39 }
40
46 public String getPath() {
47 return m_path;
48 }
49
56 public TunableTable getTable(String name) {
57 return TunableRegistry.getTable(m_path + name + "/");
58 }
59
67 public boolean publish(String name, TunableBase tunable) {
68 return TunableRegistry.publish(PathUtil.normalizeName(m_path + name), tunable);
69 }
70
78 public boolean publish(String name, ComplexTunable tunable) {
79 return TunableRegistry.publish(PathUtil.normalizeName(m_path + name), tunable);
80 }
81
92 public <T> Tunable<T> publishValue(
93 String name, Supplier<T> getter, Consumer<T> setter, Class<T> cls) {
94 return publishValue(name, getter, setter, cls, null);
95 }
96
108 public <T> Tunable<T> publishValue(
109 String name, Supplier<T> getter, Consumer<T> setter, Class<T> cls, TunableConfig config) {
110 Tunable<T> tunable = Tunable.createConfig(getter, setter, cls, config);
111 publish(name, tunable);
112 return tunable;
113 }
114
124 String name, BooleanSupplier getter, BooleanConsumer setter) {
125 return publishBoolean(name, getter, setter, null);
126 }
127
138 String name, BooleanSupplier getter, BooleanConsumer setter, TunableConfig config) {
139 TunableBoolean tunable = TunableBoolean.createConfig(getter, setter, config);
140 publish(name, tunable);
141 return tunable;
142 }
143
152 public TunableInt publishInt(String name, IntSupplier getter, IntConsumer setter) {
153 return publishInt(name, getter, setter, null);
154 }
155
166 String name, IntSupplier getter, IntConsumer setter, TunableConfig config) {
167 TunableInt tunable = TunableInt.createConfig(getter, setter, config);
168 publish(name, tunable);
169 return tunable;
170 }
171
180 public TunableLong publishLong(String name, LongSupplier getter, LongConsumer setter) {
181 return publishLong(name, getter, setter, null);
182 }
183
194 String name, LongSupplier getter, LongConsumer setter, TunableConfig config) {
195 TunableLong tunable = TunableLong.createConfig(getter, setter, config);
196 publish(name, tunable);
197 return tunable;
198 }
199
208 public TunableFloat publishFloat(String name, FloatSupplier getter, FloatConsumer setter) {
209 return publishFloat(name, getter, setter, null);
210 }
211
222 String name, FloatSupplier getter, FloatConsumer setter, TunableConfig config) {
223 TunableFloat tunable = TunableFloat.createConfig(getter, setter, config);
224 publish(name, tunable);
225 return tunable;
226 }
227
236 public TunableDouble publishDouble(String name, DoubleSupplier getter, DoubleConsumer setter) {
237 return publishDouble(name, getter, setter, null);
238 }
239
250 String name, DoubleSupplier getter, DoubleConsumer setter, TunableConfig config) {
251 TunableDouble tunable = TunableDouble.createConfig(getter, setter, config);
252 publish(name, tunable);
253 return tunable;
254 }
255
261 public void remove(String name) {
263 }
264}
static TunableBoolean createConfig(TunableConfig config)
static TunableDouble createConfig(TunableConfig config)
static TunableFloat createConfig(TunableConfig config)
static TunableInt createConfig(TunableConfig config)
static TunableLong createConfig(TunableConfig config)
static boolean publish(String path, TunableBase tunable)
static TunableTable getTable(String path)
boolean publish(String name, TunableBase tunable)
TunableFloat publishFloat(String name, FloatSupplier getter, FloatConsumer setter, TunableConfig config)
boolean publish(String name, ComplexTunable tunable)
TunableDouble publishDouble(String name, DoubleSupplier getter, DoubleConsumer setter)
TunableBoolean publishBoolean(String name, BooleanSupplier getter, BooleanConsumer setter, TunableConfig config)
TunableTable getTable(String name)
TunableLong publishLong(String name, LongSupplier getter, LongConsumer setter, TunableConfig config)
TunableInt publishInt(String name, IntSupplier getter, IntConsumer setter, TunableConfig config)
TunableBoolean publishBoolean(String name, BooleanSupplier getter, BooleanConsumer setter)
TunableLong publishLong(String name, LongSupplier getter, LongConsumer setter)
TunableDouble publishDouble(String name, DoubleSupplier getter, DoubleConsumer setter, TunableConfig config)
TunableFloat publishFloat(String name, FloatSupplier getter, FloatConsumer setter)
TunableInt publishInt(String name, IntSupplier getter, IntConsumer setter)
static String normalizeName(String path)
Definition PathUtil.java:93