Skip to content

Commit

Permalink
helics v3.4 api updates
Browse files Browse the repository at this point in the history
  • Loading branch information
afisher1 committed Jan 28, 2023
1 parent 1ef9711 commit 085d863
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)"""
Expand Down
8 changes: 8 additions & 0 deletions src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 085d863

Please sign in to comment.