mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[ntcore] Rename constants to all caps style (#8676)
This commit is contained in:
@@ -67,30 +67,30 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
long time = value.getTime();
|
||||
Object otherValue = value.getValue();
|
||||
switch (value.getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
@@ -220,30 +220,30 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
long time = defaultValue.getTime();
|
||||
Object otherValue = defaultValue.getValue();
|
||||
switch (defaultValue.getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -222,30 +222,30 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
long time = ((NetworkTableValue) defaultValue).getTime();
|
||||
Object otherValue = ((NetworkTableValue) defaultValue).getValue();
|
||||
switch (((NetworkTableValue) defaultValue).getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
@@ -375,30 +375,30 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
long time = ((NetworkTableValue) value).getTime();
|
||||
Object otherValue = ((NetworkTableValue) value).getValue();
|
||||
switch (((NetworkTableValue) value).getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -47,16 +47,16 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
/** Client/server mode flag values (as returned by {@link #getNetworkMode()}). */
|
||||
public enum NetworkMode {
|
||||
/** Running in server mode. */
|
||||
kServer(0x01),
|
||||
SERVER(0x01),
|
||||
|
||||
/** Running in client mode. */
|
||||
kClient(0x04),
|
||||
CLIENT(0x04),
|
||||
|
||||
/** Currently starting up (either client or server). */
|
||||
kStarting(0x08),
|
||||
STARTING(0x08),
|
||||
|
||||
/** Running in local-only mode. */
|
||||
kLocal(0x10);
|
||||
LOCAL(0x10);
|
||||
|
||||
private final int value;
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
}
|
||||
|
||||
/** The default port that network tables operates on. */
|
||||
public static final int kDefaultPort = 5810;
|
||||
public static final int DEFAULT_PORT = 5810;
|
||||
|
||||
/**
|
||||
* Construct from native handle.
|
||||
@@ -709,9 +709,9 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
*/
|
||||
public int addConnectionListener(
|
||||
boolean immediateNotify, Consumer<NetworkTableEvent> listener) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kConnection);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.CONNECTION);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return m_listeners.add(m_handle, eventKinds, listener);
|
||||
}
|
||||
@@ -727,9 +727,9 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
*/
|
||||
public int addTimeSyncListener(
|
||||
boolean immediateNotify, Consumer<NetworkTableEvent> listener) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kTimeSync);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.TIME_SYNC);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return m_listeners.add(m_handle, eventKinds, listener);
|
||||
}
|
||||
@@ -913,7 +913,7 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
* @param mdnsService the mDNS service name to advertise, or empty to not advertise
|
||||
*/
|
||||
public void startServer(String persistFilename, String listenAddress, String mdnsService) {
|
||||
startServer(persistFilename, listenAddress, mdnsService, kDefaultPort);
|
||||
startServer(persistFilename, listenAddress, mdnsService, DEFAULT_PORT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value contains a value.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_type != NetworkTableType.kUnassigned;
|
||||
return m_type != NetworkTableType.UNASSIGNED;
|
||||
}
|
||||
{% for t in types %}
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of {{ t.java.ValueType }} type.
|
||||
*/
|
||||
public boolean is{{ t.TypeName }}() {
|
||||
return m_type == NetworkTableType.k{{ t.TypeName }};
|
||||
return m_type == NetworkTableType.{{ t.TYPE_NAME }};
|
||||
}
|
||||
{% endfor %}
|
||||
/*
|
||||
@@ -99,7 +99,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of {{ t.java.ValueType }} type.
|
||||
*/
|
||||
public {{ t.java.ValueType }} get{{ t.TypeName }}() {
|
||||
if (m_type != NetworkTableType.k{{ t.TypeName }}) {
|
||||
if (m_type != NetworkTableType.{{ t.TYPE_NAME }}) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to {{ t.java.ValueType }}");
|
||||
}
|
||||
return {{ t.java.FromStorageBegin }}m_value{{ t.java.FromStorageEnd }};
|
||||
@@ -116,7 +116,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.ValueType }} value) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, {{ t.java.ToWrapObject }}(value));
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, {{ t.java.ToWrapObject }}(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.ValueType }} value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, {{ t.java.ToWrapObject }}(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, {{ t.java.ToWrapObject }}(value), time);
|
||||
}
|
||||
{% if t.java.WrapValueType %}
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.WrapValueType }} value) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, toNative{{ t.TypeName }}(value));
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, toNative{{ t.TypeName }}(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.WrapValueType }} value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, toNative{{ t.TypeName }}(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, toNative{{ t.TypeName }}(value), time);
|
||||
}
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.wpilib.networktables;
|
||||
public final class {{ TypeName }}Topic extends Topic {
|
||||
{%- if TypeString %}
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = {{ TypeString }};
|
||||
public static final String TYPE_STRING = {{ TypeString }};
|
||||
{% endif %}
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -58,7 +58,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
{{ TypeString|default('typeString') }}, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
{{ TypeString|default('typeString') }}, options),
|
||||
{{ java.EmptyValue }});
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
typeString, properties, options),
|
||||
{{ java.EmptyValue }});
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
{{ TypeString|default('typeString') }}, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
using TimestampedValueType = Timestamped{{ TypeName }};
|
||||
{%- if TypeString %}
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = {{ TypeString }};
|
||||
static constexpr std::string_view TYPE_STRING = {{ TypeString }};
|
||||
{%- endif %}
|
||||
|
||||
{{ TypeName }}Topic() = default;
|
||||
@@ -344,9 +344,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
{% if not TypeString %}std::string_view typeString, {% endif %}ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Subscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
defaultValue};
|
||||
}
|
||||
{%- if TypeString %}
|
||||
@@ -369,9 +369,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Subscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ TYPE_NAME }}, typeString, options),
|
||||
defaultValue};
|
||||
}
|
||||
{% endif %}
|
||||
@@ -394,9 +394,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish({% if not TypeString %}std::string_view typeString, {% endif %}const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish({% if not TypeString %}std::string_view typeString, {% endif %}const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Publisher{
|
||||
::wpi::nt::Publish(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options)};
|
||||
::wpi::nt::Publish(m_handle, NT_{{ TYPE_NAME }}, {{ TypeString|default('typeString') }}, options)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,9 +419,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Publisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, properties, options)};
|
||||
::wpi::nt::PublishEx(m_handle, NT_{{ TYPE_NAME }}, typeString, properties, options)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,9 +449,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry({% if not TypeString %}std::string_view typeString, {% endif %}ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Entry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
defaultValue};
|
||||
}
|
||||
{%- if TypeString %}
|
||||
@@ -478,9 +478,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Entry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ TYPE_NAME }}, typeString, options),
|
||||
defaultValue};
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[
|
||||
{
|
||||
"TypeName": "Boolean",
|
||||
"TYPE_NAME": "BOOLEAN",
|
||||
"TypeString": "\"boolean\"",
|
||||
"c": {
|
||||
"ValueType": "NT_Bool",
|
||||
@@ -9,8 +10,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "bool",
|
||||
"ParamType": "bool",
|
||||
"TemplateType": "bool",
|
||||
"TYPE_NAME": "BOOLEAN"
|
||||
"TemplateType": "bool"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "boolean",
|
||||
@@ -33,6 +33,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Integer",
|
||||
"TYPE_NAME": "INTEGER",
|
||||
"TypeString": "\"int\"",
|
||||
"c": {
|
||||
"ValueType": "int64_t",
|
||||
@@ -41,8 +42,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "int64_t",
|
||||
"ParamType": "int64_t",
|
||||
"TemplateType": "int64_t",
|
||||
"TYPE_NAME": "INTEGER"
|
||||
"TemplateType": "int64_t"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "long",
|
||||
@@ -65,6 +65,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Float",
|
||||
"TYPE_NAME": "FLOAT",
|
||||
"TypeString": "\"float\"",
|
||||
"c": {
|
||||
"ValueType": "float",
|
||||
@@ -73,8 +74,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "float",
|
||||
"ParamType": "float",
|
||||
"TemplateType": "float",
|
||||
"TYPE_NAME": "FLOAT"
|
||||
"TemplateType": "float"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "float",
|
||||
@@ -99,6 +99,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Double",
|
||||
"TYPE_NAME": "DOUBLE",
|
||||
"TypeString": "\"double\"",
|
||||
"c": {
|
||||
"ValueType": "double",
|
||||
@@ -107,8 +108,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "double",
|
||||
"ParamType": "double",
|
||||
"TemplateType": "double",
|
||||
"TYPE_NAME": "DOUBLE"
|
||||
"TemplateType": "double"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "double",
|
||||
@@ -131,6 +131,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "String",
|
||||
"TYPE_NAME": "STRING",
|
||||
"TypeString": "\"string\"",
|
||||
"c": {
|
||||
"ValueType": "struct WPI_String*",
|
||||
@@ -141,7 +142,6 @@
|
||||
"ValueType": "std::string",
|
||||
"ParamType": "std::string_view",
|
||||
"TemplateType": "std::string",
|
||||
"TYPE_NAME": "STRING",
|
||||
"INCLUDES": "#include <string>\n#include <string_view>\n#include <utility>",
|
||||
"SmallRetType": "std::string_view",
|
||||
"SmallElemType": "char"
|
||||
@@ -165,6 +165,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Raw",
|
||||
"TYPE_NAME": "RAW",
|
||||
"c": {
|
||||
"ValueType": "uint8_t*",
|
||||
"ParamType": "const uint8_t*",
|
||||
@@ -175,7 +176,6 @@
|
||||
"ParamType": "std::span<const uint8_t>",
|
||||
"TemplateType": "uint8_t[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "RAW",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<uint8_t>",
|
||||
"SmallElemType": "uint8_t"
|
||||
@@ -199,6 +199,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "BooleanArray",
|
||||
"TYPE_NAME": "BOOLEAN_ARRAY",
|
||||
"TypeString": "\"boolean[]\"",
|
||||
"c": {
|
||||
"ValueType": "NT_Bool*",
|
||||
@@ -210,7 +211,6 @@
|
||||
"ParamType": "std::span<const int>",
|
||||
"TemplateType": "bool[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "BOOLEAN_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<int>",
|
||||
"SmallElemType": "int"
|
||||
@@ -235,6 +235,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "IntegerArray",
|
||||
"TYPE_NAME": "INTEGER_ARRAY",
|
||||
"TypeString": "\"int[]\"",
|
||||
"c": {
|
||||
"ValueType": "int64_t*",
|
||||
@@ -246,7 +247,6 @@
|
||||
"ParamType": "std::span<const int64_t>",
|
||||
"TemplateType": "int64_t[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "INTEGER_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<int64_t>",
|
||||
"SmallElemType": "int64_t"
|
||||
@@ -271,6 +271,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "FloatArray",
|
||||
"TYPE_NAME": "FLOAT_ARRAY",
|
||||
"TypeString": "\"float[]\"",
|
||||
"c": {
|
||||
"ValueType": "float*",
|
||||
@@ -282,7 +283,6 @@
|
||||
"ParamType": "std::span<const float>",
|
||||
"TemplateType": "float[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "FLOAT_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<float>",
|
||||
"SmallElemType": "float"
|
||||
@@ -307,6 +307,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "DoubleArray",
|
||||
"TYPE_NAME": "DOUBLE_ARRAY",
|
||||
"TypeString": "\"double[]\"",
|
||||
"c": {
|
||||
"ValueType": "double*",
|
||||
@@ -318,7 +319,6 @@
|
||||
"ParamType": "std::span<const double>",
|
||||
"TemplateType": "double[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "DOUBLE_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<double>",
|
||||
"SmallElemType": "double"
|
||||
@@ -343,6 +343,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "StringArray",
|
||||
"TYPE_NAME": "STRING_ARRAY",
|
||||
"TypeString": "\"string[]\"",
|
||||
"c": {
|
||||
"ValueType": "struct WPI_String*",
|
||||
@@ -354,7 +355,6 @@
|
||||
"ParamType": "std::span<const std::string>",
|
||||
"TemplateType": "std::string[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "STRING_ARRAY",
|
||||
"INCLUDES": "#include <utility>"
|
||||
},
|
||||
"java": {
|
||||
|
||||
Reference in New Issue
Block a user