diff --git a/cmake-build-release/.cmake/api/v1/reply/directory-libraries.parallel-hashmap-Release-7c6bf3ade793ba1bc88b.json b/cmake-build-release/.cmake/api/v1/reply/directory-libraries.parallel-hashmap-Release-7c6bf3ade793ba1bc88b.json deleted file mode 100644 index f0d5537..0000000 --- a/cmake-build-release/.cmake/api/v1/reply/directory-libraries.parallel-hashmap-Release-7c6bf3ade793ba1bc88b.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "backtraceGraph" : - { - "commands" : [], - "files" : [], - "nodes" : [] - }, - "installers" : [], - "paths" : - { - "build" : "libraries/parallel-hashmap", - "source" : "libraries/parallel-hashmap" - } -} diff --git a/cmake-build-release/CMakeCache.txt b/cmake-build-release/CMakeCache.txt index c44e71f..1587c2a 100644 --- a/cmake-build-release/CMakeCache.txt +++ b/cmake-build-release/CMakeCache.txt @@ -376,7 +376,7 @@ CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 //ADVANCED property for variable: CMAKE_NM CMAKE_NM-ADVANCED:INTERNAL=1 //number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=2 +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 //ADVANCED property for variable: CMAKE_OBJCOPY CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 //ADVANCED property for variable: CMAKE_OBJDUMP diff --git a/cmake-build-release/CMakeFiles/TargetDirectories.txt b/cmake-build-release/CMakeFiles/TargetDirectories.txt index bc49305..ae9d943 100644 --- a/cmake-build-release/CMakeFiles/TargetDirectories.txt +++ b/cmake-build-release/CMakeFiles/TargetDirectories.txt @@ -2,5 +2,3 @@ /home/brett/Documents/code/c++/BLT/cmake-build-release/CMakeFiles/BLT_TESTS.dir /home/brett/Documents/code/c++/BLT/cmake-build-release/CMakeFiles/edit_cache.dir /home/brett/Documents/code/c++/BLT/cmake-build-release/CMakeFiles/rebuild_cache.dir -/home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap/CMakeFiles/edit_cache.dir -/home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap/CMakeFiles/rebuild_cache.dir diff --git a/cmake-build-release/CMakeFiles/clion-Release-log.txt b/cmake-build-release/CMakeFiles/clion-Release-log.txt index ecb497e..3cd8cbb 100644 --- a/cmake-build-release/CMakeFiles/clion-Release-log.txt +++ b/cmake-build-release/CMakeFiles/clion-Release-log.txt @@ -1,5 +1,4 @@ /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -DBUILD_TESTS:BOOL=ON -G Ninja -S /home/brett/Documents/code/c++/BLT -B /home/brett/Documents/code/c++/BLT/cmake-build-release --- Detected PHMAP Version - 1.3.8 Standard Files /home/brett/Documents/code/c++/BLT/src/blt/std/format.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/logging.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/system.cpp Profiler Files /home/brett/Documents/code/c++/BLT/src/blt/profiling/profiler.cpp Source: /home/brett/Documents/code/c++/BLT diff --git a/cmake-build-release/build.ninja b/cmake-build-release/build.ninja index 2878899..a8d7b9c 100644 --- a/cmake-build-release/build.ninja +++ b/cmake-build-release/build.ninja @@ -77,6 +77,13 @@ build CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o: CXX_COMPILER__BLT_Rel OBJECT_DIR = CMakeFiles/BLT.dir OBJECT_FILE_DIR = CMakeFiles/BLT.dir/src/blt/profiling +build CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o: CXX_COMPILER__BLT_Release /home/brett/Documents/code/c++/BLT/src/blt/nbt/nbt_block.cpp || cmake_object_order_depends_target_BLT + DEP_FILE = CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o.d + FLAGS = -O3 -DNDEBUG -fdiagnostics-color=always + INCLUDES = -I/home/brett/Documents/code/c++/BLT/include + OBJECT_DIR = CMakeFiles/BLT.dir + OBJECT_FILE_DIR = CMakeFiles/BLT.dir/src/blt/nbt + # ============================================================================= # Link build statements for STATIC_LIBRARY target BLT @@ -85,7 +92,7 @@ build CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o: CXX_COMPILER__BLT_Rel ############################################# # Link the static library libBLT.a -build libBLT.a: CXX_STATIC_LIBRARY_LINKER__BLT_Release CMakeFiles/BLT.dir/src/blt/std/format.cpp.o CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o CMakeFiles/BLT.dir/src/blt/std/system.cpp.o CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o +build libBLT.a: CXX_STATIC_LIBRARY_LINKER__BLT_Release CMakeFiles/BLT.dir/src/blt/std/format.cpp.o CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o CMakeFiles/BLT.dir/src/blt/std/system.cpp.o CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o LANGUAGE_COMPILE_FLAGS = -O3 -DNDEBUG OBJECT_DIR = CMakeFiles/BLT.dir POST_BUILD = : @@ -150,34 +157,6 @@ build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND build rebuild_cache: phony CMakeFiles/rebuild_cache.util -# ============================================================================= -# Write statements declared in CMakeLists.txt: -# /home/brett/Documents/code/c++/BLT/CMakeLists.txt -# ============================================================================= - - -############################################# -# Utility command for edit_cache - -build libraries/parallel-hashmap/CMakeFiles/edit_cache.util: CUSTOM_COMMAND - COMMAND = cd /home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap && /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. - DESC = No interactive CMake dialog available... - restat = 1 - -build libraries/parallel-hashmap/edit_cache: phony libraries/parallel-hashmap/CMakeFiles/edit_cache.util - - -############################################# -# Utility command for rebuild_cache - -build libraries/parallel-hashmap/CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND - COMMAND = cd /home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap && /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake --regenerate-during-build -S/home/brett/Documents/code/c++/BLT -B/home/brett/Documents/code/c++/BLT/cmake-build-release - DESC = Running CMake to regenerate build system... - pool = console - restat = 1 - -build libraries/parallel-hashmap/rebuild_cache: phony libraries/parallel-hashmap/CMakeFiles/rebuild_cache.util - # ============================================================================= # Target aliases. @@ -191,14 +170,7 @@ build BLT: phony libBLT.a ############################################# # Folder: /home/brett/Documents/code/c++/BLT/cmake-build-release -build all: phony libBLT.a BLT_TESTS libraries/parallel-hashmap/all - -# ============================================================================= - -############################################# -# Folder: /home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap - -build libraries/parallel-hashmap/all: phony +build all: phony libBLT.a BLT_TESTS # ============================================================================= # Built-in targets @@ -207,14 +179,14 @@ build libraries/parallel-hashmap/all: phony ############################################# # Re-run CMake if any of its inputs changed. -build build.ninja: RERUN_CMAKE | /home/brett/Documents/code/c++/BLT/CMakeLists.txt /home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap/CMakeLists.txt /home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap/cmake/DetectVersion.cmake /home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap/cmake/helpers.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.24.2/CMakeCCompiler.cmake CMakeFiles/3.24.2/CMakeCXXCompiler.cmake CMakeFiles/3.24.2/CMakeSystem.cmake +build build.ninja: RERUN_CMAKE | /home/brett/Documents/code/c++/BLT/CMakeLists.txt /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.24.2/CMakeCCompiler.cmake CMakeFiles/3.24.2/CMakeCXXCompiler.cmake CMakeFiles/3.24.2/CMakeSystem.cmake pool = console ############################################# # A missing CMake input file is not an error. -build /home/brett/Documents/code/c++/BLT/CMakeLists.txt /home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap/CMakeLists.txt /home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap/cmake/DetectVersion.cmake /home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap/cmake/helpers.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.24.2/CMakeCCompiler.cmake CMakeFiles/3.24.2/CMakeCXXCompiler.cmake CMakeFiles/3.24.2/CMakeSystem.cmake: phony +build /home/brett/Documents/code/c++/BLT/CMakeLists.txt /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.24.2/CMakeCCompiler.cmake CMakeFiles/3.24.2/CMakeCXXCompiler.cmake CMakeFiles/3.24.2/CMakeSystem.cmake: phony ############################################# diff --git a/cmake-build-release/cmake_install.cmake b/cmake-build-release/cmake_install.cmake index 141a6b8..51633c8 100644 --- a/cmake-build-release/cmake_install.cmake +++ b/cmake-build-release/cmake_install.cmake @@ -42,11 +42,6 @@ if(NOT DEFINED CMAKE_OBJDUMP) set(CMAKE_OBJDUMP "/usr/bin/objdump") endif() -if(NOT CMAKE_INSTALL_LOCAL_ONLY) - # Include the install script for the subdirectory. - include("/home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap/cmake_install.cmake") -endif() - if(CMAKE_INSTALL_COMPONENT) set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") else() diff --git a/include/blt/nbt/nbt.h b/include/blt/nbt/nbt.h new file mode 100644 index 0000000..dbf277e --- /dev/null +++ b/include/blt/nbt/nbt.h @@ -0,0 +1,12 @@ +/* + * Created by Brett on 27/01/23. + * Licensed under GNU General Public License V3.0 + * See LICENSE file for license detail + */ + +#ifndef BLT_TESTS_NBT_H +#define BLT_TESTS_NBT_H + +#include + +#endif //BLT_TESTS_NBT_H diff --git a/include/blt/nbt/nbt_block.h b/include/blt/nbt/nbt_block.h new file mode 100644 index 0000000..a4a06e0 --- /dev/null +++ b/include/blt/nbt/nbt_block.h @@ -0,0 +1,10 @@ +/* + * Created by Brett on 27/01/23. + * Licensed under GNU General Public License V3.0 + * See LICENSE file for license detail + */ + +#ifndef BLT_TESTS_NBT_BLOCK_H +#define BLT_TESTS_NBT_BLOCK_H + +#endif //BLT_TESTS_NBT_BLOCK_H diff --git a/include/blt/std/format.h b/include/blt/std/format.h index 2a7fdff..3f2ea83 100644 --- a/include/blt/std/format.h +++ b/include/blt/std/format.h @@ -47,6 +47,7 @@ namespace blt::string { struct TableColumn { std::string columnName; size_t maxColumnLength = 0; + TableColumn(std::string columnName): columnName(std::move(columnName)) {} }; @@ -60,14 +61,19 @@ namespace blt::string { int m_maxColumnWidth; std::vector columns; std::vector rows; - + static std::string generateTopSeparator(size_t size); + std::string generateColumnHeader(); + std::string generateSeparator(size_t size); + void updateMaxColumnLengths(); + [[nodiscard]] inline size_t columnSize(const TableColumn& column) const { return column.columnName.size() + m_columnPadding * 2; } + public: explicit TableFormatter(int columnPadding = 2, int maxColumnWidth = 500): m_columnPadding(columnPadding), m_maxColumnWidth(maxColumnWidth) {} @@ -75,7 +81,8 @@ namespace blt::string { inline void addColumn(const TableColumn& column) { columns.push_back(column); } - inline void addRow(TableRow row){ + + inline void addRow(TableRow row) { if (row.rowValues.size() > columns.size()) throw "Cannot insert more rows than columns!\n"; // ensure every row populates every column. This is important as the table generator assumes that all rows are complete! @@ -84,14 +91,23 @@ namespace blt::string { row.rowValues.emplace_back(" "); rows.push_back(std::move(row)); } - inline void addRow(const std::initializer_list& values){ + + inline void addRow(const std::initializer_list& values) { TableRow row; for (const auto& value : values) row.rowValues.push_back(value); addRow(row); } + std::vector createTable(bool top = false, bool bottom = false); }; + class LineGraphFormatter { + private: + + public: + + }; + } #endif //BLT_TESTS_FORMAT_H diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap deleted file mode 160000 index c36739b..0000000 --- a/libraries/parallel-hashmap +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c36739b79ff1dd506708de251c43e8c778da2c00 diff --git a/src/blt/nbt/nbt_block.cpp b/src/blt/nbt/nbt_block.cpp new file mode 100644 index 0000000..57222e2 --- /dev/null +++ b/src/blt/nbt/nbt_block.cpp @@ -0,0 +1,21 @@ +/* + * Created by Brett on 27/01/23. + * Licensed under GNU General Public License V3.0 + * See LICENSE file for license detail + */ +#include +#include +#include + +namespace blt::nbt { + /** + * Reads the entire NBT file when the read() function is called. + */ + class NBTReader { + private: + std::string m_file; + + public: + explicit NBTReader(std::string file): m_file(std::move(file)) {} + }; +} \ No newline at end of file diff --git a/src/blt/profiling/profiler.cpp b/src/blt/profiling/profiler.cpp index 8b77a60..ca5b039 100644 --- a/src/blt/profiling/profiler.cpp +++ b/src/blt/profiling/profiler.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -32,7 +31,11 @@ namespace blt::profiling { } void point(const std::string& profileName, const std::string& pointName) { - + std::scoped_lock lock(profileLock); + CapturePoint point{}; + point.point = System::getCurrentTimeNanoseconds(); + point.name = pointName; + profiles[profileName].points.push(point); } CaptureInterval getInterval(const std::string& profileName, const std::string& intervalName) { @@ -54,35 +57,6 @@ namespace blt::profiling { } } - void printProfileOld(const std::string& profileName, int loggingLevel) { - std::vector lines; - const auto& profile = profiles[profileName]; - const auto& intervals = profile.intervals; - const auto& points = profile.points; - - { - std::string profileNameString = "Profile "; - profileNameString += profileName; - profileNameString += " Recorded {\n"; - lines.emplace_back(profileNameString); - - for (const auto& interval : intervals) { - const auto difference = interval.second.end - interval.second.start; - std::string currentIntervalString = "\t"; - currentIntervalString += interval.first; - currentIntervalString += " "; - currentIntervalString += std::to_string(difference); - currentIntervalString += "ns ("; - currentIntervalString += std::to_string((double) difference / 1000000.0); - currentIntervalString += "ms);\n"; - - lines.emplace_back(currentIntervalString); - } - lines.emplace_back("}\n"); - } - print(lines, loggingLevel); - } - void printProfile(const std::string& profileName, int loggingLevel) { string::TableFormatter formatter; formatter.addColumn({"Interval"}); @@ -95,7 +69,7 @@ namespace blt::profiling { for (const auto& interval : intervals) { const auto difference = interval.second.end - interval.second.start; - formatter.addRow({interval.first, std::to_string(difference), std::to_string(difference/1000000.0)}); + formatter.addRow({interval.first, std::to_string(difference), std::to_string((double)difference/1000000.0)}); } std::vector updatedLines; @@ -117,63 +91,6 @@ namespace blt::profiling { return container1.difference < container2.difference; } - inline std::pair longestInterval(const std::vector& intervalDifferences) { - size_t longestName = 0; - size_t longestIntervalTime = 0; - for (const auto& intervalDifference : intervalDifferences) { - longestName = std::max(longestName, intervalDifference.name.length() - 1); - longestIntervalTime = std::max(longestIntervalTime, std::to_string(intervalDifference.difference).length() - 1); - } - return {longestName, longestIntervalTime}; - } - - void printOrderedProfileOld(const std::string& profileName, int loggingLevel) { - std::vector lines; - const auto& profile = profiles[profileName]; - const auto& intervals = profile.intervals; - const auto& points = profile.points; - - { - std::string profileNameString = "Profile "; - profileNameString += profileName; - profileNameString += " Recorded {\n"; - lines.emplace_back(profileNameString); - - std::vector unorderedIntervalVector; - - for (const auto& interval : intervals) { - const auto difference = interval.second.end - interval.second.start; - unorderedIntervalVector.emplace_back(difference, interval.first); - } - - std::sort(unorderedIntervalVector.begin(), unorderedIntervalVector.end(), timeCompare); - - auto longestName = longestInterval(unorderedIntervalVector); - - - int count = 1; - for (const auto& interval : unorderedIntervalVector) { - const auto difference = interval.difference; - std::string currentIntervalString = "\t"; - std::string countStr = std::to_string(count++); - countStr += ". "; - auto countMaxStrSize = std::to_string(unorderedIntervalVector.size() + 1).length() + countStr.length(); - currentIntervalString += blt::string::postPadWithSpaces(countStr, countMaxStrSize); - currentIntervalString += blt::string::postPadWithSpaces(interval.name, longestName.first); - currentIntervalString += "\t"; - currentIntervalString += blt::string::postPadWithSpaces(std::to_string(difference), longestName.second); - currentIntervalString += "ns ("; - currentIntervalString += std::to_string((double) difference / 1000000.0); - currentIntervalString += "ms);\n"; - - lines.emplace_back(currentIntervalString); - } - lines.emplace_back("}\n"); - } - - print(lines, loggingLevel); - } - void printOrderedProfile(const std::string& profileName, int loggingLevel) { const auto& profile = profiles[profileName]; const auto& intervals = profile.intervals;