Skip to content

Commit

Permalink
Switch ntcore to unified string
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse committed Jan 23, 2024
1 parent af5df28 commit 4f01b37
Show file tree
Hide file tree
Showing 29 changed files with 416 additions and 529 deletions.
8 changes: 4 additions & 4 deletions src/ntcore/ConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public static ConnectionInfo ConvertToManaged(in NativeConnectionInfo unmanaged)
{
return new ConnectionInfo
{
RemoteId = StringLengthPairMarshaller<NtString>.ManagedConvert(unmanaged.remoteId) ?? "",
RemoteIp = StringLengthPairMarshaller<NtString>.ManagedConvert(unmanaged.remoteIp) ?? "",
RemoteId = unmanaged.remoteId.ConvertToString(),
RemoteIp = unmanaged.remoteIp.ConvertToString(),
RemotePort = unmanaged.remotePort,
LastUpdate = unmanaged.lastUpdate,
ProtocolVersion = unmanaged.protocolVersion,
Expand All @@ -41,8 +41,8 @@ public static NativeConnectionInfo ConvertToUnmanaged(ConnectionInfo managed)
[StructLayout(LayoutKind.Sequential)]
public struct NativeConnectionInfo
{
public NtString remoteId;
public NtString remoteIp;
public WpiStringMarshaller.WpiStringNative remoteId;
public WpiStringMarshaller.WpiStringNative remoteIp;
public uint remotePort;
public ulong lastUpdate;
public uint protocolVersion;
Expand Down
26 changes: 13 additions & 13 deletions src/ntcore/Generated/BooleanArrayTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IBooleanArraySubscriber Subscribe(
{
return new BooleanArrayEntryImpl<NtSubscriber>(
this,
NtCore.SubscribeDangerous(
NtCore.Subscribe(
Handle, NetworkTableType.BooleanArray,
"boolean[]"u8, options),
defaultValue);
Expand Down Expand Up @@ -109,14 +109,14 @@ public IBooleanArraySubscriber SubscribeEx(
* @param options subscribe options
* @return subscriber
*/
internal IBooleanArraySubscriber SubscribeExDangerous(
internal IBooleanArraySubscriber SubscribeEx(
ReadOnlySpan<byte> typeString,
bool[] defaultValue,
PubSubOptions options)
{
return new BooleanArrayEntryImpl<NtSubscriber>(
this,
NtCore.SubscribeDangerous(
NtCore.Subscribe(
Handle, NetworkTableType.BooleanArray,
typeString, options),
defaultValue);
Expand All @@ -142,7 +142,7 @@ public IBooleanArrayPublisher Publish(
{
return new BooleanArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishDangerous(
NtCore.Publish(
Handle, NetworkTableType.BooleanArray,
"boolean[]"u8, options),
[]);
Expand Down Expand Up @@ -194,14 +194,14 @@ public IBooleanArrayPublisher PublishEx(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IBooleanArrayPublisher PublishExDangerous(
internal IBooleanArrayPublisher PublishEx(
ReadOnlySpan<byte> typeString,
string properties,
PubSubOptions options)
{
return new BooleanArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.BooleanArray,
typeString, properties, options),
[]);
Expand All @@ -225,14 +225,14 @@ internal IBooleanArrayPublisher PublishExDangerous(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IBooleanArrayPublisher PublishExDangerous(
internal IBooleanArrayPublisher PublishEx(
string typeString,
ReadOnlySpan<byte> properties,
PubSubOptions options)
{
return new BooleanArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.BooleanArray,
typeString, properties, options),
[]);
Expand All @@ -256,14 +256,14 @@ internal IBooleanArrayPublisher PublishExDangerous(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IBooleanArrayPublisher PublishExDangerous(
internal IBooleanArrayPublisher PublishEx(
ReadOnlySpan<byte> typeString,
ReadOnlySpan<byte> properties,
PubSubOptions options)
{
return new BooleanArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.BooleanArray,
typeString, properties, options),
[]);
Expand Down Expand Up @@ -295,7 +295,7 @@ public IBooleanArrayEntry GetEntry(
{
return new BooleanArrayEntryImpl<NtEntry>(
this,
NtCore.GetEntryDangerous(
NtCore.GetEntry(
Handle, NetworkTableType.BooleanArray,
"boolean[]"u8, options),
defaultValue);
Expand Down Expand Up @@ -356,14 +356,14 @@ public IBooleanArrayEntry GetEntryEx(
* @param options publish and/or subscribe options
* @return entry
*/
internal IBooleanArrayEntry GetEntryExDangerous(
internal IBooleanArrayEntry GetEntryEx(
ReadOnlySpan<byte> typeString,
bool[] defaultValue,
PubSubOptions options)
{
return new BooleanArrayEntryImpl<NtEntry>(
this,
NtCore.GetEntryDangerous(
NtCore.GetEntry(
Handle, NetworkTableType.BooleanArray,
typeString, options),
defaultValue);
Expand Down
26 changes: 13 additions & 13 deletions src/ntcore/Generated/BooleanTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IBooleanSubscriber Subscribe(
{
return new BooleanEntryImpl<NtSubscriber>(
this,
NtCore.SubscribeDangerous(
NtCore.Subscribe(
Handle, NetworkTableType.Boolean,
"boolean"u8, options),
defaultValue);
Expand Down Expand Up @@ -109,14 +109,14 @@ public IBooleanSubscriber SubscribeEx(
* @param options subscribe options
* @return subscriber
*/
internal IBooleanSubscriber SubscribeExDangerous(
internal IBooleanSubscriber SubscribeEx(
ReadOnlySpan<byte> typeString,
bool defaultValue,
PubSubOptions options)
{
return new BooleanEntryImpl<NtSubscriber>(
this,
NtCore.SubscribeDangerous(
NtCore.Subscribe(
Handle, NetworkTableType.Boolean,
typeString, options),
defaultValue);
Expand All @@ -142,7 +142,7 @@ public IBooleanPublisher Publish(
{
return new BooleanEntryImpl<NtPublisher>(
this,
NtCore.PublishDangerous(
NtCore.Publish(
Handle, NetworkTableType.Boolean,
"boolean"u8, options),
false);
Expand Down Expand Up @@ -194,14 +194,14 @@ public IBooleanPublisher PublishEx(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IBooleanPublisher PublishExDangerous(
internal IBooleanPublisher PublishEx(
ReadOnlySpan<byte> typeString,
string properties,
PubSubOptions options)
{
return new BooleanEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.Boolean,
typeString, properties, options),
false);
Expand All @@ -225,14 +225,14 @@ internal IBooleanPublisher PublishExDangerous(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IBooleanPublisher PublishExDangerous(
internal IBooleanPublisher PublishEx(
string typeString,
ReadOnlySpan<byte> properties,
PubSubOptions options)
{
return new BooleanEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.Boolean,
typeString, properties, options),
false);
Expand All @@ -256,14 +256,14 @@ internal IBooleanPublisher PublishExDangerous(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IBooleanPublisher PublishExDangerous(
internal IBooleanPublisher PublishEx(
ReadOnlySpan<byte> typeString,
ReadOnlySpan<byte> properties,
PubSubOptions options)
{
return new BooleanEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.Boolean,
typeString, properties, options),
false);
Expand Down Expand Up @@ -295,7 +295,7 @@ public IBooleanEntry GetEntry(
{
return new BooleanEntryImpl<NtEntry>(
this,
NtCore.GetEntryDangerous(
NtCore.GetEntry(
Handle, NetworkTableType.Boolean,
"boolean"u8, options),
defaultValue);
Expand Down Expand Up @@ -356,14 +356,14 @@ public IBooleanEntry GetEntryEx(
* @param options publish and/or subscribe options
* @return entry
*/
internal IBooleanEntry GetEntryExDangerous(
internal IBooleanEntry GetEntryEx(
ReadOnlySpan<byte> typeString,
bool defaultValue,
PubSubOptions options)
{
return new BooleanEntryImpl<NtEntry>(
this,
NtCore.GetEntryDangerous(
NtCore.GetEntry(
Handle, NetworkTableType.Boolean,
typeString, options),
defaultValue);
Expand Down
26 changes: 13 additions & 13 deletions src/ntcore/Generated/DoubleArrayTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IDoubleArraySubscriber Subscribe(
{
return new DoubleArrayEntryImpl<NtSubscriber>(
this,
NtCore.SubscribeDangerous(
NtCore.Subscribe(
Handle, NetworkTableType.DoubleArray,
"double[]"u8, options),
defaultValue);
Expand Down Expand Up @@ -109,14 +109,14 @@ public IDoubleArraySubscriber SubscribeEx(
* @param options subscribe options
* @return subscriber
*/
internal IDoubleArraySubscriber SubscribeExDangerous(
internal IDoubleArraySubscriber SubscribeEx(
ReadOnlySpan<byte> typeString,
double[] defaultValue,
PubSubOptions options)
{
return new DoubleArrayEntryImpl<NtSubscriber>(
this,
NtCore.SubscribeDangerous(
NtCore.Subscribe(
Handle, NetworkTableType.DoubleArray,
typeString, options),
defaultValue);
Expand All @@ -142,7 +142,7 @@ public IDoubleArrayPublisher Publish(
{
return new DoubleArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishDangerous(
NtCore.Publish(
Handle, NetworkTableType.DoubleArray,
"double[]"u8, options),
[]);
Expand Down Expand Up @@ -194,14 +194,14 @@ public IDoubleArrayPublisher PublishEx(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IDoubleArrayPublisher PublishExDangerous(
internal IDoubleArrayPublisher PublishEx(
ReadOnlySpan<byte> typeString,
string properties,
PubSubOptions options)
{
return new DoubleArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.DoubleArray,
typeString, properties, options),
[]);
Expand All @@ -225,14 +225,14 @@ internal IDoubleArrayPublisher PublishExDangerous(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IDoubleArrayPublisher PublishExDangerous(
internal IDoubleArrayPublisher PublishEx(
string typeString,
ReadOnlySpan<byte> properties,
PubSubOptions options)
{
return new DoubleArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.DoubleArray,
typeString, properties, options),
[]);
Expand All @@ -256,14 +256,14 @@ internal IDoubleArrayPublisher PublishExDangerous(
* @return publisher
* @throws IllegalArgumentException if properties is not a JSON object
*/
internal IDoubleArrayPublisher PublishExDangerous(
internal IDoubleArrayPublisher PublishEx(
ReadOnlySpan<byte> typeString,
ReadOnlySpan<byte> properties,
PubSubOptions options)
{
return new DoubleArrayEntryImpl<NtPublisher>(
this,
NtCore.PublishExDangerous(
NtCore.PublishEx(
Handle, NetworkTableType.DoubleArray,
typeString, properties, options),
[]);
Expand Down Expand Up @@ -295,7 +295,7 @@ public IDoubleArrayEntry GetEntry(
{
return new DoubleArrayEntryImpl<NtEntry>(
this,
NtCore.GetEntryDangerous(
NtCore.GetEntry(
Handle, NetworkTableType.DoubleArray,
"double[]"u8, options),
defaultValue);
Expand Down Expand Up @@ -356,14 +356,14 @@ public IDoubleArrayEntry GetEntryEx(
* @param options publish and/or subscribe options
* @return entry
*/
internal IDoubleArrayEntry GetEntryExDangerous(
internal IDoubleArrayEntry GetEntryEx(
ReadOnlySpan<byte> typeString,
double[] defaultValue,
PubSubOptions options)
{
return new DoubleArrayEntryImpl<NtEntry>(
this,
NtCore.GetEntryDangerous(
NtCore.GetEntry(
Handle, NetworkTableType.DoubleArray,
typeString, options),
defaultValue);
Expand Down
Loading

0 comments on commit 4f01b37

Please sign in to comment.