Skip to content

Conversation

drewr95
Copy link
Contributor

@drewr95 drewr95 commented Jan 12, 2025

Initial implementation of signal for #666

I implemented something very similar to this on other software and thought this would be useful for this project. I would like to use this version over my other implementation.

Some other things that could be added at some point is being able to pass in an aggregator or some kind of module that can act on all the signals (think sumnation, product, etc).

@drewr95 drewr95 changed the title Implement Signal Library Implement Signal Jan 12, 2025
///\todo Support for return types other than void (aggregate etc.)
//***************************************************************************
template <typename T, size_t LENGTH, typename TSlot = etl::delegate<T>>
class signal final
Copy link
Contributor

@jwellbelove jwellbelove Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this class is meant to support C++03 then you should use ETL_FINAL.

You can check basic compatibility from C++03 to C++20 by running the script etl/test/run-syntax-checks.sh on Linux. You need both GCC and clang installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My primary goal was to be c++14 compliant since that is what I use, but I tried to be as lower compliant as possible. I didn't know that script existed, thanks, I'll run it and see what I find :)

@jwellbelove
Copy link
Contributor

I'll pull what you currently have to a branch, so I can have a play with it.

@jwellbelove jwellbelove changed the base branch from master to pull-request/#1012-Implement-Signal January 25, 2025 10:51
@jwellbelove jwellbelove merged commit b826d69 into ETLCPP:pull-request/#1012-Implement-Signal Jan 25, 2025
63 checks passed
@drewr95
Copy link
Contributor Author

drewr95 commented Jan 27, 2025

I'll pull what you currently have to a branch, so I can have a play with it.

Yeah that's fine, thank you for looking at this. Sorry, work has gotten busy and so I've been putting this off. Feel free to separate via 03 vs 11+ if you'd like or however you see fit. I know some places have a *_legacy header.

@jwellbelove
Copy link
Contributor

I know for sure that people will be asking how to use this across threads.
Have you tried doing this yet?
With the ETL messaging framework you can use thread safe queues to manage this. I'm not sure yet how it would be managed with signals.

@drewr95
Copy link
Contributor Author

drewr95 commented Feb 23, 2025

I know for sure that people will be asking how to use this across threads. Have you tried doing this yet? With the ETL messaging framework you can use thread safe queues to manage this. I'm not sure yet how it would be managed with signals.

@jwellbelove No we are still single process here though we are about to go multi-core at some point. Would you mind keeping me in the loop? I'd like to stay informed as that is not my expertise :)

jwellbelove pushed a commit that referenced this pull request May 26, 2025
* feat: initial implementation of signal

* feat: correctly calculate the end iterator

* test: construct of signal

* feat: add connected method

* test: connecting a slot to a signal

* feat: use ETL_CONSTEXPR14 for begin() and end()

* test: disconnect slots from signal

* test: disconnecting all slots from the signal

* test: calling a signal

* test: expected string

* feat: include algorithm

* test: fix broken construct test for constexpr object

* test: call empty

* feat: add support for cxx03

* test: create test object for each test

* feat: handle for cpp11 supported

* style: formatted #if

* test: only make a constexpr one for c++14 and on

* feat: fix windows 32bit compile issues with any_of usage

* feat: support constructing lambda delegate

for cxx11

* refactor: remove unecessary check if signal is

empty when disconnecting a signal

* refactor: make _end be constexpr

---------

Co-authored-by: Drew Rife <[email protected]>
jwellbelove pushed a commit that referenced this pull request May 26, 2025
jwellbelove pushed a commit that referenced this pull request May 26, 2025
jwellbelove pushed a commit that referenced this pull request May 26, 2025
jwellbelove pushed a commit that referenced this pull request Aug 19, 2025
# Conflicts:
#	.gitignore
#	arduino/library-arduino.json
#	arduino/library-arduino.properties
#	include/etl/basic_string.h
#	include/etl/file_error_numbers.h
#	include/etl/hfsm.h
#	include/etl/memory.h
#	include/etl/string_view.h
#	include/etl/version.h
#	library.json
#	library.properties
#	support/Release notes.txt
#	test/test_hfsm.cpp
#	test/test_string_utilities.cpp
#	test/vs2022/etl.vcxproj.filters
#	version.txt
jwellbelove pushed a commit that referenced this pull request Aug 20, 2025
* feat: initial implementation of signal

* feat: correctly calculate the end iterator

* test: construct of signal

* feat: add connected method

* test: connecting a slot to a signal

* feat: use ETL_CONSTEXPR14 for begin() and end()

* test: disconnect slots from signal

* test: disconnecting all slots from the signal

* test: calling a signal

* test: expected string

* feat: include algorithm

* test: fix broken construct test for constexpr object

* test: call empty

* feat: add support for cxx03

* test: create test object for each test

* feat: handle for cpp11 supported

* style: formatted #if

* test: only make a constexpr one for c++14 and on

* feat: fix windows 32bit compile issues with any_of usage

* feat: support constructing lambda delegate

for cxx11

* refactor: remove unecessary check if signal is

empty when disconnecting a signal

* refactor: make _end be constexpr

---------

Co-authored-by: Drew Rife <[email protected]>

Added -Wformat-security

Optimisation of strings

Optimisation of strings

Optimisation of strings

Optimisation of strings

Optimisation of strings

Updated release

Added #include "file_error_numbers.h"

Fixed conditional compilation

Added ability to use call_if when using etl::delegate as the slot_type

Fixed conditional compilation

Added ability to use call_if when using etl::delegate as the slot_type

# Conflicts:
#	include/etl/signal.h

Fixed conditional compilation

Added ability to use call_if when using etl::delegate as the slot_type

# Conflicts:
#	include/etl/signal.h

Fixed unused parameter

Added etl::trivial_vector

More trivial_vector functions

Abandoned trivial_vector experiment.

Work in progress

Work in progress

Work in progress

Project updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants