Compare commits
4 Commits
3466469440
...
Developmen
| Author | SHA1 | Date | |
|---|---|---|---|
| 5829530652 | |||
| a062a058cd | |||
| 46b8095c6a | |||
| 63fd92c584 |
@@ -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 }}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user