diff --git a/packages/logging/source/common/Log.cpp b/packages/logging/source/common/Log.cpp index 63741d48..7cbf0923 100644 --- a/packages/logging/source/common/Log.cpp +++ b/packages/logging/source/common/Log.cpp @@ -105,6 +105,10 @@ namespace logging { } }; Logger::~Logger() { + if (mCondition && (mLevel == LogLevel::LogExpection || mLevel == LogLevel::LogAssertion)) { + return; + } + mStream.flush(); std::string msg = mStream.str(); mStream.str(""); @@ -116,24 +120,25 @@ namespace logging { case LogLevel::LogWarning: case LogLevel::LogError: case LogLevel::LogTest: + case LogLevel::LogTitle: break; case LogLevel::LogExpection: if (!mCondition) { // Breaking runtime condition, show popup? } - else { - msg.clear(); // Error message should not be displayed if condition was right - } + // already handled in early return + //else { + // msg.clear(); // Error message should not be displayed if condition was right + //} break; case LogLevel::LogAssertion: if (!mCondition) { DEBUG_BREAK; } - else { - msg.clear(); // Error message should not be displayed if condition was right - } - break; - case LogLevel::LogTitle: + // already handled in early return + //else { + // msg.clear(); // Error message should not be displayed if condition was right + //} break; } diff --git a/packages/memory/include/memory/Arena.h b/packages/memory/include/memory/Arena.h index 0d20e591..b7a71f02 100644 --- a/packages/memory/include/memory/Arena.h +++ b/packages/memory/include/memory/Arena.h @@ -25,12 +25,13 @@ namespace l::memory { class Arena { public: Arena(); + Arena(void* ptr, uint64_t size); ~Arena(); std::vector mBlocks; }; - std::unique_ptr CreateArena(); + std::unique_ptr CreateArena(void* ptr = nullptr, uint64_t size = 0); // push some bytes onto the 'stack' - the way to allocate void* ArenaPush(Arena* arena, uint64_t size); diff --git a/packages/memory/source/common/Arena.cpp b/packages/memory/source/common/Arena.cpp index e8e070ea..e3751aa7 100644 --- a/packages/memory/source/common/Arena.cpp +++ b/packages/memory/source/common/Arena.cpp @@ -19,13 +19,16 @@ namespace l::memory { mBlocks.reserve(16); } + Arena::Arena(void* ptr, uint64_t size) { + mBlocks.push_back({ ptr, size }); + } Arena::~Arena() { } - std::unique_ptr CreateArena() { - return std::make_unique(); + std::unique_ptr CreateArena(void* ptr, uint64_t size) { + return std::make_unique(ptr, size); } diff --git a/packages/memory/tests/common/ArenaTest.cpp b/packages/memory/tests/common/ArenaTest.cpp new file mode 100644 index 00000000..14fc7125 --- /dev/null +++ b/packages/memory/tests/common/ArenaTest.cpp @@ -0,0 +1,18 @@ +#include "testing/Test.h" +#include "logging/Log.h" + +#include "memory/Arena.h" + +using namespace l; + +TEST(Arena, Basic) { + + auto arena = memory::CreateArena(); + + auto a = memory::ArenaPush(arena.get(), 10); + + TEST_TRUE(a != nullptr, ""); + + return 0; +} + diff --git a/packages/serialization/include/serialization/CommaSeparatedData.h b/packages/serialization/include/serialization/TrivialData.h similarity index 94% rename from packages/serialization/include/serialization/CommaSeparatedData.h rename to packages/serialization/include/serialization/TrivialData.h index 8f50d710..08bc9430 100644 --- a/packages/serialization/include/serialization/CommaSeparatedData.h +++ b/packages/serialization/include/serialization/TrivialData.h @@ -6,7 +6,7 @@ #include "logging/String.h" -namespace l::storage { +namespace l::serialization { template std::pair> ParseTrivialData(std::stringstream& data, std::string_view separators) { diff --git a/packages/serialization/source/common/CommaSeparatedData.cpp b/packages/serialization/source/common/CommaSeparatedData.cpp deleted file mode 100644 index 00d2684e..00000000 --- a/packages/serialization/source/common/CommaSeparatedData.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "serialization/CommaSeparatedData.h" - -#include "logging/LoggingAll.h" - -#include -#include - -namespace l::storage { - -}