File tree Expand file tree Collapse file tree 4 files changed +38
-57
lines changed Expand file tree Collapse file tree 4 files changed +38
-57
lines changed Original file line number Diff line number Diff line change 1313 "[cmake]" : {
1414 "editor.detectIndentation" : false ,
1515 "editor.insertSpaces" : false ,
16+ },
17+ "files.associations" : {
18+ "*.vue" : " vue" ,
19+ "thread" : " cpp"
1620 }
1721}
Original file line number Diff line number Diff line change 4545#include " ArduinoJson/Array/ElementProxy.hpp"
4646#include " ArduinoJson/Array/Utilities.hpp"
4747#include " ArduinoJson/Collection/CollectionImpl.hpp"
48- #include " ArduinoJson/Memory/ResourceManagerImpl.hpp"
4948#include " ArduinoJson/Object/MemberProxy.hpp"
5049#include " ArduinoJson/Object/ObjectImpl.hpp"
5150#include " ArduinoJson/Variant/ConverterImpl.hpp"
Original file line number Diff line number Diff line change @@ -57,14 +57,42 @@ class ResourceManager {
5757 return overflowed_;
5858 }
5959
60- Slot<VariantData> allocVariant ();
61- void freeVariant (Slot<VariantData> slot);
62- VariantData* getVariant (SlotId id) const ;
60+ Slot<VariantData> allocVariant () {
61+ auto slot = variantPools_.allocSlot (allocator_);
62+ if (!slot) {
63+ overflowed_ = true ;
64+ return {};
65+ }
66+ new (slot.ptr ()) VariantData ();
67+ return slot;
68+ }
69+
70+ void freeVariant (Slot<VariantData> slot) {
71+ variantPools_.freeSlot (slot);
72+ }
73+
74+ VariantData* getVariant (SlotId id) const {
75+ return variantPools_.getSlot (id);
76+ }
6377
6478#if ARDUINOJSON_USE_8_BYTE_POOL
65- Slot<EightByteValue> allocEightByte ();
66- void freeEightByte (SlotId slot);
67- EightByteValue* getEightByte (SlotId id) const ;
79+ Slot<EightByteValue> allocEightByte () {
80+ auto slot = eightBytePools_.allocSlot (allocator_);
81+ if (!slot) {
82+ overflowed_ = true ;
83+ return {};
84+ }
85+ return slot;
86+ }
87+
88+ void freeEightByte (SlotId id) {
89+ auto p = getEightByte (id);
90+ eightBytePools_.freeSlot ({p, id});
91+ }
92+
93+ EightByteValue* getEightByte (SlotId id) const {
94+ return eightBytePools_.getSlot (id);
95+ }
6896#endif
6997
7098 template <typename TAdaptedString>
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments