Skip to content

Commit

Permalink
[ntcore] Add missing multi-subscribe C API functions
Browse files Browse the repository at this point in the history
Also export recently added C API functions.
  • Loading branch information
PeterJohnson committed Oct 14, 2024
1 parent 4023cdc commit 6246cfa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
15 changes: 15 additions & 0 deletions ntcore/src/main/native/cpp/ntcore_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,21 @@ NT_Topic NT_GetTopicFromHandle(NT_Handle pubsubentry) {
return nt::GetTopicFromHandle(pubsubentry);
}

NT_MultiSubscriber NT_SubscribeMultiple(
NT_Inst inst, const struct WPI_String* prefixes, size_t prefixes_len,
const struct NT_PubSubOptions* options) {
wpi::SmallVector<std::string_view, 8> p;
p.resize_for_overwrite(prefixes_len);
for (size_t i = 0; i < prefixes_len; ++i) {
p[i] = wpi::to_string_view(&prefixes[i]);
}
return nt::SubscribeMultiple(inst, p, ConvertToCpp(options));
}

void NT_UnsubscribeMultiple(NT_MultiSubscriber sub) {
nt::UnsubscribeMultiple(sub);
}

/*
* Callback Creation Functions
*/
Expand Down
25 changes: 17 additions & 8 deletions ntcoreffi/src/main/native/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ NT_AddPolledListener
NT_AddPolledListenerMultiple
NT_AddPolledListenerSingle
NT_AddPolledLogger
NT_AddSchema
NT_AllocateBooleanArray
NT_AllocateCharArray
NT_AllocateDoubleArray
Expand All @@ -24,6 +25,7 @@ NT_CreateListenerPoller
NT_DeleteTopicProperty
NT_DestroyInstance
NT_DestroyListenerPoller
NT_Disconnect
NT_DisposeConnectionInfoArray
NT_DisposeEvent
NT_DisposeEventArray
Expand Down Expand Up @@ -87,6 +89,7 @@ NT_GetEntryLastChange
NT_GetEntryName
NT_GetEntryType
NT_GetEntryValue
NT_GetEntryValueType
NT_GetFloat
NT_GetFloatArray
NT_GetInstanceFromHandle
Expand All @@ -99,6 +102,7 @@ NT_GetString
NT_GetStringArray
NT_GetStringForTesting
NT_GetTopic
NT_GetTopicCached
NT_GetTopicExists
NT_GetTopicFromHandle
NT_GetTopicInfo
Expand Down Expand Up @@ -133,22 +137,17 @@ NT_GetValueStringArray
NT_GetValueStringArrayForTesting
NT_GetValueStringForTesting
NT_GetValueType
WPI_InitString
WPI_InitStringWithLength
WPI_AllocateString
WPI_FreeString
WPI_AllocateStringArray
WPI_FreeStringArray
NT_HasSchema
NT_InitValue
NT_IsConnected
NT_Meta_DecodeClientPublishers
NT_Meta_DecodeClientSubscribers
NT_Meta_DecodeClients
NT_Meta_DecodeClientSubscribers
NT_Meta_DecodeTopicPublishers
NT_Meta_DecodeTopicSubscribers
NT_Meta_FreeClientPublishers
NT_Meta_FreeClientSubscribers
NT_Meta_FreeClients
NT_Meta_FreeClientSubscribers
NT_Meta_FreeTopicPublishers
NT_Meta_FreeTopicSubscribers
NT_Now
Expand All @@ -171,6 +170,7 @@ NT_ReadQueueValuesBoolean
NT_ReadQueueValuesDouble
NT_ReadQueueValuesFloat
NT_ReadQueueValuesInteger
NT_ReadQueueValueType
NT_Release
NT_ReleaseEntry
NT_RemoveListener
Expand Down Expand Up @@ -203,6 +203,7 @@ NT_SetServerMulti
NT_SetServerTeam
NT_SetString
NT_SetStringArray
NT_SetTopicCached
NT_SetTopicPersistent
NT_SetTopicProperties
NT_SetTopicProperty
Expand All @@ -221,9 +222,13 @@ NT_StopEntryDataLog
NT_StopLocal
NT_StopServer
NT_Subscribe
NT_SubscribeMultiple
NT_Unpublish
NT_Unsubscribe
NT_UnsubscribeMultiple
NT_WaitForListenerQueue
WPI_AllocateString
WPI_AllocateStringArray
WPI_CreateEvent
WPI_CreateSemaphore
WPI_CreateSignalObject
Expand Down Expand Up @@ -254,10 +259,14 @@ WPI_DataLog_Stop
WPI_DestroyEvent
WPI_DestroySemaphore
WPI_DestroySignalObject
WPI_FreeString
WPI_FreeStringArray
WPI_GetSystemTime
WPI_Impl_SetupNowUseDefaultOnRio
WPI_Impl_SetupNowRioWithSession
WPI_Impl_ShutdownNowRio
WPI_InitString
WPI_InitStringWithLength
WPI_Now
WPI_NowDefault
WPI_ReleaseSemaphore
Expand Down

0 comments on commit 6246cfa

Please sign in to comment.