From 085d863988939d9d76b96b9900efc65355df10d4 Mon Sep 17 00:00:00 2001 From: afisher1 Date: Fri, 27 Jan 2023 16:17:55 -0800 Subject: [PATCH] helics v3.4 api updates --- src/api.jl | 32 ++++++++++++++++++++++++++++++++ src/common.jl | 2 ++ src/enums.jl | 4 ++++ src/lib.jl | 8 ++++++++ 4 files changed, 46 insertions(+) diff --git a/src/api.jl b/src/api.jl index 468c813..f13aa9c 100644 --- a/src/api.jl +++ b/src/api.jl @@ -2047,6 +2047,23 @@ function helicsFederateGetSubscription(fed::Federate, key::String)::Subscription return @invoke_and_check Lib.helicsFederateGetSubscription(fed, key) end +""" +Get an [`Input`](@ref) object from an [`Input`](@ref) target + +# Arguments + +- `fed`: the value federate object to use to get the [`Publication`](@ref) +- `target`: the name of the [`Publication`](@ref) that an [`Input`](@ref) is targeting + +# Returns + +- a [`Input`](@ref) object, the object will not be valid and err will contain an error code if no input with the specified +key exists +""" +function helicsFederateGetInputByTarget(fed::Federate, target::String)::Input + return @invoke_and_check Lib.helicsFederateGetInputByTarget(fed, key) +end + """ Publish raw bytes from string @@ -2669,6 +2686,21 @@ function helicsSubscriptionGetTarget(ipt::Input)::String return unsafe_string(Lib.helicsSubscriptionGetTarget(ipt)) end +""" +Get the target of an [`Input`](@ref) + +# Arguments + +- `ipt`: the [`Input`](@ref) to query + +# Returns + +- A string of the input target +""" +function helicsInputGetTarget(ipt::Input)::String + return unsafe_string(Lib.helicsInputGetTarget(ipt)) +end + """ Get the name of a [`Publication`](@ref) diff --git a/src/common.jl b/src/common.jl index 6b526e9..73c4780 100644 --- a/src/common.jl +++ b/src/common.jl @@ -159,6 +159,8 @@ end HELICS_HANDLE_OPTION_MULTIPLE_CONNECTIONS_ALLOWED = 409 HELICS_HANDLE_OPTION_BUFFER_DATA = 411 HELICS_HANDLE_OPTION_STRICT_TYPE_CHECKING = 414 + HELICS_HANDLE_OPTION_RECEIVE_ONLY = 422 + HELICS_HANDLE_OPTION_SOURCE_ONLY = 423 HELICS_HANDLE_OPTION_IGNORE_UNIT_MISMATCH = 447 HELICS_HANDLE_OPTION_ONLY_TRANSMIT_ON_CHANGE = 452 HELICS_HANDLE_OPTION_ONLY_UPDATE_ON_CHANGE = 454 diff --git a/src/enums.jl b/src/enums.jl index 63982f3..e68bddf 100644 --- a/src/enums.jl +++ b/src/enums.jl @@ -375,6 +375,10 @@ HELICS_HANDLE_OPTION_MULTIPLE_CONNECTIONS_ALLOWED HELICS_HANDLE_OPTION_BUFFER_DATA """specify that the types should be checked strictly for pub/sub and filters""" HELICS_HANDLE_OPTION_STRICT_TYPE_CHECKING +"""specify that the handle is receive only""" +HELICS_HANDLE_OPTION_RECEIVE_ONLY +"""specify that the handle is source only""" +HELICS_HANDLE_OPTION_SOURCE_ONLY """specify that the mismatching units should be ignored""" HELICS_HANDLE_OPTION_IGNORE_UNIT_MISMATCH """specify that an interface will only transmit on change (only applicable to publications)""" diff --git a/src/lib.jl b/src/lib.jl index d78b0f3..da2e4e4 100644 --- a/src/lib.jl +++ b/src/lib.jl @@ -878,6 +878,10 @@ function helicsFederateGetSubscription(fed, key, err) ccall((:helicsFederateGetSubscription, libhelics), HelicsInput, (HelicsFederate, Cstring, Ptr{HelicsError}), fed, key, err) end +function helicsFederateGetInputByTarget(fed, target, err) + ccall((:helicsFederateGetInputByTarget, libhelics), HelicsInput, (HelicsFederate, Cstring, Ptr{HelicsError}), fed, target, err) +end + function helicsFederateClearUpdates(fed) ccall((:helicsFederateClearUpdates, libhelics), Cvoid, (HelicsFederate,), fed) end @@ -1078,6 +1082,10 @@ function helicsSubscriptionGetTarget(ipt) ccall((:helicsSubscriptionGetTarget, libhelics), Cstring, (HelicsInput,), ipt) end +function helicsInputGetTarget(ipt) + ccall((:helicsInputGetTarget, libhelics), Cstring, (HelicsInput,), ipt) +end + function helicsPublicationGetName(pub) ccall((:helicsPublicationGetName, libhelics), Cstring, (HelicsPublication,), pub) end