232 lines
8.0 KiB
C++
232 lines
8.0 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
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
#include "SGCore/SGThumperCommand.h"
|
|
|
|
#include "SGCoreImpl/SGExportedFunctions.h"
|
|
#include "SGInterop/SGIC_FSGThumperCommandImpl.h"
|
|
|
|
struct USGThumperCommand::FImpl
|
|
{
|
|
/************************
|
|
* Member variables
|
|
************************/
|
|
|
|
FSGThumperCommandImpl ThumperCommandImpl;
|
|
|
|
/************************
|
|
* Owner object
|
|
************************/
|
|
|
|
USGThumperCommand* Owner;
|
|
|
|
/************************
|
|
* Constructor / Destructor
|
|
************************/
|
|
|
|
explicit FImpl(USGThumperCommand* InOwner);
|
|
~FImpl();
|
|
|
|
/************************
|
|
* Default copy constructor & copy assignment operator
|
|
************************/
|
|
|
|
FImpl(const FImpl& Rhs) = default;
|
|
FImpl& operator=(const FImpl& Rhs) = default;
|
|
|
|
/************************
|
|
* Methods
|
|
************************/
|
|
|
|
void SyncUProperties();
|
|
void SyncImplObject();
|
|
};
|
|
|
|
USGThumperCommand* USGThumperCommand::NewThumperCommand(UObject* Outer, const FSGThumperCommandImpl& ThumperCommandImpl)
|
|
{
|
|
USGThumperCommand* Instance = NewObject<USGThumperCommand>(Outer);
|
|
Instance->SetThumperCommandImpl(ThumperCommandImpl);
|
|
return Instance;
|
|
}
|
|
|
|
USGThumperCommand* USGThumperCommand::NewThumperCommand(UObject* Outer)
|
|
{
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_ctor(&OutThumperCommandImplContainer);
|
|
|
|
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
|
|
}
|
|
|
|
USGThumperCommand* USGThumperCommand::NewThumperCommand(UObject* Outer, const int32 Magnitude)
|
|
{
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_ctor_Magnitude(&OutThumperCommandImplContainer, Magnitude);
|
|
|
|
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
|
|
}
|
|
|
|
USGThumperCommand* USGThumperCommand::Off(UObject* Outer)
|
|
{
|
|
FSGIC_FSGThumperCommandImpl OutContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_Off(&OutContainer);
|
|
|
|
return NewThumperCommand(Outer, OutContainer.ThumperCommandImpl);
|
|
}
|
|
|
|
USGThumperCommand::USGThumperCommand()
|
|
:
|
|
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 )
|
|
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 > 24 ) */
|
|
{
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_ctor(&OutThumperCommandImplContainer);
|
|
|
|
Pimpl->ThumperCommandImpl = MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl);
|
|
Pimpl->SyncUProperties();
|
|
}
|
|
|
|
USGThumperCommand::USGThumperCommand(const int32 Magnitude)
|
|
:
|
|
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 )
|
|
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 > 24 ) */
|
|
{
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_ctor_Magnitude(&OutThumperCommandImplContainer, Magnitude);
|
|
|
|
Pimpl->ThumperCommandImpl = MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl);
|
|
Pimpl->SyncUProperties();
|
|
}
|
|
|
|
USGThumperCommand::USGThumperCommand(const FSGThumperCommandImpl& ThumperCommandImpl)
|
|
:
|
|
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 )
|
|
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 > 24 ) */
|
|
{
|
|
SetThumperCommandImpl(ThumperCommandImpl);
|
|
Pimpl->SyncUProperties();
|
|
}
|
|
|
|
USGThumperCommand::~USGThumperCommand() = default;
|
|
|
|
void USGThumperCommand::SetThumperCommandImpl(const FSGThumperCommandImpl& ThumperCommandImpl)
|
|
{
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandContainer;
|
|
FSGIC_FSGThumperCommandImpl RhsContainer{ThumperCommandImpl};
|
|
SGCoreImpl_FSGThumperCommandImpl_ctor_copy(&OutThumperCommandContainer, &RhsContainer);
|
|
Pimpl->ThumperCommandImpl = MoveTemp(RhsContainer.ThumperCommandImpl);
|
|
}
|
|
|
|
const FSGThumperCommandImpl& USGThumperCommand::ToThumperCommandImpl() const
|
|
{
|
|
return Pimpl->ThumperCommandImpl;
|
|
}
|
|
|
|
int32 USGThumperCommand::GetMagnitude() const
|
|
{
|
|
Pimpl->SyncImplObject();
|
|
|
|
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ToThumperCommandImpl()};
|
|
return SGCoreImpl_FSGThumperCommandImpl_GetMagnitude(&ThumperCommandImplContainer);
|
|
}
|
|
|
|
void USGThumperCommand::SetMagnitude(const int32 Magnitude)
|
|
{
|
|
Pimpl->SyncImplObject();
|
|
|
|
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ToThumperCommandImpl()};
|
|
SGCoreImpl_FSGThumperCommandImpl_SetMagnitude(&ThumperCommandImplContainer, Magnitude);
|
|
|
|
Pimpl->SyncUProperties();
|
|
}
|
|
|
|
USGThumperCommand* USGThumperCommand::Copy(UObject* Outer) const
|
|
{
|
|
Pimpl->SyncImplObject();
|
|
|
|
FSGIC_FSGThumperCommandImpl InstanceContainer{ToThumperCommandImpl()};
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_Copy(&InstanceContainer, &OutThumperCommandImplContainer);
|
|
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
|
|
}
|
|
|
|
USGThumperCommand* USGThumperCommand::Merge(UObject* Outer, const USGThumperCommand* ThumperCommand) const
|
|
{
|
|
Pimpl->SyncImplObject();
|
|
|
|
FSGIC_FSGThumperCommandImpl InstanceContainer{ToThumperCommandImpl()};
|
|
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ThumperCommand->ToThumperCommandImpl()};
|
|
FSGIC_FSGThumperCommandImpl OutThumperCommandImplContainer;
|
|
SGCoreImpl_FSGThumperCommandImpl_Merge(&InstanceContainer, &OutThumperCommandImplContainer,
|
|
&ThumperCommandImplContainer);
|
|
return NewThumperCommand(Outer, MoveTemp(OutThumperCommandImplContainer.ThumperCommandImpl));
|
|
}
|
|
|
|
bool USGThumperCommand::Equals(const USGThumperCommand* ThumperCommand) const
|
|
{
|
|
Pimpl->SyncImplObject();
|
|
|
|
FSGIC_FSGThumperCommandImpl InstanceContainer{ToThumperCommandImpl()};
|
|
FSGIC_FSGThumperCommandImpl ThumperCommandImplContainer{ThumperCommand->ToThumperCommandImpl()};
|
|
return SGCoreImpl_FSGThumperCommandImpl_Equals(&InstanceContainer, &ThumperCommandImplContainer);
|
|
}
|
|
|
|
USGThumperCommand::FImpl::FImpl(USGThumperCommand* InOwner)
|
|
: Owner(InOwner)
|
|
{
|
|
}
|
|
|
|
USGThumperCommand::FImpl::~FImpl() = default;
|
|
|
|
void USGThumperCommand::FImplDeleter::operator()(const FImpl* P) const
|
|
{
|
|
delete P;
|
|
}
|
|
|
|
void USGThumperCommand::FImpl::SyncImplObject()
|
|
{
|
|
}
|
|
|
|
void USGThumperCommand::FImpl::SyncUProperties()
|
|
{
|
|
} |