Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HELICS 3.5.1 RECONNECTABLE handle option #93

Merged
merged 10 commits into from
Mar 26, 2024
6 changes: 5 additions & 1 deletion helics/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ class HelicsHandleOption(IntEnum):
- **SINGLE_CONNECTION_ONLY**
- **MULTIPLE_CONNECTIONS_ALLOWED**
- **BUFFER_DATA**
- **RECONNECTABLE**
- **STRICT_TYPE_CHECKING**
- **RECEIVE_ONLY**
- **SOURCE_ONLY**
Expand All @@ -713,6 +714,7 @@ class HelicsHandleOption(IntEnum):
SINGLE_CONNECTION_ONLY = 407 # HelicsHandleOptions
MULTIPLE_CONNECTIONS_ALLOWED = 409 # HelicsHandleOptions
BUFFER_DATA = 411 # HelicsHandleOptions
RECONNECTABLE = 412 # HelicsHandleOptions
STRICT_TYPE_CHECKING = 414 # HelicsHandleOptions
RECEIVE_ONLY = 422 # HelicsHandleOptions
SOURCE_ONLY = 423 # HelicsHandleOptions
Expand All @@ -724,13 +726,14 @@ class HelicsHandleOption(IntEnum):
INPUT_PRIORITY_LOCATION = 510 # HelicsHandleOptions
CLEAR_PRIORITY_LIST = 512 # HelicsHandleOptions
CONNECTIONS = 522 # HelicsHandleOptions


HELICS_HANDLE_OPTION_CONNECTION_REQUIRED = HelicsHandleOption.CONNECTION_REQUIRED
HELICS_HANDLE_OPTION_CONNECTION_OPTIONAL = HelicsHandleOption.CONNECTION_OPTIONAL
HELICS_HANDLE_OPTION_SINGLE_CONNECTION_ONLY = HelicsHandleOption.SINGLE_CONNECTION_ONLY
HELICS_HANDLE_OPTION_MULTIPLE_CONNECTIONS_ALLOWED = HelicsHandleOption.MULTIPLE_CONNECTIONS_ALLOWED
HELICS_HANDLE_OPTION_BUFFER_DATA = HelicsHandleOption.BUFFER_DATA
HELICS_HANDLE_OPTION_RECONNECTABLE = HelicsHandleOption.RECONNECTABLE
HELICS_HANDLE_OPTION_STRICT_TYPE_CHECKING = HelicsHandleOption.STRICT_TYPE_CHECKING
HELICS_HANDLE_OPTION_RECEIVE_ONLY = HelicsHandleOption.RECEIVE_ONLY
HELICS_HANDLE_OPTION_SOURCE_ONLY = HelicsHandleOption.SOURCE_ONLY
Expand All @@ -748,6 +751,7 @@ class HelicsHandleOption(IntEnum):
helics_handle_option_single_connection_only = HelicsHandleOption.SINGLE_CONNECTION_ONLY
helics_handle_option_multiple_connections_allowed = HelicsHandleOption.MULTIPLE_CONNECTIONS_ALLOWED
helics_handle_option_buffer_data = HelicsHandleOption.BUFFER_DATA
helics_handle_option_reconnectable = HelicsHandleOption.RECONNECTABLE
helics_handle_option_strict_type_checking = HelicsHandleOption.STRICT_TYPE_CHECKING
helics_handle_option_receive_only = HelicsHandleOption.RECEIVE_ONLY
helics_handle_option_source_only = HelicsHandleOption.SOURCE_ONLY
Expand Down
8 changes: 4 additions & 4 deletions tests/test_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_python_api0():
in repr(sub)
)
assert (
"""{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 1, 'BUFFER_DATA' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = -1, 'CLEAR_PRIORITY_LIST' = 1, 'CONNECTIONS' = 0 }"""
"""{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 1, 'BUFFER_DATA' = 0, 'RECONNECTABLE' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = -1, 'CLEAR_PRIORITY_LIST' = 1, 'CONNECTIONS' = 0 }"""
in repr(sub.option)
)
sub.option["CONNECTION_REQUIRED"] = 1
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_python_api1():
in repr(sub)
)
assert (
"""{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 1, 'BUFFER_DATA' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = -1, 'CLEAR_PRIORITY_LIST' = 1, 'CONNECTIONS' = 0 }"""
"""{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 1, 'BUFFER_DATA' = 0, 'RECONNECTABLE' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = -1, 'CLEAR_PRIORITY_LIST' = 1, 'CONNECTIONS' = 0 }"""
in repr(sub.option)
)
sub.option["CONNECTION_REQUIRED"] = 1
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_python_api1():
assert sub.info == "hello world"

assert (
"""{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 1, 'BUFFER_DATA' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = 0, 'CLEAR_PRIORITY_LIST' = 0, 'CONNECTIONS' = 0 }"""
"""{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 1, 'BUFFER_DATA' = 0, 'RECONNECTABLE' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = 0, 'CLEAR_PRIORITY_LIST' = 0, 'CONNECTIONS' = 0 }"""
in repr(mFed.publications["TestFederate/publication"].option)
)
mFed.publications["TestFederate/publication"].option["CONNECTION_REQUIRED"] = 1
Expand Down Expand Up @@ -449,7 +449,7 @@ def test_python_api3():
source_filter1.add_source_target("ep1")

assert (
"""<{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 0, 'BUFFER_DATA' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = 0, 'CLEAR_PRIORITY_LIST' = 0, 'CONNECTIONS' = 0 }>"""
"""<{ 'CONNECTION_REQUIRED' = 0, 'CONNECTION_OPTIONAL' = 0, 'SINGLE_CONNECTION_ONLY' = 0, 'MULTIPLE_CONNECTIONS_ALLOWED' = 0, 'BUFFER_DATA' = 0, 'RECONNECTABLE' = 0, 'STRICT_TYPE_CHECKING' = 0, 'RECEIVE_ONLY' = 0, 'SOURCE_ONLY' = 0, 'IGNORE_UNIT_MISMATCH' = 0, 'ONLY_TRANSMIT_ON_CHANGE' = 0, 'ONLY_UPDATE_ON_CHANGE' = 0, 'IGNORE_INTERRUPTS' = 0, 'MULTI_INPUT_HANDLING_METHOD' = 0, 'INPUT_PRIORITY_LOCATION' = 0, 'CLEAR_PRIORITY_LIST' = 0, 'CONNECTIONS' = 0 }>"""
in repr(source_filter1.option)
)

Expand Down
Loading