2020-12-14 11:43:08 +01:00
|
|
|
#ifndef FSFW_SUBSYSTEM_MODES_MODESTORE_H_
|
|
|
|
#define FSFW_SUBSYSTEM_MODES_MODESTORE_H_
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-12-14 11:34:54 +01:00
|
|
|
#include <FSFWConfig.h>
|
|
|
|
|
|
|
|
#if FSFW_USE_MODESTORE == 1
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-14 11:43:08 +01:00
|
|
|
#include "ModeStoreIF.h"
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../../container/ArrayList.h"
|
|
|
|
#include "../../container/SinglyLinkedList.h"
|
|
|
|
#include "../../objectmanager/SystemObject.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class ModeStore: public ModeStoreIF, public SystemObject {
|
|
|
|
public:
|
|
|
|
ModeStore(object_id_t objectId, uint32_t slots);
|
|
|
|
virtual ~ModeStore();
|
|
|
|
|
|
|
|
virtual ReturnValue_t storeArray(ArrayList<ModeListEntry> *sequence,
|
|
|
|
ModeListEntry **storedFirstEntry);
|
|
|
|
|
|
|
|
virtual ReturnValue_t deleteList(
|
|
|
|
ModeListEntry *sequence);
|
|
|
|
|
|
|
|
virtual ReturnValue_t readList(
|
|
|
|
ModeListEntry *sequence,
|
|
|
|
ArrayList<ModeListEntry> *into);
|
|
|
|
|
|
|
|
virtual uint32_t getFreeSlots();
|
|
|
|
|
|
|
|
private:
|
|
|
|
MutexId_t* mutex;
|
|
|
|
ArrayList<ModeListEntry, uint32_t> store;
|
|
|
|
ModeListEntry *emptySlot;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
ModeListEntry* findEmptySlotNoLock(
|
|
|
|
ModeListEntry* startFrom);
|
|
|
|
void deleteListNoLock(
|
|
|
|
ModeListEntry *sequence);
|
|
|
|
|
|
|
|
ReturnValue_t isValidEntry(ModeListEntry *sequence);
|
|
|
|
};
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
#endif
|
|
|
|
|
2020-12-14 11:43:08 +01:00
|
|
|
#endif /* FSFW_SUBSYSTEM_MODES_MODESTORE_H_ */
|
2016-06-15 23:48:41 +02:00
|
|
|
|