SCRIPT namespace replacements

This commit is contained in:
PJ Reiniger
2025-11-07 20:00:05 -05:00
committed by Peter Johnson
parent ae6c043632
commit 9aca8e0fd6
2622 changed files with 22275 additions and 22275 deletions

View File

@@ -11,7 +11,7 @@
#include "org_wpilib_networktables_NetworkTablesJNI.h"
#include "wpi/nt/ntcore.h"
using namespace wpi::java;
using namespace wpi::util::java;
//
// Globals and load/unload
@@ -45,7 +45,7 @@ static const JExceptionInit exceptions[] = {
{"java/lang/NullPointerException", &nullPointerEx},
};
namespace nt {
namespace wpi::nt {
bool JNI_LoadTypes(JNIEnv* env) {
// Cache references to classes
@@ -76,7 +76,7 @@ void JNI_UnloadTypes(JNIEnv* env) {
}
}
} // namespace nt
} // namespace wpi::nt
static std::vector<int> FromJavaBooleanArray(JNIEnv* env, jbooleanArray jarr) {
CriticalJSpan<const jboolean> ref{env, jarr};
@@ -109,7 +109,7 @@ static std::vector<std::string> FromJavaStringArray(JNIEnv* env, jobjectArray ja
}
{% for t in types %}
static jobject MakeJObject(JNIEnv* env, nt::Timestamped{{ t.TypeName }} value) {
static jobject MakeJObject(JNIEnv* env, wpi::nt::Timestamped{{ t.TypeName }} value) {
static jmethodID constructor = env->GetMethodID(
timestamped{{ t.TypeName }}Cls, "<init>", "(JJ{{ t.jni.jtypestr }})V");
{%- if t.jni.JavaObject %}
@@ -127,7 +127,7 @@ static jobject MakeJObject(JNIEnv* env, nt::Timestamped{{ t.TypeName }} value) {
{% endfor %}
{%- for t in types %}
static jobjectArray MakeJObject(JNIEnv* env,
std::span<const nt::Timestamped{{ t.TypeName }}> arr) {
std::span<const wpi::nt::Timestamped{{ t.TypeName }}> arr) {
jobjectArray jarr =
env->NewObjectArray(arr.size(), timestamped{{ t.TypeName }}Cls, nullptr);
if (!jarr) {
@@ -168,7 +168,7 @@ JNIEXPORT jobject JNICALL
Java_org_wpilib_networktables_NetworkTablesJNI_getAtomic{{ t.TypeName }}
(JNIEnv* env, jclass, jint subentry, {{ t.jni.jtype }} defaultValue)
{
return MakeJObject(env, nt::GetAtomic{{ t.TypeName }}(subentry, {{ t.jni.FromJavaBegin }}defaultValue{{ t.jni.FromJavaEnd }}));
return MakeJObject(env, wpi::nt::GetAtomic{{ t.TypeName }}(subentry, {{ t.jni.FromJavaBegin }}defaultValue{{ t.jni.FromJavaEnd }}));
}
/*
@@ -180,7 +180,7 @@ JNIEXPORT jobjectArray JNICALL
Java_org_wpilib_networktables_NetworkTablesJNI_readQueue{{ t.TypeName }}
(JNIEnv* env, jclass, jint subentry)
{
return MakeJObject(env, nt::ReadQueue{{ t.TypeName }}(subentry));
return MakeJObject(env, wpi::nt::ReadQueue{{ t.TypeName }}(subentry));
}
/*
@@ -192,7 +192,7 @@ JNIEXPORT {% if t.jni.JavaObject %}jobject{% else %}{{ t.jni.jtype }}{% endif %}
Java_org_wpilib_networktables_NetworkTablesJNI_readQueueValues{{ t.TypeName }}
(JNIEnv* env, jclass, jint subentry)
{
return {{ t.jni.ToJavaArray }}(env, nt::ReadQueueValues{{ t.TypeName }}(subentry));
return {{ t.jni.ToJavaArray }}(env, wpi::nt::ReadQueueValues{{ t.TypeName }}(subentry));
}
{% if t.TypeName == "Raw" %}
/*
@@ -221,7 +221,7 @@ Java_org_wpilib_networktables_NetworkTablesJNI_setRaw
indexOobEx.Throw(env, "start + len must be smaller than array length");
return false;
}
return nt::SetRaw(entry, cvalue.uarray().subspan(start, len), time);
return wpi::nt::SetRaw(entry, cvalue.uarray().subspan(start, len), time);
}
/*
@@ -250,7 +250,7 @@ Java_org_wpilib_networktables_NetworkTablesJNI_setRawBuffer
illegalArgEx.Throw(env, "value must be a native ByteBuffer");
return false;
}
return nt::SetRaw(entry, cvalue.uarray().subspan(start, len), time);
return wpi::nt::SetRaw(entry, cvalue.uarray().subspan(start, len), time);
}
{% else %}
/*
@@ -268,7 +268,7 @@ Java_org_wpilib_networktables_NetworkTablesJNI_set{{ t.TypeName }}
return false;
}
{%- endif %}
return nt::Set{{ t.TypeName }}(entry, {{ t.jni.FromJavaBegin }}value{{ t.jni.FromJavaEnd }}, time);
return wpi::nt::Set{{ t.TypeName }}(entry, {{ t.jni.FromJavaBegin }}value{{ t.jni.FromJavaEnd }}, time);
}
{% endif %}
/*
@@ -281,13 +281,13 @@ Java_org_wpilib_networktables_NetworkTablesJNI_get{{ t.TypeName }}
(JNIEnv*{% if t.jni.JavaObject %} env{% endif %}, jclass, jint entry, {{ t.jni.jtype }} defaultValue)
{
{%- if t.jni.JavaObject %}
auto val = nt::GetEntryValue(entry);
auto val = wpi::nt::GetEntryValue(entry);
if (!val || !val.Is{{ t.TypeName }}()) {
return defaultValue;
}
return {{ t.jni.ToJavaBegin }}val.Get{{ t.TypeName }}(){{ t.jni.ToJavaEnd }};
{%- else %}
return nt::Get{{ t.TypeName }}(entry, defaultValue);
return wpi::nt::Get{{ t.TypeName }}(entry, defaultValue);
{%- endif %}
}
{% if t.TypeName == "Raw" %}
@@ -317,7 +317,7 @@ Java_org_wpilib_networktables_NetworkTablesJNI_setDefaultRaw
indexOobEx.Throw(env, "start + len must be smaller than array length");
return false;
}
return nt::SetDefaultRaw(entry, cvalue.uarray().subspan(start, len));
return wpi::nt::SetDefaultRaw(entry, cvalue.uarray().subspan(start, len));
}
/*
@@ -346,7 +346,7 @@ Java_org_wpilib_networktables_NetworkTablesJNI_setDefaultRawBuffer
illegalArgEx.Throw(env, "value must be a native ByteBuffer");
return false;
}
return nt::SetDefaultRaw(entry, cvalue.uarray().subspan(start, len));
return wpi::nt::SetDefaultRaw(entry, cvalue.uarray().subspan(start, len));
}
{% else %}
/*
@@ -364,7 +364,7 @@ Java_org_wpilib_networktables_NetworkTablesJNI_setDefault{{ t.TypeName }}
return false;
}
{%- endif %}
return nt::SetDefault{{ t.TypeName }}(entry, {{ t.jni.FromJavaBegin }}defaultValue{{ t.jni.FromJavaEnd }});
return wpi::nt::SetDefault{{ t.TypeName }}(entry, {{ t.jni.FromJavaBegin }}defaultValue{{ t.jni.FromJavaEnd }});
}
{% endif %}
{% endfor %}

View File

@@ -9,7 +9,7 @@
#include "Value_internal.hpp"
#include "wpi/nt/ntcore_cpp.hpp"
using namespace nt;
using namespace wpi::nt;
template <typename T>
static inline std::span<const T> ConvertFromC(const T* arr, size_t size) {
@@ -17,7 +17,7 @@ static inline std::span<const T> ConvertFromC(const T* arr, size_t size) {
}
static inline std::string_view ConvertFromC(const struct WPI_String* str) {
return wpi::to_string_view(str);
return wpi::util::to_string_view(str);
}
static std::vector<std::string> ConvertFromC(const struct WPI_String* arr, size_t size) {
@@ -30,7 +30,7 @@ static std::vector<std::string> ConvertFromC(const struct WPI_String* arr, size_
}
{% for t in types %}
static void ConvertToC(const nt::Timestamped{{ t.TypeName }}& in, NT_Timestamped{{ t.TypeName }}* out) {
static void ConvertToC(const wpi::nt::Timestamped{{ t.TypeName }}& in, NT_Timestamped{{ t.TypeName }}* out) {
out->time = in.time;
out->serverTime = in.serverTime;
{%- if t.c.IsArray %}
@@ -47,49 +47,49 @@ extern "C" {
{% for t in types %}
NT_Bool NT_Set{{ t.TypeName }}(NT_Handle pubentry, int64_t time, {{ t.c.ParamType }} value{% if t.c.IsArray %}, size_t len{% endif %}) {
{%- if t.c.IsArray %}
return nt::Set{{ t.TypeName }}(pubentry, ConvertFromC(value, len), time);
return wpi::nt::Set{{ t.TypeName }}(pubentry, ConvertFromC(value, len), time);
{%- elif t.c.ValueInline %}
return nt::Set{{ t.TypeName }}(pubentry, ConvertFromC(value), time);
return wpi::nt::Set{{ t.TypeName }}(pubentry, ConvertFromC(value), time);
{%- else %}
return nt::Set{{ t.TypeName }}(pubentry, value, time);
return wpi::nt::Set{{ t.TypeName }}(pubentry, value, time);
{%- endif %}
}
NT_Bool NT_SetDefault{{ t.TypeName }}(NT_Handle pubentry, {{ t.c.ParamType }} defaultValue{% if t.c.IsArray %}, size_t defaultValueLen{% endif %}) {
{%- if t.c.IsArray %}
return nt::SetDefault{{ t.TypeName }}(pubentry, ConvertFromC(defaultValue, defaultValueLen));
return wpi::nt::SetDefault{{ t.TypeName }}(pubentry, ConvertFromC(defaultValue, defaultValueLen));
{%- elif t.c.ValueInline %}
return nt::SetDefault{{ t.TypeName }}(pubentry, ConvertFromC(defaultValue));
return wpi::nt::SetDefault{{ t.TypeName }}(pubentry, ConvertFromC(defaultValue));
{%- else %}
return nt::SetDefault{{ t.TypeName }}(pubentry, defaultValue);
return wpi::nt::SetDefault{{ t.TypeName }}(pubentry, defaultValue);
{%- endif %}
}
{%- if t.c.ValueInline %}
void NT_Get{{ t.TypeName }}(NT_Handle subentry, {{ t.c.ParamType }} defaultValue, {{ t.c.ValueType }} value) {
auto cppValue = nt::Get{{ t.TypeName }}(subentry, ConvertFromC(defaultValue));
auto cppValue = wpi::nt::Get{{ t.TypeName }}(subentry, ConvertFromC(defaultValue));
ConvertToC(cppValue, value);
}
{%- else %}
{{ t.c.ValueType }} NT_Get{{ t.TypeName }}(NT_Handle subentry, {{ t.c.ParamType }} defaultValue{% if t.c.IsArray %}, size_t defaultValueLen, size_t* len{% endif %}) {
{%- if t.c.IsArray %}
auto cppValue = nt::Get{{ t.TypeName }}(subentry, ConvertFromC(defaultValue, defaultValueLen));
auto cppValue = wpi::nt::Get{{ t.TypeName }}(subentry, ConvertFromC(defaultValue, defaultValueLen));
return ConvertToC<{{ t.c.ValueType[:-1] }}>(cppValue, len);
{%- else %}
return nt::Get{{ t.TypeName }}(subentry, defaultValue);
return wpi::nt::Get{{ t.TypeName }}(subentry, defaultValue);
{%- endif %}
}
{%- endif %}
void NT_GetAtomic{{ t.TypeName }}(NT_Handle subentry, {{ t.c.ParamType }} defaultValue{% if t.c.IsArray %}, size_t defaultValueLen{% endif %}, struct NT_Timestamped{{ t.TypeName }}* value) {
{%- if t.c.IsArray %}
auto cppValue = nt::GetAtomic{{ t.TypeName }}(subentry, ConvertFromC(defaultValue, defaultValueLen));
auto cppValue = wpi::nt::GetAtomic{{ t.TypeName }}(subentry, ConvertFromC(defaultValue, defaultValueLen));
{%- elif t.c.ValueInline %}
auto cppValue = nt::GetAtomic{{ t.TypeName }}(subentry, ConvertFromC(defaultValue));
auto cppValue = wpi::nt::GetAtomic{{ t.TypeName }}(subentry, ConvertFromC(defaultValue));
{%- else %}
auto cppValue = nt::GetAtomic{{ t.TypeName }}(subentry, defaultValue);
auto cppValue = wpi::nt::GetAtomic{{ t.TypeName }}(subentry, defaultValue);
{%- endif %}
ConvertToC(cppValue, value);
}
@@ -105,7 +105,7 @@ void NT_DisposeTimestamped{{ t.TypeName }}(struct NT_Timestamped{{ t.TypeName }}
}
struct NT_Timestamped{{ t.TypeName }}* NT_ReadQueue{{ t.TypeName }}(NT_Handle subentry, size_t* len) {
auto arr = nt::ReadQueue{{ t.TypeName }}(subentry);
auto arr = wpi::nt::ReadQueue{{ t.TypeName }}(subentry);
return ConvertToC<NT_Timestamped{{ t.TypeName }}>(arr, len);
}
@@ -118,7 +118,7 @@ void NT_FreeQueue{{ t.TypeName }}(struct NT_Timestamped{{ t.TypeName }}* arr, si
{%- if not t.c.IsArray and not t.c.ValueInline %}
{{ t.c.ValueType }}* NT_ReadQueueValues{{ t.TypeName }}(NT_Handle subentry, size_t* len) {
auto arr = nt::ReadQueueValues{{ t.TypeName }}(subentry);
auto arr = wpi::nt::ReadQueueValues{{ t.TypeName }}(subentry);
return ConvertToC<{{ t.c.ValueType }}>(arr, len);
}
{%- endif %}

View File

@@ -10,10 +10,10 @@
#include "InstanceImpl.hpp"
namespace {
template <nt::ValidType T>
template <wpi::nt::ValidType T>
struct ValuesType {
using Vector =
std::vector<typename nt::TypeInfo<std::remove_cvref_t<T>>::Value>;
std::vector<typename wpi::nt::TypeInfo<std::remove_cvref_t<T>>::Value>;
};
template <>
@@ -22,7 +22,7 @@ struct ValuesType<bool> {
};
} // namespace
namespace nt {
namespace wpi::nt {
template <ValidType T>
static inline bool Set(NT_Handle pubentry, typename TypeInfo<T>::View value,
@@ -59,7 +59,7 @@ static inline Timestamped<typename TypeInfo<T>::Value> GetAtomic(
template <ValidType T>
inline Timestamped<typename TypeInfo<T>::SmallRet> GetAtomic(
NT_Handle subentry,
wpi::SmallVectorImpl<typename TypeInfo<T>::SmallElem>& buf,
wpi::util::SmallVectorImpl<typename TypeInfo<T>::SmallElem>& buf,
typename TypeInfo<T>::View defaultValue) {
if (auto ii = InstanceImpl::Get(Handle{subentry}.GetInst())) {
return ii->localStorage.GetAtomic<T>(subentry, buf, defaultValue);
@@ -117,18 +117,18 @@ std::vector<{% if t.cpp.ValueType == "bool" %}int{% else %}{{ t.cpp.ValueType }}
{% if t.cpp.SmallRetType and t.cpp.SmallElemType %}
{{ t.cpp.SmallRetType }} Get{{ t.TypeName }}(
NT_Handle subentry,
wpi::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf,
wpi::util::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf,
{{ t.cpp.ParamType }} defaultValue) {
return GetAtomic<{{ t.cpp.TemplateType }}>(subentry, buf, defaultValue).value;
}
Timestamped{{ t.TypeName }}View GetAtomic{{ t.TypeName }}(
NT_Handle subentry,
wpi::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf,
wpi::util::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf,
{{ t.cpp.ParamType }} defaultValue) {
return GetAtomic<{{ t.cpp.TemplateType }}>(subentry, buf, defaultValue);
}
{% endif %}
{% endfor %}
} // namespace nt
} // namespace wpi::nt

View File

@@ -16,12 +16,12 @@
#include "wpi/nt/ntcore_c.h"
namespace wpi {
namespace wpi::util {
template <typename T>
class SmallVectorImpl;
} // namespace wpi
namespace nt {
namespace wpi::nt {
/**
* Timestamped value.
* @ingroup ntcore_cpp_handle_api
@@ -55,7 +55,7 @@ struct Timestamped {
using Timestamped{{ t.TypeName }} = Timestamped<{{ t.cpp.ValueType }}>;
{% if t.cpp.SmallRetType %}
/**
* Timestamped {{ t.TypeName }} view (for SmallVector-taking functions).
* Timestamped {{ t.TypeName }} view (for wpi::util::SmallVector-taking functions).
* @ingroup ntcore_cpp_handle_api
*/
using Timestamped{{ t.TypeName }}View = Timestamped<{{ t.cpp.SmallRetType }}>;
@@ -131,14 +131,14 @@ std::vector<Timestamped{{ t.TypeName }}> ReadQueue{{ t.TypeName }}(NT_Handle sub
*/
std::vector<{% if t.cpp.ValueType == "bool" %}int{% else %}{{ t.cpp.ValueType }}{% endif %}> ReadQueueValues{{ t.TypeName }}(NT_Handle subentry);
{% if t.cpp.SmallRetType and t.cpp.SmallElemType %}
{{ t.cpp.SmallRetType }} Get{{ t.TypeName }}(NT_Handle subentry, wpi::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf, {{ t.cpp.ParamType }} defaultValue);
{{ t.cpp.SmallRetType }} Get{{ t.TypeName }}(NT_Handle subentry, wpi::util::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf, {{ t.cpp.ParamType }} defaultValue);
Timestamped{{ t.TypeName }}View GetAtomic{{ t.TypeName }}(
NT_Handle subentry,
wpi::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf,
wpi::util::SmallVectorImpl<{{ t.cpp.SmallElemType }}>& buf,
{{ t.cpp.ParamType }} defaultValue);
{% endif %}
/** @} */
{% endfor %}
} // namespace nt
} // namespace wpi::nt

View File

@@ -19,12 +19,12 @@
#include "wpi/nt/Topic.hpp"
#include "wpi/nt/ntcore_cpp.hpp"
namespace wpi {
namespace wpi::util {
template <typename T>
class SmallVectorImpl;
} // namespace wpi
namespace nt {
namespace wpi::nt {
class {{ TypeName }}Topic;
@@ -74,7 +74,7 @@ class {{ TypeName }}Subscriber : public Subscriber {
* @return value
*/
ValueType Get(ParamType defaultValue) const {
return ::nt::Get{{ TypeName }}(m_subHandle, defaultValue);
return ::wpi::nt::Get{{ TypeName }}(m_subHandle, defaultValue);
}
{% if cpp.SmallRetType and cpp.SmallElemType %}
/**
@@ -84,7 +84,7 @@ class {{ TypeName }}Subscriber : public Subscriber {
* @param buf storage for returned value
* @return value
*/
SmallRetType Get(wpi::SmallVectorImpl<SmallElemType>& buf) const {
SmallRetType Get(wpi::util::SmallVectorImpl<SmallElemType>& buf) const {
return Get(buf, m_defaultValue);
}
@@ -96,8 +96,8 @@ class {{ TypeName }}Subscriber : public Subscriber {
* @param defaultValue default value to return if no value has been published
* @return value
*/
SmallRetType Get(wpi::SmallVectorImpl<SmallElemType>& buf, ParamType defaultValue) const {
return nt::Get{{ TypeName }}(m_subHandle, buf, defaultValue);
SmallRetType Get(wpi::util::SmallVectorImpl<SmallElemType>& buf, ParamType defaultValue) const {
return wpi::nt::Get{{ TypeName }}(m_subHandle, buf, defaultValue);
}
{% endif %}
/**
@@ -120,7 +120,7 @@ class {{ TypeName }}Subscriber : public Subscriber {
* @return timestamped value
*/
TimestampedValueType GetAtomic(ParamType defaultValue) const {
return ::nt::GetAtomic{{ TypeName }}(m_subHandle, defaultValue);
return ::wpi::nt::GetAtomic{{ TypeName }}(m_subHandle, defaultValue);
}
{% if cpp.SmallRetType and cpp.SmallElemType %}
/**
@@ -132,7 +132,7 @@ class {{ TypeName }}Subscriber : public Subscriber {
* @return timestamped value
*/
TimestampedValueViewType GetAtomic(
wpi::SmallVectorImpl<SmallElemType>& buf) const {
wpi::util::SmallVectorImpl<SmallElemType>& buf) const {
return GetAtomic(buf, m_defaultValue);
}
@@ -146,9 +146,9 @@ class {{ TypeName }}Subscriber : public Subscriber {
* @return timestamped value
*/
TimestampedValueViewType GetAtomic(
wpi::SmallVectorImpl<SmallElemType>& buf,
wpi::util::SmallVectorImpl<SmallElemType>& buf,
ParamType defaultValue) const {
return nt::GetAtomic{{ TypeName }}(m_subHandle, buf, defaultValue);
return wpi::nt::GetAtomic{{ TypeName }}(m_subHandle, buf, defaultValue);
}
{% endif %}
/**
@@ -162,7 +162,7 @@ class {{ TypeName }}Subscriber : public Subscriber {
* been published since the previous call.
*/
std::vector<TimestampedValueType> ReadQueue() {
return ::nt::ReadQueue{{ TypeName }}(m_subHandle);
return ::wpi::nt::ReadQueue{{ TypeName }}(m_subHandle);
}
/**
@@ -207,7 +207,7 @@ class {{ TypeName }}Publisher : public Publisher {
* @param time timestamp; 0 indicates current NT time should be used
*/
void Set(ParamType value, int64_t time = 0) {
::nt::Set{{ TypeName }}(m_pubHandle, value, time);
::wpi::nt::Set{{ TypeName }}(m_pubHandle, value, time);
}
/**
@@ -218,7 +218,7 @@ class {{ TypeName }}Publisher : public Publisher {
* @param value value
*/
void SetDefault(ParamType value) {
::nt::SetDefault{{ TypeName }}(m_pubHandle, value);
::wpi::nt::SetDefault{{ TypeName }}(m_pubHandle, value);
}
/**
@@ -286,7 +286,7 @@ class {{ TypeName }}Entry final : public {{ TypeName }}Subscriber,
* Stops publishing the entry if it's published.
*/
void Unpublish() {
::nt::Unpublish(m_pubHandle);
::wpi::nt::Unpublish(m_pubHandle);
}
};
@@ -346,7 +346,7 @@ class {{ TypeName }}Topic final : public Topic {
{% if not TypeString %}std::string_view typeString, {% endif %}ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions) {
return {{ TypeName }}Subscriber{
::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
::wpi::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
defaultValue};
}
{%- if TypeString %}
@@ -371,7 +371,7 @@ class {{ TypeName }}Topic final : public Topic {
std::string_view typeString, ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions) {
return {{ TypeName }}Subscriber{
::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
::wpi::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
defaultValue};
}
{% endif %}
@@ -396,7 +396,7 @@ class {{ TypeName }}Topic final : public Topic {
[[nodiscard]]
PublisherType Publish({% if not TypeString %}std::string_view typeString, {% endif %}const PubSubOptions& options = kDefaultPubSubOptions) {
return {{ TypeName }}Publisher{
::nt::Publish(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options)};
::wpi::nt::Publish(m_handle, NT_{{ cpp.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::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
return {{ TypeName }}Publisher{
::nt::PublishEx(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, properties, options)};
::wpi::nt::PublishEx(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, properties, options)};
}
/**
@@ -451,7 +451,7 @@ class {{ TypeName }}Topic final : public Topic {
EntryType GetEntry({% if not TypeString %}std::string_view typeString, {% endif %}ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions) {
return {{ TypeName }}Entry{
::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
::wpi::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
defaultValue};
}
{%- if TypeString %}
@@ -480,23 +480,23 @@ class {{ TypeName }}Topic final : public Topic {
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions) {
return {{ TypeName }}Entry{
::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
::wpi::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
defaultValue};
}
{% endif %}
};
inline {{ TypeName }}Topic {{ TypeName }}Subscriber::GetTopic() const {
return {{ TypeName }}Topic{::nt::GetTopicFromHandle(m_subHandle)};
return {{ TypeName }}Topic{::wpi::nt::GetTopicFromHandle(m_subHandle)};
}
inline {{ TypeName }}Topic {{ TypeName }}Publisher::GetTopic() const {
return {{ TypeName }}Topic{::nt::GetTopicFromHandle(m_pubHandle)};
return {{ TypeName }}Topic{::wpi::nt::GetTopicFromHandle(m_pubHandle)};
}
inline {{ TypeName }}Topic {{ TypeName }}Entry::GetTopic() const {
return {{ TypeName }}Topic{::nt::GetTopicFromHandle(m_subHandle)};
return {{ TypeName }}Topic{::wpi::nt::GetTopicFromHandle(m_subHandle)};
}
} // namespace nt
} // namespace wpi::nt