mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 18:28:52 -05:00
Initial developement of Application, Logger, etc. Setup premake file
This commit is contained in:
parent
3584a255ee
commit
4c0d959ee7
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,5 +2,7 @@
|
|||
*.so
|
||||
*.a
|
||||
*.sublime-workspace
|
||||
Makefile
|
||||
*.make
|
||||
|
||||
!.gitignore
|
||||
|
|
129
bin-int/Debug-linux-x86_64/NavProject/main.d
Normal file
129
bin-int/Debug-linux-x86_64/NavProject/main.d
Normal file
|
@ -0,0 +1,129 @@
|
|||
bin-int/Debug-linux-x86_64/NavProject/main.o: src/main.cpp \
|
||||
src/Navigator.h src/Navigator/Logger.h \
|
||||
src/vendor/spdlog/include/spdlog/spdlog.h \
|
||||
src/vendor/spdlog/include/spdlog/common.h \
|
||||
src/vendor/spdlog/include/spdlog/tweakme.h \
|
||||
src/vendor/spdlog/include/spdlog/details/null_mutex.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/fmt.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h \
|
||||
src/vendor/spdlog/include/spdlog/common-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/registry.h \
|
||||
src/vendor/spdlog/include/spdlog/details/registry-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker.h \
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/logger.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/os.h \
|
||||
src/vendor/spdlog/include/spdlog/details/os-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/circular_q.h \
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/logger-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink.h \
|
||||
src/vendor/spdlog/include/spdlog/formatter.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter.h \
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/fmt_helper.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink.h \
|
||||
src/vendor/spdlog/include/spdlog/details/console_globals.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/version.h \
|
||||
src/vendor/spdlog/include/spdlog/details/synchronous_factory.h \
|
||||
src/vendor/spdlog/include/spdlog/spdlog-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/ostr.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/ostream.h \
|
||||
src/Navigator/Application.h
|
||||
|
||||
src/Navigator.h:
|
||||
|
||||
src/Navigator/Logger.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/spdlog.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/common.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/tweakme.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/null_mutex.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/fmt.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/common-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/registry.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/registry-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/logger.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/os.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/os-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/circular_q.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/logger-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/formatter.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/fmt_helper.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/console_globals.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/version.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/synchronous_factory.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/spdlog-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/ostr.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/ostream.h:
|
||||
|
||||
src/Navigator/Application.h:
|
6
bin-int/Debug-linux-x86_64/Navigator/Application.d
Normal file
6
bin-int/Debug-linux-x86_64/Navigator/Application.d
Normal file
|
@ -0,0 +1,6 @@
|
|||
bin-int/Debug-linux-x86_64/Navigator/Application.o: \
|
||||
src/Navigator/Application.cpp src/navpch.h src/Navigator/Application.h
|
||||
|
||||
src/navpch.h:
|
||||
|
||||
src/Navigator/Application.h:
|
11
bin-int/Debug-linux-x86_64/Navigator/CompassFile.d
Normal file
11
bin-int/Debug-linux-x86_64/Navigator/CompassFile.d
Normal file
|
@ -0,0 +1,11 @@
|
|||
bin-int/Debug-linux-x86_64/Navigator/CompassFile.o: \
|
||||
src/Navigator/CompassFile.cpp src/navpch.h src/Navigator/CompassFile.h \
|
||||
src/Navigator/CompassHit.h src/Navigator/ShiftMap.h
|
||||
|
||||
src/navpch.h:
|
||||
|
||||
src/Navigator/CompassFile.h:
|
||||
|
||||
src/Navigator/CompassHit.h:
|
||||
|
||||
src/Navigator/ShiftMap.h:
|
14
bin-int/Debug-linux-x86_64/Navigator/CompassRun.d
Normal file
14
bin-int/Debug-linux-x86_64/Navigator/CompassRun.d
Normal file
|
@ -0,0 +1,14 @@
|
|||
bin-int/Debug-linux-x86_64/Navigator/CompassRun.o: \
|
||||
src/Navigator/CompassRun.cpp src/navpch.h src/Navigator/CompassRun.h \
|
||||
src/Navigator/CompassFile.h src/Navigator/CompassHit.h \
|
||||
src/Navigator/ShiftMap.h
|
||||
|
||||
src/navpch.h:
|
||||
|
||||
src/Navigator/CompassRun.h:
|
||||
|
||||
src/Navigator/CompassFile.h:
|
||||
|
||||
src/Navigator/CompassHit.h:
|
||||
|
||||
src/Navigator/ShiftMap.h:
|
12
bin-int/Debug-linux-x86_64/Navigator/Logger.d
Normal file
12
bin-int/Debug-linux-x86_64/Navigator/Logger.d
Normal file
|
@ -0,0 +1,12 @@
|
|||
bin-int/Debug-linux-x86_64/Navigator/Logger.o: src/Navigator/Logger.cpp \
|
||||
src/navpch.h src/Navigator/Logger.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/stdout_color_sinks.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h
|
||||
|
||||
src/navpch.h:
|
||||
|
||||
src/Navigator/Logger.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/stdout_color_sinks.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h:
|
6
bin-int/Debug-linux-x86_64/Navigator/ShiftMap.d
Normal file
6
bin-int/Debug-linux-x86_64/Navigator/ShiftMap.d
Normal file
|
@ -0,0 +1,6 @@
|
|||
bin-int/Debug-linux-x86_64/Navigator/ShiftMap.o: \
|
||||
src/Navigator/ShiftMap.cpp src/navpch.h src/Navigator/ShiftMap.h
|
||||
|
||||
src/navpch.h:
|
||||
|
||||
src/Navigator/ShiftMap.h:
|
0
bin-int/Debug-linux-x86_64/Navigator/navpch.h
Normal file
0
bin-int/Debug-linux-x86_64/Navigator/navpch.h
Normal file
123
bin-int/Debug-linux-x86_64/Navigator/navpch.h.d
Normal file
123
bin-int/Debug-linux-x86_64/Navigator/navpch.h.d
Normal file
|
@ -0,0 +1,123 @@
|
|||
bin-int/Debug-linux-x86_64/Navigator/navpch.h.gch: src/navpch.h \
|
||||
src/Navigator/Logger.h src/vendor/spdlog/include/spdlog/spdlog.h \
|
||||
src/vendor/spdlog/include/spdlog/common.h \
|
||||
src/vendor/spdlog/include/spdlog/tweakme.h \
|
||||
src/vendor/spdlog/include/spdlog/details/null_mutex.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/fmt.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h \
|
||||
src/vendor/spdlog/include/spdlog/common-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/registry.h \
|
||||
src/vendor/spdlog/include/spdlog/details/registry-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker.h \
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/logger.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/os.h \
|
||||
src/vendor/spdlog/include/spdlog/details/os-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer.h \
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/circular_q.h \
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/logger-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink.h \
|
||||
src/vendor/spdlog/include/spdlog/formatter.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter.h \
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/details/fmt_helper.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink.h \
|
||||
src/vendor/spdlog/include/spdlog/details/console_globals.h \
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/version.h \
|
||||
src/vendor/spdlog/include/spdlog/details/synchronous_factory.h \
|
||||
src/vendor/spdlog/include/spdlog/spdlog-inl.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/ostr.h \
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/ostream.h
|
||||
|
||||
src/Navigator/Logger.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/spdlog.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/common.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/tweakme.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/null_mutex.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/fmt.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/core.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/format.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/common-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/registry.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/registry-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/periodic_worker-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/logger.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/os.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/os-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/circular_q.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/backtracer-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/logger-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/formatter.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/sink-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/pattern_formatter-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/fmt_helper.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/console_globals.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/version.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/details/synchronous_factory.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/spdlog-inl.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/ostr.h:
|
||||
|
||||
src/vendor/spdlog/include/spdlog/fmt/bundled/ostream.h:
|
BIN
bin-int/Debug-linux-x86_64/Navigator/navpch.h.gch
Normal file
BIN
bin-int/Debug-linux-x86_64/Navigator/navpch.h.gch
Normal file
Binary file not shown.
BIN
bin/Debug-linux-x86_64/NavProject/NavProject
Executable file
BIN
bin/Debug-linux-x86_64/NavProject/NavProject
Executable file
Binary file not shown.
|
@ -7,6 +7,6 @@
|
|||
],
|
||||
"settings":
|
||||
{
|
||||
"SublimeLinter.linters.g++.args": ["-c","-Wall","-fsyntax-only","-std=c++17","-include${folder}/src/navpch.h","-Isrc/"]
|
||||
"SublimeLinter.linters.g++.args": ["-c","-Wall","-fsyntax-only","-std=c++17","-include${folder}/src/navpch.h","-Isrc/", "-Isrc/vendor/spdlog/include"]
|
||||
}
|
||||
}
|
107
premake5.lua
Normal file
107
premake5.lua
Normal file
|
@ -0,0 +1,107 @@
|
|||
workspace "Nova"
|
||||
architecture "x64"
|
||||
configurations {
|
||||
"Debug",
|
||||
"Release"
|
||||
}
|
||||
startproject "NavProject"
|
||||
|
||||
|
||||
|
||||
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
|
||||
-- External directories to be included
|
||||
IncludeDirs ={}
|
||||
IncludeDirs["glfw"] = "src/vendor/glfw/include"
|
||||
IncludeDirs["ImGui"] = "src/vendor/imgui"
|
||||
|
||||
include "src/vendor/glfw"
|
||||
include "src/vendor/imgui"
|
||||
project "Navigator"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
cppdialect "C++17"
|
||||
staticruntime "on"
|
||||
targetdir ("lib/" .. outputdir .. "/%{prj.name}")
|
||||
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
|
||||
pchheader "navpch.h"
|
||||
pchsource "navpch.cpp"
|
||||
|
||||
files {
|
||||
"src/%{prj.name}/**.h",
|
||||
"src/%{prj.name}/**.cpp"
|
||||
}
|
||||
|
||||
defines {
|
||||
"_CRT_SECURE_NO_WARNINGS"
|
||||
}
|
||||
|
||||
includedirs {
|
||||
"src/",
|
||||
"src/vendor/spdlog/include/",
|
||||
"src/%{prj.name}/",
|
||||
"%{IncludeDirs.glfw}",
|
||||
"%{IncludeDirs.ImGui}",
|
||||
}
|
||||
|
||||
links {
|
||||
"GLFW",
|
||||
"ImGui",
|
||||
"opengl32.lib"
|
||||
}
|
||||
|
||||
systemversion "latest"
|
||||
|
||||
defines {
|
||||
"GLFW_INCLUDE_NONE"
|
||||
}
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines "NAV_DEBUG"
|
||||
runtime "Debug"
|
||||
symbols "on"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines "NAV_RELEASE"
|
||||
runtime "Release"
|
||||
optimize "on"
|
||||
|
||||
project "NavProject"
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
cppdialect "C++17"
|
||||
staticruntime "on"
|
||||
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
|
||||
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
|
||||
|
||||
files {
|
||||
"src/main.cpp"
|
||||
}
|
||||
|
||||
|
||||
includedirs {
|
||||
"src/Navigator",
|
||||
"src/vendor/spdlog/include/",
|
||||
"src/vendor"
|
||||
}
|
||||
|
||||
links {
|
||||
"Navigator"
|
||||
}
|
||||
|
||||
|
||||
systemversion "latest"
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines "NAV_DEBUG"
|
||||
runtime "Debug"
|
||||
symbols "on"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines "NAV_RELEASE"
|
||||
runtime "Release"
|
||||
optimize "on"
|
||||
|
||||
filter "configurations:Dist"
|
||||
defines "NAV_DIST"
|
||||
runtime "Release"
|
||||
optimize "on"
|
7
src/Navigator.h
Normal file
7
src/Navigator.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef NAVIGATOR_H
|
||||
#define NAVIGATOR_H
|
||||
|
||||
#include "Navigator/Logger.h"
|
||||
#include "Navigator/Application.h"
|
||||
|
||||
#endif
|
31
src/Navigator/Application.cpp
Normal file
31
src/Navigator/Application.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include <navpch.h>
|
||||
#include "Application.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
Application* Application::s_instance = nullptr;
|
||||
|
||||
Application::Application() :
|
||||
m_runFlag(true)
|
||||
{
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
Application::~Application() {}
|
||||
|
||||
|
||||
void Application::OnEvent() {}
|
||||
|
||||
void Application::PushLayer() {}
|
||||
|
||||
void Application::PushOverlay() {}
|
||||
|
||||
void Application::Run()
|
||||
{
|
||||
while(m_runFlag)
|
||||
{
|
||||
NAV_TRACE("Doing a run.");
|
||||
m_runFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
33
src/Navigator/Application.h
Normal file
33
src/Navigator/Application.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef APPLICATION_H
|
||||
#define APPLICATION_H
|
||||
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
Application();
|
||||
virtual ~Application();
|
||||
|
||||
void Run();
|
||||
|
||||
void OnEvent();
|
||||
void PushLayer();
|
||||
void PushOverlay();
|
||||
|
||||
inline static Application& Get() { return *s_instance; }
|
||||
|
||||
inline void GetWindow() { return; }
|
||||
|
||||
private:
|
||||
|
||||
bool m_runFlag;
|
||||
|
||||
static Application* s_instance;
|
||||
};
|
||||
|
||||
Application* CreateApplication();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -74,7 +74,7 @@ namespace Navigator {
|
|||
{
|
||||
if(!IsOpen())
|
||||
{
|
||||
EVB_WARN("Unable to get hit size from file {0}, sending invalid value.", m_filename);
|
||||
NAV_WARN("Unable to get hit size from file {0}, sending invalid value.", m_filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,116 +11,22 @@
|
|||
*/
|
||||
#include <navpch.h>
|
||||
#include "CompassRun.h"
|
||||
#include "RunCollector.h"
|
||||
#include "SlowSort.h"
|
||||
#include "FastSort.h"
|
||||
#include "SFPAnalyzer.h"
|
||||
#include "FlagHandler.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
CompassRun::CompassRun() :
|
||||
m_directory(""), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_progressFraction(0.1)
|
||||
m_directory("")
|
||||
{
|
||||
}
|
||||
|
||||
CompassRun::CompassRun(const std::string& dir) :
|
||||
m_directory(dir), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_progressFraction(0.1)
|
||||
m_directory(dir)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CompassRun::~CompassRun() {}
|
||||
|
||||
|
||||
/*Load em into a map*/
|
||||
void CompassRun::SetScalers()
|
||||
{
|
||||
std::ifstream input(m_scalerinput);
|
||||
if(!input.is_open())
|
||||
return;
|
||||
|
||||
m_scaler_flag = true;
|
||||
std::string junk, filename, varname;
|
||||
Long64_t init = 0;
|
||||
std::getline(input, junk);
|
||||
std::getline(input, junk);
|
||||
m_scaler_map.clear();
|
||||
while(input>>filename)
|
||||
{
|
||||
input>>varname;
|
||||
filename = m_directory+filename+"_run_"+std::to_string(m_runNum)+".bin";
|
||||
m_scaler_map[filename] = TParameter<Long64_t>(varname.c_str(), init);
|
||||
}
|
||||
input.close();
|
||||
}
|
||||
|
||||
bool CompassRun::GetBinaryFiles()
|
||||
{
|
||||
std::string prefix = "";
|
||||
std::string suffix = ".bin"; //binaries
|
||||
RunCollector grabber(m_directory, prefix, suffix);
|
||||
grabber.GrabAllFiles();
|
||||
|
||||
m_datafiles.clear(); //so that the CompassRun can be reused
|
||||
m_datafiles.reserve(grabber.GetFileList().size());
|
||||
bool scalerd;
|
||||
m_totalHits = 0; //reset total run size
|
||||
|
||||
for(auto& entry : grabber.GetFileList())
|
||||
{
|
||||
//Handle scaler files, if they exist
|
||||
if(m_scaler_flag)
|
||||
{
|
||||
scalerd = false;
|
||||
for(auto& scaler_pair : m_scaler_map)
|
||||
{
|
||||
if(entry == scaler_pair.first)
|
||||
{
|
||||
ReadScalerData(entry);
|
||||
scalerd = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(scalerd)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_datafiles.emplace_back(entry);
|
||||
m_datafiles[m_datafiles.size()-1].AttachShiftMap(&m_smap);
|
||||
//Any time we have a file that fails to be found, we terminate the whole process
|
||||
if(!m_datafiles[m_datafiles.size() - 1].IsOpen())
|
||||
return false;
|
||||
|
||||
m_totalHits += m_datafiles[m_datafiles.size()-1].GetNumberOfHits();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Pure counting of scalers. Potential upgrade path to something like
|
||||
average count rate etc.
|
||||
*/
|
||||
void CompassRun::ReadScalerData(const std::string& filename)
|
||||
{
|
||||
if(!m_scaler_flag)
|
||||
return;
|
||||
|
||||
Long64_t count;
|
||||
count = 0;
|
||||
CompassFile file(filename);
|
||||
auto& this_param = m_scaler_map[file.GetName()];
|
||||
while(true)
|
||||
{
|
||||
file.GetNextHit();
|
||||
if(file.IsEOF())
|
||||
break;
|
||||
count++;
|
||||
}
|
||||
this_param.SetVal(count);
|
||||
}
|
||||
|
||||
/*
|
||||
GetHitsFromFiles() is the function which actually retrieves and sorts the data from the individual
|
||||
files. There are several tricks which allow this to happen. First is that, after sorting, it is impossible
|
||||
|
@ -162,382 +68,4 @@ namespace Navigator {
|
|||
return true;
|
||||
}
|
||||
|
||||
void CompassRun::Convert2RawRoot(const std::string& name) {
|
||||
TFile* output = TFile::Open(name.c_str(), "RECREATE");
|
||||
TTree* outtree = new TTree("Data", "Data");
|
||||
|
||||
outtree->Branch("Board", &hit.board);
|
||||
outtree->Branch("Channel", &hit.channel);
|
||||
outtree->Branch("Energy", &hit.lgate);
|
||||
outtree->Branch("EnergyShort", &hit.sgate);
|
||||
outtree->Branch("Timestamp", &hit.timestamp);
|
||||
outtree->Branch("Flags", &hit.flags);
|
||||
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
EVB_WARN("Bad shift map ({0}) at CompassRun::Convert(), shifts all set to 0.", m_smap.GetFilename());
|
||||
}
|
||||
|
||||
SetScalers();
|
||||
|
||||
if(!GetBinaryFiles())
|
||||
{
|
||||
EVB_ERROR("Unable to find binary files at CompassRun::Convert(), exiting!");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
|
||||
|
||||
startIndex = 0; //Reset the startIndex
|
||||
if(flush == 0)
|
||||
flush = 1;
|
||||
while(true)
|
||||
{
|
||||
count++;
|
||||
if(count == flush)
|
||||
{ //Progress Log
|
||||
count = 0;
|
||||
flush_count++;
|
||||
m_progressCallback(flush_count*flush, m_totalHits);
|
||||
}
|
||||
|
||||
if(!GetHitsFromFiles())
|
||||
break;
|
||||
outtree->Fill();
|
||||
}
|
||||
|
||||
output->cd();
|
||||
outtree->Write(outtree->GetName(), TObject::kOverwrite);
|
||||
for(auto& entry : m_scaler_map)
|
||||
entry.second.Write();
|
||||
|
||||
output->Close();
|
||||
}
|
||||
|
||||
void CompassRun::Convert2SortedRoot(const std::string& name, const std::string& mapfile, double window)
|
||||
{
|
||||
TFile* output = TFile::Open(name.c_str(), "RECREATE");
|
||||
TTree* outtree = new TTree("SortTree", "SortTree");
|
||||
|
||||
outtree->Branch("event", &event);
|
||||
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
EVB_WARN("Bad shift map ({0}) at CompassRun::Convert2SortedRoot(), shifts all set to 0.", m_smap.GetFilename());
|
||||
}
|
||||
|
||||
SetScalers();
|
||||
|
||||
if(!GetBinaryFiles())
|
||||
{
|
||||
EVB_ERROR("Unable to find binary files at CompassRun::Convert2SortedRoot(), exiting!");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
|
||||
|
||||
startIndex = 0;
|
||||
SlowSort coincidizer(window, mapfile);
|
||||
bool killFlag = false;
|
||||
if(flush == 0)
|
||||
flush = 1;
|
||||
while(true)
|
||||
{
|
||||
count++;
|
||||
if(count == flush)
|
||||
{
|
||||
count = 0;
|
||||
flush_count++;
|
||||
m_progressCallback(flush_count*flush, m_totalHits);
|
||||
}
|
||||
|
||||
if(!GetHitsFromFiles())
|
||||
{
|
||||
coincidizer.FlushHitsToEvent();
|
||||
killFlag = true;
|
||||
}
|
||||
else
|
||||
coincidizer.AddHitToEvent(hit);
|
||||
|
||||
if(coincidizer.IsEventReady())
|
||||
{
|
||||
event = coincidizer.GetEvent();
|
||||
outtree->Fill();
|
||||
if(killFlag) break;
|
||||
}
|
||||
}
|
||||
|
||||
output->cd();
|
||||
outtree->Write(outtree->GetName(), TObject::kOverwrite);
|
||||
for(auto& entry : m_scaler_map)
|
||||
entry.second.Write();
|
||||
|
||||
coincidizer.GetEventStats()->Write();
|
||||
output->Close();
|
||||
}
|
||||
|
||||
void CompassRun::Convert2FastSortedRoot(const std::string& name, const std::string& mapfile, double window, double fsi_window, double fic_window)
|
||||
{
|
||||
TFile* output = TFile::Open(name.c_str(), "RECREATE");
|
||||
TTree* outtree = new TTree("SortTree", "SortTree");
|
||||
|
||||
outtree->Branch("event", &event);
|
||||
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
EVB_WARN("Bad shift map ({0}) at CompassRun::Convert2FastSortedRoot(), shifts all set to 0.", m_smap.GetFilename());
|
||||
}
|
||||
|
||||
SetScalers();
|
||||
|
||||
if(!GetBinaryFiles())
|
||||
{
|
||||
EVB_ERROR("Unable to find binary files at CompassRun::Convert2FastSortedRoot(), exiting!");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
|
||||
|
||||
startIndex = 0;
|
||||
CoincEvent this_event;
|
||||
std::vector<CoincEvent> fast_events;
|
||||
SlowSort coincidizer(window, mapfile);
|
||||
FastSort speedyCoincidizer(fsi_window, fic_window);
|
||||
|
||||
FlagHandler flagger;
|
||||
|
||||
bool killFlag = false;
|
||||
if(flush == 0)
|
||||
flush = 1;
|
||||
while(true)
|
||||
{
|
||||
count++;
|
||||
if(count == flush)
|
||||
{
|
||||
count = 0;
|
||||
flush_count++;
|
||||
m_progressCallback(flush_count*flush, m_totalHits);
|
||||
}
|
||||
|
||||
if(!GetHitsFromFiles())
|
||||
{
|
||||
coincidizer.FlushHitsToEvent();
|
||||
killFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagger.CheckFlag(hit.board, hit.channel, hit.flags);
|
||||
coincidizer.AddHitToEvent(hit);
|
||||
}
|
||||
|
||||
if(coincidizer.IsEventReady())
|
||||
{
|
||||
this_event = coincidizer.GetEvent();
|
||||
|
||||
fast_events = speedyCoincidizer.GetFastEvents(this_event);
|
||||
for(auto& entry : fast_events)
|
||||
{
|
||||
event = entry;
|
||||
outtree->Fill();
|
||||
}
|
||||
if(killFlag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
output->cd();
|
||||
outtree->Write(outtree->GetName(), TObject::kOverwrite);
|
||||
for(auto& entry : m_scaler_map)
|
||||
entry.second.Write();
|
||||
|
||||
coincidizer.GetEventStats()->Write();
|
||||
output->Close();
|
||||
}
|
||||
|
||||
|
||||
void CompassRun::Convert2SlowAnalyzedRoot(const std::string& name, const std::string& mapfile, double window,
|
||||
int zt, int at, int zp, int ap, int ze, int ae, double bke, double b, double theta)
|
||||
{
|
||||
|
||||
TFile* output = TFile::Open(name.c_str(), "RECREATE");
|
||||
TTree* outtree = new TTree("SPSTree", "SPSTree");
|
||||
|
||||
outtree->Branch("event", &pevent);
|
||||
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
EVB_WARN("Bad shift map ({0}) at CompassRun::Convert2SlowAnalyzedRoot(), shifts all set to 0.", m_smap.GetFilename());
|
||||
}
|
||||
|
||||
SetScalers();
|
||||
|
||||
if(!GetBinaryFiles())
|
||||
{
|
||||
EVB_ERROR("Unable to find binary files at CompassRun::Convert2SlowAnalyzedRoot(), exiting!");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
|
||||
|
||||
startIndex = 0;
|
||||
CoincEvent this_event;
|
||||
SlowSort coincidizer(window, mapfile);
|
||||
SFPAnalyzer analyzer(zt, at, zp, ap, ze, ae, bke, theta, b);
|
||||
|
||||
std::vector<TParameter<Double_t>> parvec;
|
||||
parvec.reserve(9);
|
||||
parvec.emplace_back("ZT", zt);
|
||||
parvec.emplace_back("AT", at);
|
||||
parvec.emplace_back("ZP", zp);
|
||||
parvec.emplace_back("AP", ap);
|
||||
parvec.emplace_back("ZE", ze);
|
||||
parvec.emplace_back("AE", ae);
|
||||
parvec.emplace_back("Bfield", b);
|
||||
parvec.emplace_back("BeamKE", bke);
|
||||
parvec.emplace_back("Theta", theta);
|
||||
|
||||
bool killFlag = false;
|
||||
if(flush == 0)
|
||||
flush = 1;
|
||||
while(true)
|
||||
{
|
||||
count++;
|
||||
if(count == flush)
|
||||
{
|
||||
count = 0;
|
||||
flush_count++;
|
||||
m_progressCallback(flush_count*flush, m_totalHits);
|
||||
}
|
||||
|
||||
if(!GetHitsFromFiles())
|
||||
{
|
||||
coincidizer.FlushHitsToEvent();
|
||||
killFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
coincidizer.AddHitToEvent(hit);
|
||||
}
|
||||
|
||||
if(coincidizer.IsEventReady())
|
||||
{
|
||||
this_event = coincidizer.GetEvent();
|
||||
pevent = analyzer.GetProcessedEvent(this_event);
|
||||
outtree->Fill();
|
||||
if(killFlag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
output->cd();
|
||||
outtree->Write(outtree->GetName(), TObject::kOverwrite);
|
||||
for(auto& entry : m_scaler_map)
|
||||
entry.second.Write();
|
||||
|
||||
for(auto& entry : parvec)
|
||||
entry.Write();
|
||||
|
||||
coincidizer.GetEventStats()->Write();
|
||||
analyzer.GetHashTable()->Write();
|
||||
analyzer.ClearHashTable();
|
||||
output->Close();
|
||||
}
|
||||
|
||||
void CompassRun::Convert2FastAnalyzedRoot(const std::string& name, const std::string& mapfile, double window, double fsi_window, double fic_window,
|
||||
int zt, int at, int zp, int ap, int ze, int ae, double bke, double b, double theta)
|
||||
{
|
||||
|
||||
TFile* output = TFile::Open(name.c_str(), "RECREATE");
|
||||
TTree* outtree = new TTree("SPSTree", "SPSTree");
|
||||
|
||||
outtree->Branch("event", &pevent);
|
||||
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
EVB_WARN("Bad shift map ({0}) at CompassRun::Convert2FastAnalyzedRoot(), shifts all set to 0.", m_smap.GetFilename());
|
||||
}
|
||||
|
||||
SetScalers();
|
||||
|
||||
if(!GetBinaryFiles())
|
||||
{
|
||||
EVB_ERROR("Unable to find binary files at CompassRun::Convert2FastAnalyzedRoot(), exiting!");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
|
||||
|
||||
startIndex = 0;
|
||||
CoincEvent this_event;
|
||||
std::vector<CoincEvent> fast_events;
|
||||
SlowSort coincidizer(window, mapfile);
|
||||
FastSort speedyCoincidizer(fsi_window, fic_window);
|
||||
SFPAnalyzer analyzer(zt, at, zp, ap, ze, ae, bke, theta, b);
|
||||
|
||||
std::vector<TParameter<Double_t>> parvec;
|
||||
parvec.reserve(9);
|
||||
parvec.emplace_back("ZT", zt);
|
||||
parvec.emplace_back("AT", at);
|
||||
parvec.emplace_back("ZP", zp);
|
||||
parvec.emplace_back("AP", ap);
|
||||
parvec.emplace_back("ZE", ze);
|
||||
parvec.emplace_back("AE", ae);
|
||||
parvec.emplace_back("Bfield", b);
|
||||
parvec.emplace_back("BeamKE", bke);
|
||||
parvec.emplace_back("Theta", theta);
|
||||
|
||||
FlagHandler flagger;
|
||||
|
||||
bool killFlag = false;
|
||||
if(flush == 0)
|
||||
flush = 1;
|
||||
while(true)
|
||||
{
|
||||
count++;
|
||||
if(count == flush)
|
||||
{
|
||||
count = 0;
|
||||
flush_count++;
|
||||
m_progressCallback(flush_count*flush, m_totalHits);
|
||||
}
|
||||
|
||||
if(!GetHitsFromFiles())
|
||||
{
|
||||
coincidizer.FlushHitsToEvent();
|
||||
killFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagger.CheckFlag(hit.board, hit.channel, hit.flags);
|
||||
coincidizer.AddHitToEvent(hit);
|
||||
}
|
||||
|
||||
if(coincidizer.IsEventReady())
|
||||
{
|
||||
this_event = coincidizer.GetEvent();
|
||||
|
||||
fast_events = speedyCoincidizer.GetFastEvents(this_event);
|
||||
for(auto& entry : fast_events)
|
||||
{
|
||||
pevent = analyzer.GetProcessedEvent(entry);
|
||||
outtree->Fill();
|
||||
}
|
||||
if(killFlag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
output->cd();
|
||||
outtree->Write(outtree->GetName(), TObject::kOverwrite);
|
||||
for(auto& entry : m_scaler_map)
|
||||
entry.second.Write();
|
||||
|
||||
for(auto& entry : parvec)
|
||||
entry.Write();
|
||||
|
||||
coincidizer.GetEventStats()->Write();
|
||||
analyzer.GetHashTable()->Write();
|
||||
analyzer.ClearHashTable();
|
||||
output->Close();
|
||||
}
|
||||
}
|
|
@ -11,11 +11,7 @@
|
|||
#define COMPASSRUN_H
|
||||
|
||||
#include "CompassFile.h"
|
||||
#include "DataStructs.h"
|
||||
#include "RunCollector.h"
|
||||
#include "ShiftMap.h"
|
||||
#include "ProgressCallback.h"
|
||||
#include <TParameter.h>
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
|
@ -27,46 +23,26 @@ namespace Navigator {
|
|||
CompassRun(const std::string& dir);
|
||||
~CompassRun();
|
||||
inline void SetDirectory(const std::string& dir) { m_directory = dir; }
|
||||
inline void SetScalerInput(const std::string& filename) { m_scalerinput = filename; }
|
||||
inline void SetRunNumber(int n) { m_runNum = n; }
|
||||
inline void SetShiftMap(const std::string& filename) { m_smap.SetFile(filename); }
|
||||
void Convert2RawRoot(const std::string& name);
|
||||
void Convert2SortedRoot(const std::string& name, const std::string& mapfile, double window);
|
||||
void Convert2FastSortedRoot(const std::string& name, const std::string& mapfile, double window, double fsi_window, double fic_window);
|
||||
void Convert2SlowAnalyzedRoot(const std::string& name, const std::string& mapfile, double window,
|
||||
int zt, int at, int zp, int ap, int ze, int ae, double bke, double b, double theta);
|
||||
void Convert2FastAnalyzedRoot(const std::string& name, const std::string& mapfile, double window, double fsi_window, double fic_window,
|
||||
int zt, int at, int zp, int ap, int ze, int ae, double bke, double b, double theta);
|
||||
|
||||
inline void SetProgressCallbackFunc(const ProgressCallbackFunc& function) { m_progressCallback = function; }
|
||||
inline void SetProgressFraction(double frac) { m_progressFraction = frac; }
|
||||
|
||||
private:
|
||||
bool GetBinaryFiles();
|
||||
bool GetHitsFromFiles();
|
||||
void SetScalers();
|
||||
void ReadScalerData(const std::string& filename);
|
||||
|
||||
std::string m_directory, m_scalerinput;
|
||||
std::string m_directory;
|
||||
std::vector<CompassFile> m_datafiles;
|
||||
unsigned int startIndex; //this is the file we start looking at; increases as we finish files.
|
||||
ShiftMap m_smap;
|
||||
std::unordered_map<std::string, TParameter<Long64_t>> m_scaler_map; //maps scaler files to the TParameter to be saved
|
||||
|
||||
//Potential branch variables
|
||||
CompassHit hit;
|
||||
CoincEvent event;
|
||||
ProcessedEvent pevent;
|
||||
|
||||
//what run is this
|
||||
int m_runNum;
|
||||
unsigned int m_totalHits;
|
||||
|
||||
//Scaler switch
|
||||
bool m_scaler_flag;
|
||||
|
||||
ProgressCallbackFunc m_progressCallback;
|
||||
double m_progressFraction;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include <navpch.h>
|
||||
#include "Logger.h"
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
std::shared_ptr<spdlog::logger> Logger::s_logger;
|
||||
|
||||
void Logger::Init()
|
||||
{
|
||||
spdlog::set_pattern("%^[%T] %n: %v%$");
|
||||
|
||||
s_logger = spdlog::stdout_color_mt("NAV");
|
||||
s_logger->set_level(spdlog::level::trace);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,4 +2,29 @@
|
|||
#define LOGGER_H
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "spdlog/fmt/"
|
||||
#include "spdlog/fmt/ostr.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
class Logger
|
||||
{
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
inline static std::shared_ptr<spdlog::logger> GetLogger() { return s_logger; }
|
||||
|
||||
private:
|
||||
static std::shared_ptr<spdlog::logger> s_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#define NAV_CRITICAL(...) ::Navigator::Logger::GetLogger()->critical(__VA_ARGS__)
|
||||
#define NAV_WARN(...) ::Navigator::Logger::GetLogger()->warn(__VA_ARGS__)
|
||||
#define NAV_ERROR(...) ::Navigator::Logger::GetLogger()->error(__VA_ARGS__)
|
||||
#define NAV_TRACE(...) ::Navigator::Logger::GetLogger()->trace(__VA_ARGS__)
|
||||
#define NAV_INFO(...) ::Navigator::Logger::GetLogger()->info(__VA_ARGS__)
|
||||
|
||||
#endif
|
16
src/main.cpp
Normal file
16
src/main.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "Navigator.h"
|
||||
|
||||
Navigator::Application* Navigator::CreateApplication() { return new Application(); }
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
Navigator::Logger::Init();
|
||||
NAV_TRACE("Logger Initialized!");
|
||||
|
||||
auto app = Navigator::CreateApplication();
|
||||
|
||||
NAV_TRACE("Navigator Application Created!");
|
||||
app->Run();
|
||||
|
||||
delete app;
|
||||
}
|
1
src/navpch.cpp
Normal file
1
src/navpch.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include "navpch.h"
|
|
@ -17,4 +17,6 @@
|
|||
#include <cstdint>
|
||||
|
||||
|
||||
#include "Navigator/Logger.h"
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user