Some examples using the ArduinoSTL library.
The file newhandler.cpp has been patched to avoid the double definition of no_throw.
I have also patched new.cpp as well for the Arduino 1.5.1 ArduinoBoostFunction example.
Basic example compiles O.K. on a UNO
Compiles O.K. on a UNO
Simple vector example with range based for loop example. Compiles O.K. on a UNO
Example of the Composite Pattern which is now working. Compiles O.K. on a UNO
Example of the Composite Pattern with the composite classes in a header.
Example of the Composite Pattern with the composite classes in a header.
Using list instead of vector for the children.
The code has been changed to use a different example from refactoring.guru.
This supports holding parent information (on one parent).
I have retained the support of named items and added GetName to return the information.
This extends the previous example to allow for multiple parents.
I have now used this as a starting point for SignalComposite.
Implementation of the Observer Pattern from previous code.
I want to explore combining Observer and Composite.
I am exploring another simpler implementation of the Observer Pattern.
The example source is not complete code and there are also alternative suggestions.
This compiles without a working example.
Alternative suggestions.
It is not possible to implement some features of this proposal on the ArduinoSTL system.
There are several ways to approach this.
- Attempt to work around within this proposal e.g use Boost function instead of std::function. I have tried this. There are problems with both of the Boost versions I have.
- Merge the two ways together avoiding the features which are not supported.
- Move this idea to another system e.g. Raspberry Pi PICO.
Attempt to work with Boost. This has failed as I cannot sort out the clashes between libraries.
I am going instead to work around things for the ARM boards. This is looking more promising.
I now have this working. For some reason it runs more than once from compilation.
This version has the Observer code moved to a header file.