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

189 lines
4.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 "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGThumperCommand.h"
#include "SGTimedThumpCommand.generated.h"
class FSGTimedThumpCommandImpl;
/**
*
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGTimedThumpCommand final : public UObject
{
GENERATED_BODY()
public:
static USGTimedThumpCommand* NewTimedThumpCommand(
UObject* Outer, const FSGTimedThumpCommandImpl& TimedThumpCommandImpl);
public:
/**
* Internal, empty, for extended classes.
*/
static USGTimedThumpCommand* NewTimedThumpCommand(UObject* Outer);
/**
* Create a new Timed Thumper Command.
*/
static USGTimedThumpCommand* NewTimedThumpCommand(
UObject* Outer, int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
/**
* Create a new Timed Thumper Command.
*/
static USGTimedThumpCommand* NewTimedThumpCommand(
UObject* Outer, const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* Internal, empty, for extended classes.
*/
USGTimedThumpCommand();
/**
* Create a new Timed Thumper Command.
*/
USGTimedThumpCommand(int32 Magnitude, float DurationSeconds, float StartTimeSeconds = 0.0f);
/**
* Create a new Timed Thumper Command.
*/
USGTimedThumpCommand(const USGThumperCommand* BaseCommand, float DurationSeconds, float StartTimeSeconds = 0.0f);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGTimedThumpCommand(const FSGTimedThumpCommandImpl& TimedThumpCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGTimedThumpCommand() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetTimedThumpCommandImpl(const FSGTimedThumpCommandImpl& TimedThumpCommandImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGTimedThumpCommandImpl& ToTimedThumpCommandImpl() const;
public:
/**
* Magnitude in %.
*/
int32 GetMagnitude() const;
/**
*
*/
void SetMagnitude(int32 Magnitude);
/**
* Duration in seconds.
*/
float GetDuration() const;
/**
*
*/
void SetDuration(float Duration);
/**
* The elapsed time so far.
*/
float GetElapsedTime() const;
/**
*
*/
void SetElapsedTime(float ElapsedTime);
public:
/**
* Returns true if the timed command has elapsed.
*/
bool HasTimeElapsed() const;
public:
/**
* Copy the parameters of this ThumperCommand into another instance.
*/
USGTimedThumpCommand* Copy(UObject* Outer, bool bCopyElapsed = true) const;
/**
* Update the timing on this Thumper Command.
*/
void Update(float DeltaSeconds);
/**
*
*/
bool Equals(const USGTimedThumpCommand* TimedThumpCommand) const;
public:
/**
*
*/
FString ToString() const;
};