178 lines
4.8 KiB
C++
178 lines
4.8 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/Array.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "Runtime/Launch/Resources/Version.h"
|
|
#include "Templates/SharedPointer.h"
|
|
#include "Templates/UniquePtr.h"
|
|
|
|
namespace SGCore
|
|
{
|
|
namespace Haptics
|
|
{
|
|
class FingerCommand;
|
|
}
|
|
}
|
|
|
|
class FSGBuzzCommandImpl;
|
|
class FSGForceFeedbackCommandImpl;
|
|
class FSGTimedBuzzCommandImpl;
|
|
|
|
class SENSEGLOVECOREIMPL_API FSGFingerCommandImpl : public TSharedFromThis<FSGFingerCommandImpl>
|
|
{
|
|
public:
|
|
typedef SGCore::Haptics::FingerCommand FFingerCommandType;
|
|
|
|
private:
|
|
struct FImpl;
|
|
|
|
struct FImplDeleter
|
|
{
|
|
void operator()(const FImpl* P) const;
|
|
};
|
|
|
|
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
|
FImplDeleter PimplDeleter;
|
|
|
|
public:
|
|
FSGFingerCommandImpl();
|
|
|
|
explicit FSGFingerCommandImpl(const TArray<int32>& Levels);
|
|
|
|
public:
|
|
/**
|
|
* The cast from underlying type constructor.
|
|
*/
|
|
explicit FSGFingerCommandImpl(const FFingerCommandType& FingerCommand);
|
|
|
|
/**
|
|
* The cast from underlying pointer type constructor.
|
|
*/
|
|
explicit FSGFingerCommandImpl(TSharedRef<FFingerCommandType> FingerCommand);
|
|
|
|
public:
|
|
/**
|
|
* The copy constructor.
|
|
*/
|
|
FSGFingerCommandImpl(const FSGFingerCommandImpl& Rhs);
|
|
|
|
/**
|
|
* The move constructor
|
|
*/
|
|
FSGFingerCommandImpl(FSGFingerCommandImpl&& Rhs)
|
|
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 )
|
|
noexcept
|
|
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */
|
|
;
|
|
|
|
public:
|
|
/**
|
|
* The destructor.
|
|
*/
|
|
virtual ~FSGFingerCommandImpl();
|
|
|
|
public:
|
|
/**
|
|
* The copy assignment operator.
|
|
*/
|
|
FSGFingerCommandImpl& operator=(const FSGFingerCommandImpl& Rhs);
|
|
|
|
/**
|
|
* The move assignment operator.
|
|
*/
|
|
FSGFingerCommandImpl& operator=(FSGFingerCommandImpl&& Rhs)
|
|
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 )
|
|
noexcept
|
|
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */
|
|
;
|
|
|
|
public:
|
|
/**
|
|
* The cast to underlying type method.
|
|
*/
|
|
const FFingerCommandType& ToFingerCommand() const;
|
|
|
|
/**
|
|
* The cast to underlying type method.
|
|
*/
|
|
TSharedRef<FFingerCommandType> ToFingerCommandRef() const;
|
|
|
|
protected:
|
|
/**
|
|
* The non-const cast to underlying type method.
|
|
*/
|
|
FFingerCommandType& ToFingerCommand();
|
|
|
|
/**
|
|
* The non-const cast to underlying type method.
|
|
*/
|
|
TSharedRef<FFingerCommandType> ToFingerCommandRef();
|
|
|
|
public:
|
|
/**
|
|
* The cast to base TSharedRef<FSGFingerCommandImpl> type method.
|
|
*/
|
|
TSharedRef<FSGFingerCommandImpl> ToFingerCommandImplRef();
|
|
|
|
/**
|
|
* The cast to derived TSharedRef<FSGBuzzCommandImpl> type method.
|
|
*/
|
|
TSharedRef<FSGBuzzCommandImpl> ToBuzzCommandImplRef();
|
|
|
|
/**
|
|
* The cast to derived TSharedRef<FSGForceFeedbackCommandImpl> type method.
|
|
*/
|
|
TSharedRef<FSGForceFeedbackCommandImpl> ToForceFeedbackCommandImplRef();
|
|
|
|
/**
|
|
* The cast to derived TSharedRef<FSGTimedBuzzCommandImpl> type method.
|
|
*/
|
|
TSharedRef<FSGTimedBuzzCommandImpl> ToTimedBuzzCommandImplRef();
|
|
|
|
public:
|
|
virtual TArray<int32> GetLevels() const;
|
|
void SetLevels(const TArray<int32>& Levels);
|
|
|
|
virtual int32 GetLevel(int32 Finger) const;
|
|
virtual void SetLevel(int32 Finger, int32 Value);
|
|
|
|
virtual bool Equals(const FSGFingerCommandImpl& FingerCommandImpl) const;
|
|
|
|
virtual FString ToString() const;
|
|
};
|