Cleanup + making way for NBT!

v1
Brett 2023-01-27 10:45:18 -05:00
parent 42b912604d
commit 33b0b7bbbb
12 changed files with 80 additions and 155 deletions

View File

@ -1,14 +0,0 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "libraries/parallel-hashmap",
"source" : "libraries/parallel-hashmap"
}
}

View File

@ -376,7 +376,7 @@ CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_NM //ADVANCED property for variable: CMAKE_NM
CMAKE_NM-ADVANCED:INTERNAL=1 CMAKE_NM-ADVANCED:INTERNAL=1
//number of local generators //number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=2 CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//ADVANCED property for variable: CMAKE_OBJCOPY //ADVANCED property for variable: CMAKE_OBJCOPY
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_OBJDUMP //ADVANCED property for variable: CMAKE_OBJDUMP

View File

@ -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/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/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/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

View File

@ -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 /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 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 Profiler Files /home/brett/Documents/code/c++/BLT/src/blt/profiling/profiler.cpp
Source: /home/brett/Documents/code/c++/BLT Source: /home/brett/Documents/code/c++/BLT

View File

@ -77,6 +77,13 @@ build CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o: CXX_COMPILER__BLT_Rel
OBJECT_DIR = CMakeFiles/BLT.dir OBJECT_DIR = CMakeFiles/BLT.dir
OBJECT_FILE_DIR = CMakeFiles/BLT.dir/src/blt/profiling 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 # 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 # 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 LANGUAGE_COMPILE_FLAGS = -O3 -DNDEBUG
OBJECT_DIR = CMakeFiles/BLT.dir OBJECT_DIR = CMakeFiles/BLT.dir
POST_BUILD = : POST_BUILD = :
@ -150,34 +157,6 @@ build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND
build rebuild_cache: phony CMakeFiles/rebuild_cache.util 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. # Target aliases.
@ -191,14 +170,7 @@ build BLT: phony libBLT.a
############################################# #############################################
# Folder: /home/brett/Documents/code/c++/BLT/cmake-build-release # Folder: /home/brett/Documents/code/c++/BLT/cmake-build-release
build all: phony libBLT.a BLT_TESTS libraries/parallel-hashmap/all build all: phony libBLT.a BLT_TESTS
# =============================================================================
#############################################
# Folder: /home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap
build libraries/parallel-hashmap/all: phony
# ============================================================================= # =============================================================================
# Built-in targets # Built-in targets
@ -207,14 +179,14 @@ build libraries/parallel-hashmap/all: phony
############################################# #############################################
# Re-run CMake if any of its inputs changed. # 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 pool = console
############################################# #############################################
# A missing CMake input file is not an error. # 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
############################################# #############################################

View File

@ -42,11 +42,6 @@ if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/bin/objdump") set(CMAKE_OBJDUMP "/usr/bin/objdump")
endif() 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) if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else() else()

12
include/blt/nbt/nbt.h Normal file
View File

@ -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 <blt/nbt/nbt_block.h>
#endif //BLT_TESTS_NBT_H

View File

@ -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

View File

@ -47,6 +47,7 @@ namespace blt::string {
struct TableColumn { struct TableColumn {
std::string columnName; std::string columnName;
size_t maxColumnLength = 0; size_t maxColumnLength = 0;
TableColumn(std::string columnName): columnName(std::move(columnName)) {} TableColumn(std::string columnName): columnName(std::move(columnName)) {}
}; };
@ -62,12 +63,17 @@ namespace blt::string {
std::vector<TableRow> rows; std::vector<TableRow> rows;
static std::string generateTopSeparator(size_t size); static std::string generateTopSeparator(size_t size);
std::string generateColumnHeader(); std::string generateColumnHeader();
std::string generateSeparator(size_t size); std::string generateSeparator(size_t size);
void updateMaxColumnLengths(); void updateMaxColumnLengths();
[[nodiscard]] inline size_t columnSize(const TableColumn& column) const { [[nodiscard]] inline size_t columnSize(const TableColumn& column) const {
return column.columnName.size() + m_columnPadding * 2; return column.columnName.size() + m_columnPadding * 2;
} }
public: public:
explicit TableFormatter(int columnPadding = 2, int maxColumnWidth = 500): explicit TableFormatter(int columnPadding = 2, int maxColumnWidth = 500):
m_columnPadding(columnPadding), m_maxColumnWidth(maxColumnWidth) {} m_columnPadding(columnPadding), m_maxColumnWidth(maxColumnWidth) {}
@ -75,6 +81,7 @@ namespace blt::string {
inline void addColumn(const TableColumn& column) { inline void addColumn(const TableColumn& column) {
columns.push_back(column); columns.push_back(column);
} }
inline void addRow(TableRow row) { inline void addRow(TableRow row) {
if (row.rowValues.size() > columns.size()) if (row.rowValues.size() > columns.size())
throw "Cannot insert more rows than columns!\n"; throw "Cannot insert more rows than columns!\n";
@ -84,14 +91,23 @@ namespace blt::string {
row.rowValues.emplace_back(" "); row.rowValues.emplace_back(" ");
rows.push_back(std::move(row)); rows.push_back(std::move(row));
} }
inline void addRow(const std::initializer_list<std::string>& values) { inline void addRow(const std::initializer_list<std::string>& values) {
TableRow row; TableRow row;
for (const auto& value : values) for (const auto& value : values)
row.rowValues.push_back(value); row.rowValues.push_back(value);
addRow(row); addRow(row);
} }
std::vector<std::string> createTable(bool top = false, bool bottom = false); std::vector<std::string> createTable(bool top = false, bool bottom = false);
}; };
class LineGraphFormatter {
private:
public:
};
} }
#endif //BLT_TESTS_FORMAT_H #endif //BLT_TESTS_FORMAT_H

@ -1 +0,0 @@
Subproject commit c36739b79ff1dd506708de251c43e8c778da2c00

21
src/blt/nbt/nbt_block.cpp Normal file
View File

@ -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 <blt/nbt/nbt_block.h>
#include <string>
#include <fstream>
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)) {}
};
}

View File

@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include <blt/std/time.h> #include <blt/std/time.h>
#include <blt/std/logging.h> #include <blt/std/logging.h>
#include <blt/std/string.h>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <blt/std/format.h> #include <blt/std/format.h>
@ -32,7 +31,11 @@ namespace blt::profiling {
} }
void point(const std::string& profileName, const std::string& pointName) { 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) { 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<std::string> 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) { void printProfile(const std::string& profileName, int loggingLevel) {
string::TableFormatter formatter; string::TableFormatter formatter;
formatter.addColumn({"Interval"}); formatter.addColumn({"Interval"});
@ -95,7 +69,7 @@ namespace blt::profiling {
for (const auto& interval : intervals) { for (const auto& interval : intervals) {
const auto difference = interval.second.end - interval.second.start; 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<std::string> updatedLines; std::vector<std::string> updatedLines;
@ -117,63 +91,6 @@ namespace blt::profiling {
return container1.difference < container2.difference; return container1.difference < container2.difference;
} }
inline std::pair<size_t, size_t> longestInterval(const std::vector<timeOrderContainer>& 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<std::string> 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<timeOrderContainer> 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) { void printOrderedProfile(const std::string& profileName, int loggingLevel) {
const auto& profile = profiles[profileName]; const auto& profile = profiles[profileName];
const auto& intervals = profile.intervals; const auto& intervals = profile.intervals;