CTRE Phoenix C++ 5.33.1
SequentialScheduler.h
Go to the documentation of this file.
1/* Copyright (C) Cross The Road Electronics 2024 */
2#pragma once
3
4#include <vector>
7
8namespace ctre { namespace phoenix { namespace tasking { namespace schedulers {
9
10/**
11 * Scheduler that will run its ILoopables in sequence
12 */
14public:
15 /** should be private */
16 bool _running = false;
17 /** should be private */
18 std::vector<ILoopable*> _loops;
19 /** should be private */
20 unsigned int _idx = 0;
21 /** should be private */
22 bool _iterated = false;
23
26
27 /**
28 * Add ILoopable to scheduler
29 * @param aLoop ILoopable to add
30 */
31 void Add(ILoopable *aLoop);
32 /**
33 * Get the currently running ILoopable
34 * @return null, not implemented
35 */
37 /**
38 * Remove all ILoopables
39 */
40 void RemoveAll();
41 /**
42 * Start next ILoopable
43 */
44 void Start();
45 /**
46 * Stop every ILoopable
47 */
48 void Stop();
49
50 //IProcessable
51 /**
52 * Process the currently active ILoopable
53 *
54 * Call this every loop
55 */
56 void Process();
57
58 //ILoopable
59 /**
60 * Start next ILoopable
61 */
62 void OnStart();
63 /**
64 * Process currently active ILoopable
65 */
66 void OnLoop();
67 /**
68 * Stop all ILoopables
69 */
70 void OnStop();
71 /**
72 * @return true when no longer running
73 */
74 bool IsDone();
75};
76}}}}
Interface for loopable objects.
Definition: ILoopable.h:9
Interface for processable objects.
Definition: IProcessable.h:8
Scheduler that will run its ILoopables in sequence.
Definition: SequentialScheduler.h:13
bool _iterated
should be private
Definition: SequentialScheduler.h:22
bool _running
should be private
Definition: SequentialScheduler.h:16
void Add(ILoopable *aLoop)
Add ILoopable to scheduler.
void Process()
Process the currently active ILoopable.
void OnLoop()
Process currently active ILoopable.
std::vector< ILoopable * > _loops
should be private
Definition: SequentialScheduler.h:18
ILoopable * GetCurrent()
Get the currently running ILoopable.
unsigned int _idx
should be private
Definition: SequentialScheduler.h:20
namespace ctre
Definition: paramEnum.h:5