/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @section LICENSE * * Copyright (c) 2020 - 2023 SenseGlove * * @section DESCRIPTION * * A command for five fingers that can be sent to a Sense Glove device. */ #pragma once #include #include #include #include #include "Platform.hpp" namespace SGCore { namespace Haptics { /// A command that contains values (levels) for five fingers. class SGCORE_API FingerCommand; }// namespace Haptics }// namespace SGCore /// A command that contains values (levels) for five fingers. class SGCORE_API SGCore::Haptics::FingerCommand { private: struct Impl; std::unique_ptr Pimpl; #if SENSEGLOVE_UNREAL_ENGINE_PLUGIN public: #else /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */ protected: #endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */ FingerCommand(); #if SENSEGLOVE_UNREAL_ENGINE_PLUGIN FingerCommand(const std::vector& levels); #endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */ public: /** * The copy constructor. */ FingerCommand(const FingerCommand& rhs); /** * The move constructor. */ FingerCommand(FingerCommand&& rhs) noexcept; virtual ~FingerCommand(); public: /** * The copy assignment operator. */ FingerCommand& operator=(const FingerCommand& rhs); /** * The move assignment operator. */ FingerCommand& operator=(FingerCommand&& rhs) noexcept; public: #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ virtual const std::vector& GetLevels() const; #if SENSEGLOVE_UNREAL_ENGINE_PLUGIN public: #else /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */ protected: #endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */ /// Input level for specific finger. void SetLevels(const std::vector& levels); public: #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ virtual int32_t GetLevel(int32_t finger) const; virtual void SetLevel(int32_t finger, int32_t value); public: /// Check if this command contains the same values as another. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ virtual bool Equals(const FingerCommand& fingerCommand) const; /// Create a string representation of this finger command. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ virtual std::string ToString() const; protected: /// Ensure that a value is within acceptable range. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ virtual int32_t Validate(int32_t value) const; };