revamp sglog to use unreal's tuniqueptr instead of std::unique_ptr
This commit is contained in:
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Revamped `FSGHMDTracker` to resolve a critical deadlock between the rendering and game threads in Unreal Engine `5.6` that occurrs when `IHeadMountedDisplay::GetHMDMonitorInfo()` is invoked from `FSGXRTracker::GetControllerTransform()`. This is similar to another [critical deadlock issue (UE-212224), occurring during PipelinedFrameState acquisition, addressed in the `v2.5.0` release](#250---2025-05-09).
|
||||
- Bumped the SenseGlove libraries to `v2.203.0-f3d3e676`.
|
||||
- SenseGlove libraries have migrated to `C++20` from `C++17`.
|
||||
- Revamped the `SGLog` logging utility class to use `TUniquePtr` instead of `std::unique_ptr`.
|
||||
- Bumped the SenseGlove Unreal Engine Marketplace Packager `v0.6.0-4108c6f`.
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -42,7 +42,10 @@ DEFINE_LOG_CATEGORY(LogGeneric)
|
||||
|
||||
struct FSGLogCore::FStaticImpl
|
||||
{
|
||||
public:
|
||||
/************************
|
||||
* Type definitions
|
||||
************************/
|
||||
|
||||
struct VerbosityMapper
|
||||
{
|
||||
FString Tag;
|
||||
@@ -51,33 +54,56 @@ public:
|
||||
VerbosityMapper(const FString& InTag, const FColor& InColor);
|
||||
};
|
||||
|
||||
public:
|
||||
/************************
|
||||
* Member variables
|
||||
************************/
|
||||
|
||||
TMap<FSGLogCore::EVerbosity, VerbosityMapper> VerbosityMap;
|
||||
|
||||
bool bInitialized;
|
||||
|
||||
public:
|
||||
/************************
|
||||
* Constructor / Destructor
|
||||
************************/
|
||||
|
||||
FStaticImpl();
|
||||
~FStaticImpl();
|
||||
};
|
||||
|
||||
struct FSGLogCore::FImpl
|
||||
{
|
||||
public:
|
||||
/************************
|
||||
* Member variables
|
||||
************************/
|
||||
|
||||
FSGLogCore::EVerbosity Verbosity;
|
||||
FSGLogCore::ECategory Category;
|
||||
FString File;
|
||||
FString Function;
|
||||
FString Line;
|
||||
|
||||
/************************
|
||||
* Constructor / Destructor
|
||||
************************/
|
||||
|
||||
FImpl();
|
||||
~FImpl();
|
||||
|
||||
/************************
|
||||
* Default copy constructor & copy assignment operator
|
||||
************************/
|
||||
|
||||
FImpl(const FImpl& Rhs) = default;
|
||||
FImpl& operator=(const FImpl& Rhs) = default;
|
||||
};
|
||||
|
||||
FSGLogCore::FStaticImplDeleter FSGLogCore::SPimplDeleter;
|
||||
std::unique_ptr<FSGLogCore::FStaticImpl, FSGLogCore::FStaticImplDeleter> FSGLogCore::SPimpl =
|
||||
std::unique_ptr<FSGLogCore::FStaticImpl, FSGLogCore::FStaticImplDeleter>(
|
||||
new FSGLogCore::FStaticImpl{}, FSGLogCore::SPimplDeleter);
|
||||
TUniquePtr<FSGLogCore::FStaticImpl, FSGLogCore::FStaticImplDeleter> FSGLogCore::SPimpl{
|
||||
new FStaticImpl{}, FStaticImplDeleter()
|
||||
};
|
||||
|
||||
FSGLogCore::FSGLogCore(const EVerbosity& Verbosity, const ECategory& Category, const std::string& File,
|
||||
const std::string& Function, const int32 Line)
|
||||
: Pimpl(std::unique_ptr<FImpl, FImplDeleter>(new FImpl{}, PimplDeleter)),
|
||||
const std::string& Function, const int32 Line)
|
||||
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{}, PimplDeleter)),
|
||||
bAnyEntries(false)
|
||||
{
|
||||
#if defined ( SENSEGLOVE_LOGGING )
|
||||
@@ -85,12 +111,14 @@ FSGLogCore::FSGLogCore(const EVerbosity& Verbosity, const ECategory& Category, c
|
||||
{
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Fatal,
|
||||
FStaticImpl::VerbosityMapper(TEXT("FATAL"), FColor::White));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Error, FStaticImpl::VerbosityMapper(TEXT("ERROR"), FColor::Red));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Error,
|
||||
FStaticImpl::VerbosityMapper(TEXT("ERROR"), FColor::Red));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Warning,
|
||||
FStaticImpl::VerbosityMapper(TEXT("WARNING"), FColor::Yellow));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Display,
|
||||
FStaticImpl::VerbosityMapper(TEXT("DISPLAY"), FColor::Green));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Log, FStaticImpl::VerbosityMapper(TEXT("LOG"), FColor::Silver));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Log,
|
||||
FStaticImpl::VerbosityMapper(TEXT("LOG"), FColor::Silver));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::Verbose,
|
||||
FStaticImpl::VerbosityMapper(TEXT("VERBOSE"), FColor::Purple));
|
||||
SPimpl->VerbosityMap.Add(FSGLogCore::EVerbosity::VeryVerbose,
|
||||
@@ -127,46 +155,46 @@ FSGLogCore::~FSGLogCore()
|
||||
switch (Verbosity)
|
||||
{
|
||||
case EVerbosity::Display:
|
||||
{
|
||||
UE_LOG(LogGeneric, Display, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, Display, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Error:
|
||||
{
|
||||
UE_LOG(LogGeneric, Error, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, Error, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Fatal:
|
||||
{
|
||||
UE_LOG(LogGeneric, Fatal, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, Fatal, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Log:
|
||||
{
|
||||
UE_LOG(LogGeneric, Log, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, Log, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Verbose:
|
||||
{
|
||||
UE_LOG(LogGeneric, Verbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, Verbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::VeryVerbose:
|
||||
{
|
||||
UE_LOG(LogGeneric, VeryVerbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, VeryVerbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Warning:
|
||||
{
|
||||
UE_LOG(LogGeneric, Warning, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogGeneric, Warning, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,46 +204,46 @@ FSGLogCore::~FSGLogCore()
|
||||
switch (Verbosity)
|
||||
{
|
||||
case EVerbosity::Display:
|
||||
{
|
||||
UE_LOG(LogEditor, Display, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, Display, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Error:
|
||||
{
|
||||
UE_LOG(LogEditor, Error, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, Error, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Fatal:
|
||||
{
|
||||
UE_LOG(LogEditor, Fatal, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, Fatal, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Log:
|
||||
{
|
||||
UE_LOG(LogEditor, Log, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, Log, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Verbose:
|
||||
{
|
||||
UE_LOG(LogEditor, Verbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, Verbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::VeryVerbose:
|
||||
{
|
||||
UE_LOG(LogEditor, VeryVerbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, VeryVerbose, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
|
||||
case EVerbosity::Warning:
|
||||
{
|
||||
UE_LOG(LogEditor, Warning, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
{
|
||||
UE_LOG(LogEditor, Warning, TEXT("%s"), Message.GetCharArray().GetData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* defined ( SENSEGLOVE_LOGGING ) */
|
||||
@@ -226,8 +254,10 @@ FSGLogCore::FStaticImpl::FStaticImpl()
|
||||
{
|
||||
}
|
||||
|
||||
FSGLogCore::FStaticImpl::~FStaticImpl() = default;
|
||||
|
||||
FSGLogCore::FStaticImpl::VerbosityMapper::VerbosityMapper(const FString& InTag,
|
||||
const FColor& InColor)
|
||||
const FColor& InColor)
|
||||
: Tag(InTag),
|
||||
Color(InColor)
|
||||
{
|
||||
@@ -238,7 +268,15 @@ void FSGLogCore::FStaticImplDeleter::operator()(const FSGLogCore::FStaticImpl* P
|
||||
delete Pointer;
|
||||
}
|
||||
|
||||
FSGLogCore::FImpl::FImpl()
|
||||
: Verbosity(EVerbosity::Verbose),
|
||||
Category(ECategory::Generic)
|
||||
{
|
||||
}
|
||||
|
||||
FSGLogCore::FImpl::~FImpl() = default;
|
||||
|
||||
void FSGLogCore::FImplDeleter::operator()(const FSGLogCore::FImpl* Pointer) const
|
||||
{
|
||||
delete Pointer;
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "Containers/StringConv.h"
|
||||
#include "Containers/UnrealString.h"
|
||||
@@ -47,6 +46,7 @@
|
||||
#include "Math/Rotator.h"
|
||||
#include "Math/Transform.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Templates/SharedPointer.h"
|
||||
#include "Templates/UnrealTemplate.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogEditor, All, All);
|
||||
@@ -646,8 +646,7 @@ private:
|
||||
void operator()(const FStaticImpl* Pointer) const;
|
||||
};
|
||||
|
||||
static std::unique_ptr<FStaticImpl, FStaticImplDeleter> SPimpl;
|
||||
static FStaticImplDeleter SPimplDeleter;
|
||||
static TUniquePtr<FStaticImpl, FStaticImplDeleter> SPimpl;
|
||||
|
||||
struct FImpl;
|
||||
|
||||
@@ -656,7 +655,7 @@ private:
|
||||
void operator()(const FImpl* Pointer) const;
|
||||
};
|
||||
|
||||
std::unique_ptr<FImpl, FImplDeleter> Pimpl;
|
||||
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
||||
FImplDeleter PimplDeleter;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user