Files
Plugin/Source/SenseGloveCore/Public/SGCore/SGFingerCommand.h
T

203 lines
5.6 KiB
C++

/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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
*
* A command for five fingers that can be sent to a Sense Glove device.
*/
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGFingerCommand.generated.h"
class FSGBuzzCommandImpl;
class FSGFingerCommandImpl;
class FSGForceFeedbackCommandImpl;
class FSGTimedBuzzCommandImpl;
/**
* A command that contains values (levels) for five fingers.
*/
UCLASS(Abstract, BlueprintType)
class SENSEGLOVECORE_API USGFingerCommand : public UObject
{
GENERATED_BODY()
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
protected:
/**
*
*/
USGFingerCommand();
/**
*
*/
explicit USGFingerCommand(const TArray<int32>& InLevels);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGFingerCommand(const FSGFingerCommandImpl& FingerCommandImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGFingerCommand(const FSGBuzzCommandImpl& BuzzCommandImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGFingerCommand(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl);
/**
* The cast from underlying child type constructor.
*/
explicit USGFingerCommand(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
/**
* The cast from underlying child pointer type constructor.
*/
explicit USGFingerCommand(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGFingerCommand() override;
protected:
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGFingerCommandImpl& FingerCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGBuzzCommandImpl& BuzzCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGForceFeedbackCommandImpl& ForceFeedbackCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(const FSGTimedBuzzCommandImpl& TimedBuzzCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGFingerCommandImpl> FingerCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGForceFeedbackCommandImpl> ForceFeedbackCommandImpl);
/**
* Allows the child classes to set the underlying object after construction.
*/
void SetFingerCommandImpl(TSharedRef<FSGTimedBuzzCommandImpl> TimedBuzzCommandImpl);
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGFingerCommandImpl> ToFingerCommandImpl() const;
public:
/**
*
*/
TArray<int32> GetLevels() const;
public:
/**
*
*/
int32 GetLevel(int32 Finger) const;
/**
*
*/
void SetLevel(int32 Finger, int32 Value);
/**
* Check if this command contains the same values as another.
*/
bool Equals(const USGFingerCommand* FingerCommand) const;
/**
* Create a string representation of this finger command.
*/
FString ToString() const;
};