4 Commits

Author SHA1 Message Date
5829530652 Use optional for Singleton
All checks were successful
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Successful in 26s
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Successful in 25s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Successful in 24s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Successful in 25s
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Successful in 20s
Bigfoot / Build & Test Release (Unity Build: ON) (push) Successful in 19s
Bigfoot / Clang Format Checks (push) Successful in 10s
Bigfoot / Sonarqube (push) Successful in 1m4s
2026-02-02 08:13:26 +01:00
a062a058cd Reworked SonarQube trigger
All checks were successful
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Successful in 25s
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Successful in 23s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Successful in 25s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Successful in 24s
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Successful in 21s
Bigfoot / Build & Test Release (Unity Build: ON) (push) Successful in 19s
Bigfoot / Clang Format Checks (push) Successful in 11s
Bigfoot / Sonarqube (push) Successful in 1m5s
2026-02-02 07:46:58 +01:00
46b8095c6a Reworked SonarQube trigger
All checks were successful
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Successful in 26s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Successful in 24s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Successful in 28s
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Successful in 24s
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Successful in 19s
Bigfoot / Build & Test Release (Unity Build: ON) (push) Successful in 20s
Bigfoot / Clang Format Checks (push) Successful in 9s
Bigfoot / Sonarqube (push) Successful in 1m18s
2026-02-02 07:38:15 +01:00
63fd92c584 Reworked SonarQube trigger
Some checks failed
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Successful in 24s
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Successful in 25s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Successful in 25s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release (Unity Build: ON) (push) Has been cancelled
Bigfoot / Clang Format Checks (push) Has been cancelled
2026-02-02 07:36:46 +01:00
2 changed files with 12 additions and 19 deletions

View File

@@ -1,9 +1,10 @@
name: Bigfoot
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
on:
push:
branches:
- main
- Development
jobs:
build-and-test:
@@ -35,7 +36,7 @@ jobs:
run: infer run --compilation-database build/Debug/compile_commands.json
- name: SonarQube Scan
if: github.event_name == 'push'
if: github.head_ref == 'main' || github.ref_name == 'main'
uses: SonarSource/sonarqube-scan-action@v7.0.0
with:
args: >
@@ -43,4 +44,4 @@ jobs:
-Dsonar.verbose=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST }}

View File

@@ -9,6 +9,7 @@
#include <EASTL/array.h>
#include <EASTL/bit.h>
#include <EASTL/optional.h>
#include <EASTL/type_traits.h>
#include <EASTL/utility.h>
@@ -32,7 +33,7 @@ class Singleton
*/
static constexpr TYPE& Instance()
{
return *eastl::bit_cast<TYPE*>(ms_instance.data());
return ms_instance.value();
}
class Lifetime
@@ -78,9 +79,7 @@ class Singleton
template<typename... ARGS>
static void Initialize(ARGS&&... p_args)
{
new (ms_instance.data()) TYPE(eastl::forward<ARGS>(p_args)...);
ms_initialized = true;
ms_instance.emplace(eastl::forward<ARGS>(p_args)...);
}
/**
@@ -89,20 +88,13 @@ class Singleton
*/
static void Finalize()
{
eastl::bit_cast<TYPE*>(ms_instance.data())->~TYPE();
ms_initialized = false;
ms_instance.reset();
}
/**
* The singleton.
*/
alignas(alignof(TYPE)) inline static eastl::array<std::byte, sizeof(TYPE)> ms_instance;
/**
* Is the singleton initialized?
*/
inline static bool ms_initialized = false;
inline static eastl::optional<TYPE> ms_instance;
};
} // namespace Bigfoot
#endif