Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-01-13 19:26:02 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-13 19:26:02 +0300
commitc8d8380a2c6679ef0170d374d5f34354616e0e10 (patch)
tree4dc43a67edf60567ace4718a45a771f2018ad872 /src/GCodes/GCodeMachineState.h
parent36a72fd1cbc274a6f932294f184133e08d681858 (diff)
Various
FreelistManager in RRFLibraries now has its own namespace Class GCodeMachineState now uses FreelistManager to manage its storage Leading tabs are treated as going to the next multiple of 4 spaces from start of line or end of line number etc. Generate warning if both tabs and spaces are used to indent blocks
Diffstat (limited to 'src/GCodes/GCodeMachineState.h')
-rw-r--r--src/GCodes/GCodeMachineState.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/GCodes/GCodeMachineState.h b/src/GCodes/GCodeMachineState.h
index b63e9b18..303a3aa8 100644
--- a/src/GCodes/GCodeMachineState.h
+++ b/src/GCodes/GCodeMachineState.h
@@ -10,6 +10,7 @@
#include "RepRapFirmware.h"
#include "Storage/FileData.h"
+#include <General/FreelistManager.h>
// Enumeration to list all the possible states that the Gcode processing machine may be in
enum class GCodeState : uint8_t
@@ -160,7 +161,14 @@ public:
BlockType blockType; // the type of this block
};
+ void* operator new(size_t sz) noexcept { return FreelistManager::Allocate<GCodeMachineState>(); }
+ void operator delete(void* p) noexcept { FreelistManager::Release<GCodeMachineState>(p); }
+
GCodeMachineState() noexcept;
+ GCodeMachineState(GCodeMachineState&, bool withinSameFile) noexcept; // this chains the new one to the previous one
+ GCodeMachineState(const GCodeMachineState&) = delete; // copying these would be a bad idea
+
+ ~GCodeMachineState() noexcept;
GCodeMachineState *previous;
float feedRate;
@@ -200,9 +208,6 @@ public:
GCodeState state;
uint8_t toolChangeParam;
- static GCodeMachineState *Allocate() noexcept
- post(!result.IsLive(); result.state == GCodeState::normal);
-
bool DoingFile() const noexcept;
void CloseFile() noexcept;
@@ -224,14 +229,6 @@ public:
bool CreateBlock(uint16_t indentLevel) noexcept;
void EndBlock() noexcept;
-
- static void Release(GCodeMachineState *ms) noexcept;
- static unsigned int GetNumAllocated() noexcept { return numAllocated; }
- static unsigned int GetNumInUse() noexcept;
-
-private:
- static GCodeMachineState *freeList;
- static unsigned int numAllocated;
};
#endif /* SRC_GCODES_GCODEMACHINESTATE_H_ */