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 13
13
"[cmake]" : {
14
14
"editor.detectIndentation" : false ,
15
15
"editor.insertSpaces" : false ,
16
+ },
17
+ "files.associations" : {
18
+ "*.vue" : " vue" ,
19
+ "thread" : " cpp"
16
20
}
17
21
}
Original file line number Diff line number Diff line change 45
45
#include " ArduinoJson/Array/ElementProxy.hpp"
46
46
#include " ArduinoJson/Array/Utilities.hpp"
47
47
#include " ArduinoJson/Collection/CollectionImpl.hpp"
48
- #include " ArduinoJson/Memory/ResourceManagerImpl.hpp"
49
48
#include " ArduinoJson/Object/MemberProxy.hpp"
50
49
#include " ArduinoJson/Object/ObjectImpl.hpp"
51
50
#include " ArduinoJson/Variant/ConverterImpl.hpp"
Original file line number Diff line number Diff line change @@ -57,14 +57,42 @@ class ResourceManager {
57
57
return overflowed_;
58
58
}
59
59
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
+ }
63
77
64
78
#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
+ }
68
96
#endif
69
97
70
98
template <typename TAdaptedString>
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments