Compare commits
6 Commits
b5c2e4936b
...
Developmen
| Author | SHA1 | Date | |
|---|---|---|---|
| 5829530652 | |||
| a062a058cd | |||
| 46b8095c6a | |||
| 63fd92c584 | |||
| 3466469440 | |||
| 3d4394765b |
@@ -1,9 +1,10 @@
|
|||||||
name: Bigfoot
|
name: Bigfoot
|
||||||
|
|
||||||
pull_request:
|
on:
|
||||||
branches:
|
push:
|
||||||
- main
|
branches:
|
||||||
types: [opened, synchronize, reopened]
|
- main
|
||||||
|
- Development
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
@@ -35,7 +36,7 @@ jobs:
|
|||||||
run: infer run --compilation-database build/Debug/compile_commands.json
|
run: infer run --compilation-database build/Debug/compile_commands.json
|
||||||
|
|
||||||
- name: SonarQube Scan
|
- 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
|
uses: SonarSource/sonarqube-scan-action@v7.0.0
|
||||||
with:
|
with:
|
||||||
args: >
|
args: >
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <EASTL/array.h>
|
#include <EASTL/array.h>
|
||||||
#include <EASTL/bit.h>
|
#include <EASTL/bit.h>
|
||||||
|
#include <EASTL/optional.h>
|
||||||
#include <EASTL/type_traits.h>
|
#include <EASTL/type_traits.h>
|
||||||
#include <EASTL/utility.h>
|
#include <EASTL/utility.h>
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ class Singleton
|
|||||||
*/
|
*/
|
||||||
static constexpr TYPE& Instance()
|
static constexpr TYPE& Instance()
|
||||||
{
|
{
|
||||||
return *eastl::bit_cast<TYPE*>(ms_instance.data());
|
return ms_instance.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
class Lifetime
|
class Lifetime
|
||||||
@@ -78,9 +79,7 @@ class Singleton
|
|||||||
template<typename... ARGS>
|
template<typename... ARGS>
|
||||||
static void Initialize(ARGS&&... p_args)
|
static void Initialize(ARGS&&... p_args)
|
||||||
{
|
{
|
||||||
new (ms_instance.data()) TYPE(eastl::forward<ARGS>(p_args)...);
|
ms_instance.emplace(eastl::forward<ARGS>(p_args)...);
|
||||||
|
|
||||||
ms_initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,20 +88,13 @@ class Singleton
|
|||||||
*/
|
*/
|
||||||
static void Finalize()
|
static void Finalize()
|
||||||
{
|
{
|
||||||
eastl::bit_cast<TYPE*>(ms_instance.data())->~TYPE();
|
ms_instance.reset();
|
||||||
|
|
||||||
ms_initialized = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The singleton.
|
* The singleton.
|
||||||
*/
|
*/
|
||||||
alignas(alignof(TYPE)) inline static eastl::array<std::byte, sizeof(TYPE)> ms_instance;
|
inline static eastl::optional<TYPE> ms_instance;
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the singleton initialized?
|
|
||||||
*/
|
|
||||||
inline static bool ms_initialized = false;
|
|
||||||
};
|
};
|
||||||
} // namespace Bigfoot
|
} // namespace Bigfoot
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user