mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-06 01:37:33 +00:00
Added ALL_STATES define
This commit is contained in:
@@ -69,6 +69,23 @@
|
||||
|
||||
#include <functional>
|
||||
#include <tuple>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Addresses all states from 0 to STA_TACOS_NUM_STATES-1.
|
||||
*
|
||||
* @ingroup tacos_statemachine
|
||||
*/
|
||||
#define ALL_STATES std::set<uint16_t>{[]{ std::set<uint16_t> states; for (uint16_t i = 0; i < STA_TACOS_NUM_STATES; ++i) states.insert(i); return states; }() }
|
||||
|
||||
/**
|
||||
* @brief Shorthand to make own sets of states. Primarily for exlcusion via "-" operator.
|
||||
*
|
||||
* @ingroup tacos_statemachine
|
||||
*/
|
||||
#define state_set std::set<uint16_t>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
@@ -204,4 +221,12 @@ namespace sta
|
||||
|
||||
#endif // STA_TACOS_NUM_STATES
|
||||
|
||||
/// Overwrite "-" operator for set.
|
||||
template <typename T>
|
||||
std::set<T> operator-(const std::set<T>& set1, const std::set<T>& set2) {
|
||||
std::set<T> result;
|
||||
std::set_difference(set1.begin(), set1.end(), set2.begin(), set2.end(), std::inserter(result, result.begin()));
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* INCLUDE_TACOS_STATEMACHINE_HPP_ */
|
||||
|
Reference in New Issue
Block a user