Files
Plugin/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGSenseGloveInfoImpl.h
T

189 lines
5.5 KiB
C++

/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2022 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "Containers/UnrealString.h"
#include "Math/Vector.h"
#include "Runtime/Launch/Resources/Version.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
{
namespace SG
{
class SenseGloveInfo;
}
}
class SENSEGLOVECOREIMPL_API FSGSenseGloveInfoImpl final
{
public:
typedef SGCore::SG::SenseGloveInfo FSenseGloveInfoType;
public:
static bool Parse(const FString& ConstantsString, FSGSenseGloveInfoImpl& OutGloveInfo,
bool bUpdateOldModels = true);
static FSGSenseGloveInfoImpl Deserialize(const FString& SerializedString);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
FSGSenseGloveInfoImpl();
FSGSenseGloveInfoImpl(const FString& DeviceId,
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, int32 NumberOfSensors,
const FQuat& ImuCorrection,
const TArray<FVector>& StartPositions,
const TArray<FQuat>& StartRotations,
const TArray<TArray<FVector>>& GloveLengths,
const TArray<bool>& Functions);
public:
/**
* The cast from underlying type constructor.
*/
explicit FSGSenseGloveInfoImpl(const FSenseGloveInfoType& GloveInfo);
public:
/**
* The copy constructor.
*/
FSGSenseGloveInfoImpl(const FSGSenseGloveInfoImpl& Rhs);
/**
* The move constructor.
*/
FSGSenseGloveInfoImpl(FSGSenseGloveInfoImpl&& Rhs)
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 && SG_CPP17 )
noexcept
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 && SG_CPP17 ) */
;
public:
/**
* The destructor.
*/
virtual ~FSGSenseGloveInfoImpl();
public:
/**
* The copy assignment operator.
*/
FSGSenseGloveInfoImpl& operator=(const FSGSenseGloveInfoImpl& Rhs);
/**
* The move assignment operator.
*/
FSGSenseGloveInfoImpl& operator=(FSGSenseGloveInfoImpl&& Rhs)
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 && SG_CPP17 )
noexcept
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 && SG_CPP17 ) */
;
public:
/**
* The cast to underlying type method.
*/
const FSenseGloveInfoType& ToSenseGloveInfo() const;
public:
FString GetDeviceId() const;
void SetDeviceId(const FString& DeviceId);
FString GetHardwareVersion() const;
void SetHardwareVersion(const FString& HardwareVersion);
int32 GetFirmwareVersion() const;
void SetFirmwareVersion(int32 FirmwareVersion);
int32 GetSubFirmwareVersion() const;
void SetSubFirmwareVersion(int32 SubFirmwareVersion);
bool IsRight() const;
void SetIsRight(bool bRightHanded);
int32 GetNumberOfSensors() const;
void SetNumberOfSensors(int32 NumberOfSensors);
FQuat GetImuCorrection() const;
void SetImuCorrection(const FQuat& ImuCorrection);
TArray<FVector> GetStartPositions() const;
void SetStartPositions(const TArray<FVector>& StartPositions);
TArray<FQuat> GetStartRotations() const;
void SetStartRotations(const TArray<FQuat>& StartRotations);
TArray<TArray<FVector>> GetGloveLengths() const;
void SetGloveLengths(const TArray<TArray<FVector>>& GloveLengths) const;
TArray<bool> GetFunctions() const;
void SetFunctions(const TArray<bool>& Functions) const;
public:
FVector GetStartPosition(ESGFinger Finger) const;
FQuat GetStartRotation(ESGFinger Finger) const;
TArray<FVector> GetGloveLengths(ESGFinger Finger) const;
public:
TArray<TArray<FVector>> ToGloveAngles(const TArray<TArray<float>>& SensorAngles) const;
bool Equals(const FSGSenseGloveInfoImpl& SGSenseGloveInfo, bool bGeometryOnly = false) const;
public:
FString ToString(bool bShortNotation) const;
FString ToString() const;
FString Serialize() const;
};