-
Notifications
You must be signed in to change notification settings - Fork 0
Compile time State Machine #549
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
af6b650
Full of errors, but moving forward
Cantonplas a07cac2
Avanzando bien fino, casi implementado
Cantonplas 2d10275
Vamos bien encaminados
Cantonplas 11fa6ea
Bruh
Cantonplas 4389c1a
Casi compila, casi
Cantonplas abf1f96
StateMachine compila, otras cosas no xd
Cantonplas 2f3d119
Some error fixing
Cantonplas 0f2b3ee
Se lleva el credito su prima en tanga
Cantonplas 31639a8
Compila por ahora??
Cantonplas ec5c6c7
Compiles without state orders
Cantonplas 8b8051b
Fixed StateOrder problems and some fixes on the state machine code
Cantonplas d4936a7
Now everything (nearly) is consteval
Cantonplas 7f13066
New concepts added to ensure StateEnum is a enum
Cantonplas 5af8647
Merge remote-tracking branch 'origin/development' into Refactor/state…
Cantonplas d338885
Much more checks with concepts, implemented scheduler logic
Cantonplas 84650b7
Testing needed, but might work
Cantonplas 2cc193d
Functional version?
Cantonplas 291aaa3
State Machine now works!!
Cantonplas 7c9b177
Moved static_vector to a seperate file
Cantonplas 3e67a21
Merge remote-tracking branch 'origin/development' into Refactor/state…
Cantonplas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #pragma once | ||
| #include <array> | ||
| #include "ErrorHandler/ErrorHandler.hpp" | ||
|
|
||
| template <typename T, size_t Capacity> | ||
| class StaticVector { | ||
| private: | ||
| std::array<T, Capacity> data{}; | ||
| size_t size_ = 0; | ||
|
|
||
| public: | ||
| constexpr StaticVector() = default; | ||
|
|
||
| template<typename... Args> | ||
| constexpr StaticVector(Args&&... args) : data{std::forward<Args>(args)...}, size_(sizeof...(args)) {} | ||
|
|
||
| constexpr bool operator==(const StaticVector&) const = default; | ||
|
|
||
| constexpr void push_back(const T& value) | ||
| { | ||
| if (size_ >= Capacity) | ||
| { | ||
| ErrorHandler("StaticVector capacity exceeded"); | ||
| return; | ||
| } | ||
| data[size_] = value; | ||
| size_++; | ||
| } | ||
|
|
||
| constexpr auto begin() { return data.begin(); } | ||
| constexpr auto begin() const { return data.begin(); } | ||
| constexpr auto end() { return data.begin() + size_; } | ||
| constexpr auto end() const { return data.begin() + size_; } | ||
|
|
||
| constexpr const std::array<T, Capacity>& get_array() const { return data; } | ||
| constexpr size_t size() const { return size_; } | ||
| constexpr T* get_data() { return data.data(); } | ||
| constexpr const T* get_data() const { return data.data(); } | ||
| constexpr T& operator[](size_t i) { return data[i]; } | ||
| constexpr const T& operator[](size_t i) const { return data[i]; } | ||
| constexpr bool contains(const T& value) const | ||
| { | ||
| for (size_t i = 0; i < size_; ++i) | ||
| { | ||
| if (data[i] == value) | ||
| { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| }; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.