-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprocessing_flags.hpp
35 lines (29 loc) · 1009 Bytes
/
processing_flags.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//================================================================================================
/// @file processing_flags.hpp
///
/// @brief A class that manages 1 bit flags. Handy as a retry machanism for sending CAN messages.
/// @author Adrian Del Grosso
///
/// @copyright 2022 The Open-Agriculture Developers
//================================================================================================
#ifndef PROCESSING_FLAGS_HPP
#define PROCESSING_FLAGS_HPP
#include <cstdint>
namespace isobus
{
class ProcessingFlags
{
public:
typedef void (*ProcessFlagsCallback)(std::uint32_t flag, void *parentPointer);
ProcessingFlags(std::uint32_t numberOfFlags, ProcessFlagsCallback processingCallback, void *parentPointer);
~ProcessingFlags();
void set_flag(std::uint32_t flag);
void process_all_flags();
private:
ProcessFlagsCallback callback;
const std::uint32_t maxFlag;
std::uint8_t *flagBitfield;
void *parent;
};
} // namespace isobus
#endif // PROCESSING_FLAGS_HPP