Skip to content

Commit

Permalink
Merge pull request #20 from GMLC-TDC/kd/bump-to-v2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak authored May 20, 2020
2 parents 6569dae + c455e45 commit a2ecb51
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 103 deletions.
8 changes: 4 additions & 4 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ version = "0.8.1"

[[HELICS_jll]]
deps = ["Libdl", "Pkg", "ZeroMQ_jll"]
git-tree-sha1 = "7f1f3be78e6bd5388630978ab1802816dbcda638"
git-tree-sha1 = "1ac0324914502afcf2170dad6190df0a037100bd"
uuid = "ef3b0bb0-9dc6-5204-90f3-946fd7d0da3e"
version = "2.4.2+0"
version = "2.5.0+0"

[[InteractiveUtils]]
deps = ["Markdown"]
Expand Down Expand Up @@ -84,6 +84,6 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[ZeroMQ_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "d24fc0004686b534cc7518412b626deeea0b0208"
git-tree-sha1 = "ac15b32cf384a72b058f3c214708e5a11a91ac86"
uuid = "8f1865be-045e-5c20-9c9f-bfbfb0764568"
version = "4.3.2+1"
version = "4.3.2+3"
17 changes: 8 additions & 9 deletions scripts/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ version = "0.11.0"

[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "5a431d46abf2ef2a4d5d00bd0ae61f651cf854c8"
git-tree-sha1 = "7d7578b00789cf16c5f68fad71868e773edd58a2"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.10"
version = "0.17.16"

[[Dates]]
deps = ["Printf"]
Expand All @@ -42,9 +42,9 @@ version = "0.7.0"

[[HELICS_jll]]
deps = ["Libdl", "Pkg", "ZeroMQ_jll"]
git-tree-sha1 = "7f1f3be78e6bd5388630978ab1802816dbcda638"
git-tree-sha1 = "1ac0324914502afcf2170dad6190df0a037100bd"
uuid = "ef3b0bb0-9dc6-5204-90f3-946fd7d0da3e"
version = "2.4.2+0"
version = "2.5.0+0"

[[InteractiveUtils]]
deps = ["Markdown"]
Expand All @@ -71,10 +71,9 @@ deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[OrderedCollections]]
deps = ["Random", "Serialization", "Test"]
git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1"
git-tree-sha1 = "12ce190210d278e12644bcadf5b21cbdcf225cd3"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.1.0"
version = "1.2.0"

[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
Expand Down Expand Up @@ -114,6 +113,6 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[ZeroMQ_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "d24fc0004686b534cc7518412b626deeea0b0208"
git-tree-sha1 = "42b0955a7ad0935d454d750fedd812d3f2836fde"
uuid = "8f1865be-045e-5c20-9c9f-bfbfb0764568"
version = "4.3.2+1"
version = "4.3.2+2"
80 changes: 76 additions & 4 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Receive a communication message for any endpoint in the [`Federate`](@ref)
The return order will be in order of endpoint creation.
So all messages that are available for the first endpoint, then all for the second, and so on within a single endpoint the messages are ordered by time, then `source_id`, then order of arrival
Returns
# Returns
- a [`Message`](@ref) which references the
data in the message
Expand Down Expand Up @@ -3754,7 +3754,7 @@ Request the next time for federate execution
- `fed`: The [`Federate`](@ref) to make the request of
- `timeDelta`: The requested amount of time to advance
Returns
# Returns
- the time granted to the [`Federate`](@ref), will return maximum time if the simulation has terminated invalid
"""
Expand Down Expand Up @@ -3862,7 +3862,7 @@ A global error halts the co-simulation completely
- `error_string`: a string describing the error
"""
function helicsFederateGlobalError(fed::Federate, error_code::Integer, error_string::String)
helicsFederateGlobalError(fed, code, error_string)
Lib.helicsFederateGlobalError(fed, code, error_string)
end

"""
Expand All @@ -3877,7 +3877,7 @@ This will propagate through the co-simulation but not necessarily halt the co-si
- `error_string`: a string describing the error
"""
function helicsFederateLocalError(fed::Federate, error_code::Integer, error_string::String)
helicsFederateLocalError(fed, code, error_string)
Lib.helicsFederateLocalError(fed, code, error_string)
end

"""
Expand All @@ -3891,3 +3891,75 @@ Add a time dependency for a [`Federate`](@ref). The [`Federate`](@ref) will dep
function helicsFederateAddDependency(fed::Federate, fedName::String)
@invoke_and_check helicsFederateAddDependency(fed, fedName)
end

"""
Check if an endpoint is valid.
# Arguments
- `endpoint`: The [`Endpoint`](@ref) object to check.
# Returns
`true` if the `Endpoint` object represents a valid endpoint.
"""
function helicsEndpointIsValid(endpoint::Endpoint)::Bool
Lib.helicsEndpointIsValid(endpoint)
end

"""
Send a [`Message`](@ref) object from a specific endpoint, the message will not be copied and the message object will no longer be valid after the call.
# Arguments
- `endpoint`: The [`Endpoint`](@ref) to send the data from.
- `message`: The actual [`Message`](@ref) to send which will be copied.
"""
function helicsEndpointSendMessageObjectZeroCopy(endpoint::Endpoint, message::Message)
@invoke_and_check Lib.helicsEndpointSendMessageObjectZeroCopy(endpoint, message)
end

"""
Check if a [`Filter`](@ref) is valid.
# Arguments
- `filt`: The [`Filter`](@ref) object to check.
# Returns
@return `true` if the [`Filter`](@ref) object represents a valid filter.
"""
function helicsFilterIsValid(filt::Filter)::Bool
Lib.helicsFilterIsValid(filt)
end

"""
Check if a [`Publication`](@ref) is valid.
# Arguments
- `pub`: The [`Publication`](@ref) object to check.
# Returns
@return `true` if the [`Publication`](@ref) object represents a valid publication.
"""
function helicsPublicationIsValid(pub::Publication)::Bool
Lib.helicsPublicationIsValid(pub)
end

"""
Check if a [`Input`](@ref) is valid.
# Arguments
- `ipt`: The [`Input`](@ref) object to check.
# Returns
@return `true` if the [`Input`](@ref) object represents a valid input.
"""
function helicsInputIsValid(ipt)::Bool
Lib.helicsInputIsValid(ipt)
end
26 changes: 13 additions & 13 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,21 @@ end
end

@cenum helics_error_types::Int32 begin
helics_ok = 0
helics_error_registration_failure = -1
helics_error_connection_failure = -2
helics_error_invalid_object = -3
helics_error_invalid_argument = -4
helics_error_discard = -5
helics_error_system_failure = -6
helics_warning = -8
helics_error_invalid_state_transition = -9
helics_error_invalid_function_call = -10
helics_error_execution_failure = -14
helics_error_insufficient_space = -18
helics_error_other = -101
helics_error_fatal = -404
helics_error_external_type = -203
helics_error_other = -101
helics_error_insufficient_space = -18
helics_error_execution_failure = -14
helics_error_invalid_function_call = -10
helics_error_invalid_state_transition = -9
helics_warning = -8
helics_error_system_failure = -6
helics_error_discard = -5
helics_error_invalid_argument = -4
helics_error_invalid_object = -3
helics_error_connection_failure = -2
helics_error_registration_failure = -1
helics_ok = 0
end

@cenum helics_properties::UInt32 begin
Expand Down
20 changes: 20 additions & 0 deletions src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function helicsFederateGetEndpointByIndex(fed, index, err)
ccall((:helicsFederateGetEndpointByIndex, libhelicsSharedLib), helics_endpoint, (helics_federate, Cint, Ptr{helics_error}), fed, index, err)
end

function helicsEndpointIsValid(endpoint)
ccall((:helicsEndpointIsValid, libhelicsSharedLib), helics_bool, (helics_endpoint,), endpoint)
end

function helicsEndpointSetDefaultDestination(endpoint, dest, err)
ccall((:helicsEndpointSetDefaultDestination, libhelicsSharedLib), Cvoid, (helics_endpoint, Cstring, Ptr{helics_error}), endpoint, dest, err)
end
Expand All @@ -42,6 +46,10 @@ function helicsEndpointSendMessageObject(endpoint, message, err)
ccall((:helicsEndpointSendMessageObject, libhelicsSharedLib), Cvoid, (helics_endpoint, helics_message_object, Ptr{helics_error}), endpoint, message, err)
end

function helicsEndpointSendMessageObjectZeroCopy(endpoint, message, err)
ccall((:helicsEndpointSendMessageObjectZeroCopy, libhelicsSharedLib), Cvoid, (helics_endpoint, helics_message_object, Ptr{helics_error}), endpoint, message, err)
end

function helicsEndpointSubscribe(endpoint, key, err)
ccall((:helicsEndpointSubscribe, libhelicsSharedLib), Cvoid, (helics_endpoint, Cstring, Ptr{helics_error}), endpoint, key, err)
end
Expand Down Expand Up @@ -261,6 +269,10 @@ function helicsFederateGetFilterByIndex(fed, index, err)
ccall((:helicsFederateGetFilterByIndex, libhelicsSharedLib), helics_filter, (helics_federate, Cint, Ptr{helics_error}), fed, index, err)
end

function helicsFilterIsValid(filt)
ccall((:helicsFilterIsValid, libhelicsSharedLib), helics_bool, (helics_filter,), filt)
end

function helicsFilterGetName(filt)
ccall((:helicsFilterGetName, libhelicsSharedLib), Cstring, (helics_filter,), filt)
end
Expand Down Expand Up @@ -380,6 +392,10 @@ function helicsFederatePublishJSON(fed, json, err)
ccall((:helicsFederatePublishJSON, libhelicsSharedLib), Cvoid, (helics_federate, Cstring, Ptr{helics_error}), fed, json, err)
end

function helicsPublicationIsValid(pub)
ccall((:helicsPublicationIsValid, libhelicsSharedLib), helics_bool, (helics_publication,), pub)
end

function helicsPublicationPublishRaw(pub, data, inputDataLength, err)
ccall((:helicsPublicationPublishRaw, libhelicsSharedLib), Cvoid, (helics_publication, Ptr{Cvoid}, Cint, Ptr{helics_error}), pub, data, inputDataLength, err)
end
Expand Down Expand Up @@ -424,6 +440,10 @@ function helicsPublicationAddTarget(pub, target, err)
ccall((:helicsPublicationAddTarget, libhelicsSharedLib), Cvoid, (helics_publication, Cstring, Ptr{helics_error}), pub, target, err)
end

function helicsInputIsValid(ipt)
ccall((:helicsInputIsValid, libhelicsSharedLib), helics_bool, (helics_input,), ipt)
end

function helicsInputAddTarget(ipt, target, err)
ccall((:helicsInputAddTarget, libhelicsSharedLib), Cvoid, (helics_input, Cstring, Ptr{helics_error}), ipt, target, err)
end
Expand Down
Loading

0 comments on commit a2ecb51

Please sign in to comment.