initial commit
commit
54fb923675
@ -0,0 +1,122 @@
|
|||||||
|
CMakeLists.txt.user
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
_deps
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# SonarLint plugin
|
||||||
|
.idea/sonarlint/
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/cblib.iml" filepath="$PROJECT_DIR$/.idea/cblib.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.24)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# Project properties
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
|
project(cblib VERSION 1.0.0 DESCRIPTION "CB library")
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# Project properties
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} STATIC
|
||||||
|
src/cb/base.cpp
|
||||||
|
src/cb/types/types.cpp
|
||||||
|
src/cb/time/time.cpp
|
||||||
|
src/cb/test/test.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# Buildling library
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# Target properties
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER source/cb.h)
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
#ifndef GODOT_HUB_MAP_CB_H
|
||||||
|
#define GODOT_HUB_MAP_CB_H
|
||||||
|
|
||||||
|
#include "cb/test/test.h"
|
||||||
|
#include "cb/time/time.h"
|
||||||
|
#include "cb/types/types.h"
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GODOT_HUB_MAP_CB_H
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
#ifndef GODOT_HUB_MAP_BASE_H
|
||||||
|
#define GODOT_HUB_MAP_BASE_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GODOT_HUB_MAP_BASE_H
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
#ifndef GODOT_HUB_MAP_TEST_H
|
||||||
|
#define GODOT_HUB_MAP_TEST_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cassert>
|
||||||
|
#include <string_view>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <iostream>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace test {
|
||||||
|
#define assertm(exp, msg) = assert(((void)msg, exp))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GODOT_HUB_MAP_TEST_H
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef GODOT_HUB_MAP_TIME_H
|
||||||
|
#define GODOT_HUB_MAP_TIME_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace cb::time {
|
||||||
|
using internal_clock = std::chrono::high_resolution_clock;
|
||||||
|
using time_point = std::chrono::time_point<internal_clock>;
|
||||||
|
|
||||||
|
static std::map<const std::string_view, time_point> _name_to_measurement;
|
||||||
|
|
||||||
|
time_point chrono_now();
|
||||||
|
|
||||||
|
void start_measure(const std::string_view& id);
|
||||||
|
|
||||||
|
void measure(const std::string_view& id);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //GODOT_HUB_MAP_TIME_H
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef GODOT_HUB_MAP_TYPES_H
|
||||||
|
#define GODOT_HUB_MAP_TYPES_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cassert>
|
||||||
|
#include <string_view>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <iostream>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
|
||||||
|
using i64 = int64_t;
|
||||||
|
using u64 = uint64_t;
|
||||||
|
using f64 = double;
|
||||||
|
using f32 = float;
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GODOT_HUB_MAP_TYPES_H
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
#include "cb/base.h"
|
||||||
@ -0,0 +1 @@
|
|||||||
|
#include "cb/test/test.h"
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#include "cb/time/time.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace cb::time {
|
||||||
|
|
||||||
|
time_point chrono_now() {
|
||||||
|
return internal_clock::now();
|
||||||
|
}
|
||||||
|
|
||||||
|
void start_measure(const std::string_view &id) {
|
||||||
|
_name_to_measurement[id] = chrono_now();
|
||||||
|
}
|
||||||
|
|
||||||
|
void measure(const std::string_view &id) {
|
||||||
|
const std::chrono::duration<double> duration = chrono_now() - _name_to_measurement[id];
|
||||||
|
std::cout << "measurement: " << id << " took: " << duration.count() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
#include "cb/types/types.h"
|
||||||
|
|
||||||
Loading…
Reference in New Issue