initial public release
This commit is contained in:
@@ -0,0 +1,289 @@
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "SGCore/SGBuzzCommand.h"
|
||||
|
||||
#include "SGFingerCommandImplCast.h"
|
||||
#include "SGCoreImpl/SGExportedFunctions.h"
|
||||
#include "SGInterop/SGIC_ESGFinger.h"
|
||||
#include "SGInterop/SGIC_FSGBuzzCommandImpl.h"
|
||||
#include "SGInterop/SGIC_FSGFingerCommandImpl.h"
|
||||
#include "SGInterop/SGIC_FString.h"
|
||||
#include "SGInterop/SGIC_TArray_int32.h"
|
||||
#include "SGInterop/SGIC_TSharedPtr_FSGBuzzCommandImpl.h"
|
||||
|
||||
struct USGBuzzCommand::FImpl
|
||||
{
|
||||
/************************
|
||||
* Member variables
|
||||
************************/
|
||||
|
||||
|
||||
/************************
|
||||
* Owner object
|
||||
************************/
|
||||
|
||||
USGBuzzCommand* Owner;
|
||||
|
||||
/************************
|
||||
* Constructor / Destructor
|
||||
************************/
|
||||
|
||||
explicit FImpl(USGBuzzCommand* InOwner);
|
||||
~FImpl();
|
||||
|
||||
/************************
|
||||
* Default copy constructor & copy assignment operator
|
||||
************************/
|
||||
|
||||
FImpl(const FImpl& Rhs) = default;
|
||||
FImpl& operator=(const FImpl& Rhs) = default;
|
||||
|
||||
/************************
|
||||
* Methods
|
||||
************************/
|
||||
|
||||
void SyncUProperties();
|
||||
|
||||
void SyncImplObject();
|
||||
};
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const FSGBuzzCommandImpl& BuzzCommandImpl)
|
||||
{
|
||||
USGBuzzCommand* Instance = NewObject<USGBuzzCommand>(Outer);
|
||||
Instance->SetFingerCommandImpl(BuzzCommandImpl);
|
||||
return Instance;
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl)
|
||||
{
|
||||
USGBuzzCommand* Instance = NewObject<USGBuzzCommand>(Outer);
|
||||
Instance->SetFingerCommandImpl(MoveTemp(BuzzCommandImpl));
|
||||
return Instance;
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer)
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
|
||||
|
||||
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const TArray<int32>& BuzzLevels)
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
FSGIC_TArray_int32 BuzzLevelsContainer{BuzzLevels};
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_BuzzLevels_MakeShared(
|
||||
&OutSharedPtrContainer, &BuzzLevelsContainer);
|
||||
|
||||
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const int32 Thumb, const int32 Index, const int32 Middle,
|
||||
const int32 Ring, const int32 Pinky)
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_Thumb_Index_Middle_Ring_Pinky_MakeShared(
|
||||
&OutSharedPtrContainer, Thumb, Index, Middle, Ring, Pinky);
|
||||
|
||||
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::NewBuzzCommand(UObject* Outer, const ESGFinger Finger, const int32 BuzzLevel)
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
FSGIC_ESGFinger FingerContainer{Finger};
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_Finger_BuzzLevel_MakeShared(
|
||||
&OutSharedPtrContainer, &FingerContainer, BuzzLevel);
|
||||
|
||||
return NewBuzzCommand(Outer, OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::Off(UObject* Outer)
|
||||
{
|
||||
FSGIC_FSGBuzzCommandImpl OutContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_Off(&OutContainer);
|
||||
return NewBuzzCommand(Outer, OutContainer.BuzzCommandImpl);
|
||||
}
|
||||
|
||||
USGBuzzCommand::USGBuzzCommand()
|
||||
: USGFingerCommand(),
|
||||
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
#else
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_MakeShared(&OutSharedPtrContainer);
|
||||
|
||||
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand::USGBuzzCommand(const TArray<int32>& BuzzLevels)
|
||||
: USGFingerCommand(BuzzLevels),
|
||||
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
#else
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
FSGIC_TArray_int32 BuzzLevelsContainer{BuzzLevels};
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_BuzzLevels_MakeShared(
|
||||
&OutSharedPtrContainer, &BuzzLevelsContainer);
|
||||
|
||||
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand::USGBuzzCommand(
|
||||
const int32 Thumb, const int32 Index, const int32 Middle, const int32 Ring, const int32 Pinky)
|
||||
: USGFingerCommand(),
|
||||
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
#else
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_Thumb_Index_Middle_Ring_Pinky_MakeShared(
|
||||
&OutSharedPtrContainer, Thumb, Index, Middle, Ring, Pinky);
|
||||
|
||||
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand::USGBuzzCommand(const ESGFinger Finger, const int32 BuzzLevel)
|
||||
: USGFingerCommand(),
|
||||
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
#else
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||
{
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl OutSharedPtrContainer;
|
||||
FSGIC_ESGFinger FingerContainer{Finger};
|
||||
SGCoreImpl_FSGBuzzCommandImpl_ctor_Finger_BuzzLevel_MakeShared(
|
||||
&OutSharedPtrContainer, &FingerContainer, BuzzLevel);
|
||||
|
||||
SetFingerCommandImpl(OutSharedPtrContainer.Ptr.ToSharedRef());
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand::USGBuzzCommand(const FSGBuzzCommandImpl& BuzzCommandImpl)
|
||||
: USGFingerCommand(BuzzCommandImpl),
|
||||
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
#else
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||
{
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand::USGBuzzCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl)
|
||||
: USGFingerCommand(MoveTemp(BuzzCommandImpl)),
|
||||
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
|
||||
#else
|
||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||
{
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand::~USGBuzzCommand() = default;
|
||||
|
||||
TSharedRef<FSGBuzzCommandImpl> USGBuzzCommand::ToBuzzCommandImpl() const
|
||||
{
|
||||
SyncImplObject();
|
||||
return FSGFingerCommandImplCast::ToBuzzCommandImpl(ToFingerCommandImpl());
|
||||
}
|
||||
|
||||
void USGBuzzCommand::SyncImplObject() const
|
||||
{
|
||||
Super::SyncImplObject();
|
||||
Pimpl->SyncImplObject();
|
||||
}
|
||||
|
||||
void USGBuzzCommand::SyncUProperties()
|
||||
{
|
||||
Super::SyncUProperties();
|
||||
Pimpl->SyncUProperties();
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::Copy(UObject* Outer) const
|
||||
{
|
||||
SyncImplObject();
|
||||
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl InstanceContainer{ToBuzzCommandImpl()};
|
||||
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_Copy(&InstanceContainer, &OutBuzzCommandImplContainer);
|
||||
return NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
|
||||
}
|
||||
|
||||
USGBuzzCommand* USGBuzzCommand::Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const
|
||||
{
|
||||
SyncImplObject();
|
||||
|
||||
FSGIC_TSharedPtr_FSGBuzzCommandImpl InstanceContainer{ToBuzzCommandImpl()};
|
||||
FSGIC_FSGBuzzCommandImpl BuzzCommandImplContainer{BuzzCommand->ToBuzzCommandImpl().Get()};
|
||||
FSGIC_FSGBuzzCommandImpl OutBuzzCommandImplContainer;
|
||||
SGCoreImpl_FSGBuzzCommandImpl_Merge(&InstanceContainer, &OutBuzzCommandImplContainer, &BuzzCommandImplContainer);
|
||||
return NewBuzzCommand(Outer, MoveTemp(OutBuzzCommandImplContainer.BuzzCommandImpl));
|
||||
}
|
||||
|
||||
USGBuzzCommand::FImpl::FImpl(USGBuzzCommand* InOwner)
|
||||
: Owner(InOwner)
|
||||
{
|
||||
}
|
||||
|
||||
USGBuzzCommand::FImpl::~FImpl() = default;
|
||||
|
||||
void USGBuzzCommand::FImplDeleter::operator()(const FImpl* P) const
|
||||
{
|
||||
delete P;
|
||||
}
|
||||
|
||||
void USGBuzzCommand::FImpl::SyncUProperties()
|
||||
{
|
||||
}
|
||||
|
||||
void USGBuzzCommand::FImpl::SyncImplObject()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user