Browse Source

„src/TactileStimulation/ovpCBoxAlgorithmTactileStimulation.h“ ändern

master
Tobias Baumann 2 years ago
parent
commit
02fb3b93bf
1 changed files with 108 additions and 107 deletions
  1. 108
    107
      src/TactileStimulation/ovpCBoxAlgorithmTactileStimulation.h

+ 108
- 107
src/TactileStimulation/ovpCBoxAlgorithmTactileStimulation.h View File

///-------------------------------------------------------------------------------------------------
///
/// \file ovpCBoxAlgorithmTactileStimulator.h
/// \brief Classes of the Box Tactile Stimulator.
/// \author Tobias Baumann (TH-Nürnberg).
/// \version 1.0.
/// \date Mon Feb 21 14:59:56 2022.
/// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
///
///-------------------------------------------------------------------------------------------------
//includes
#pragma once
#include "../ovp_defines.h"
#include <boost/asio>
#include <openvibe/ov_all.h>
#include <toolkit/ovtk_all.h>
namespace OpenViBE
{
namespace Plugins
{
namespace Tactilebci
{
/// <summary> The class CBoxAlgorithmTactileStimulator describes the box Tactile Stimulator. </summary>
class CBoxAlgorithmTactileStimulation final : virtual public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
{
public:
void release() override { delete this; }
bool initialize() override;
bool uninitialize() override;
//Here is the different process callbacks possible
// - On clock ticks :
//bool processClock(Kernel::CMessageClock& msg) override;
// - On new input received (the most common behaviour for signal processing) :
//bool processInput(const size_t index) override;
// If you want to use processClock, you must provide the clock frequency.
//uint64_t getClockFrequency() override;
bool process() override;
// As we do with any class in openvibe, we use the macro below to associate this box to an unique identifier.
// The inheritance information is also made available, as we provide the superclass Toolkit::TBoxAlgorithm < IBoxAlgorithm >
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_BoxAlgorithm_TactileStimulation)
protected:
// Input decoder:
Toolkit::TStimulationDecoder<CBoxAlgorithmTactileStimulation> m_input0Decoder;
// Output decoder:
Toolkit::TStimulationEncoder<CBoxAlgorithmTactileStimulation> m_output0Encoder;
};
/// <summary> Descriptor of the box Tactile Stimulator. </summary>
class CBoxAlgorithmTactileStimulationDesc final : virtual public IBoxAlgorithmDesc
{
public:
void release() override { }
CString getName() const override { return CString("Tactile Stimulation"); }
CString getAuthorName() const override { return CString("Tobias Baumann"); }
CString getAuthorCompanyName() const override { return CString("TH-Nürnberg"); }
CString getShortDescription() const override { return CString("Controls the Tactilos on the Lattepanda GPIOs"); }
CString getDetailedDescription() const override { return CString(""); }
CString getCategory() const override { return CString("TactileBCI"); }
CString getVersion() const override { return CString("1.0"); }
CString getStockItemName() const override { return CString("gtk-network"); }
CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_TactileStimulator; }
IPluginObject* create() override { return new CBoxAlgorithmTactileStimulator; }
/*
IBoxListener* createBoxListener() const override { return new CBoxAlgorithmTactileStimulatorListener; }
void releaseBoxListener(IBoxListener* listener) const override { delete listener; }
*/
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
{
prototype.addInput("StimInput",OV_TypeId_Stimulations);
//prototype.addFlag(Kernel::BoxFlag_CanModifyInput);
//prototype.addFlag(Kernel::BoxFlag_CanAddInput);
prototype.addOutput("StimOutput",OV_TypeId_Stimulations);
//prototype.addFlag(Kernel::BoxFlag_CanModifyOutput);
//prototype.addFlag(Kernel::BoxFlag_CanAddOutput);
//No setting specified.To add settings use :
//prototype.addSetting("SettingName",OV_TypeId_XXXX,"default value");
//prototype.addFlag(Kernel::BoxFlag_CanModifySetting);
//prototype.addFlag(Kernel::BoxFlag_CanAddSetting);
prototype.addFlag(OV_AttributeId_Box_FlagIsUnstable);
return true;
}
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_TactileStimulationDesc)
};
} // namespace Tactilebci
} // namespace Plugins
} // namespace OpenViBE
///-------------------------------------------------------------------------------------------------
///
/// \file ovpCBoxAlgorithmTactileStimulator.h
/// \brief Classes of the Box Tactile Stimulator.
/// \author Tobias Baumann (TH-Nürnberg).
/// \version 1.0.
/// \date Mon Feb 21 14:59:56 2022.
/// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
///
///-------------------------------------------------------------------------------------------------

//includes
#pragma once

#include "../ovp_defines.h"

#include <boost/asio.hpp>
#include <openvibe/ov_all.h>
#include <toolkit/ovtk_all.h>

namespace OpenViBE
{
namespace Plugins
{
namespace Tactilebci
{
/// <summary> The class CBoxAlgorithmTactileStimulator describes the box Tactile Stimulator. </summary>
class CBoxAlgorithmTactileStimulation final : virtual public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
{
public:
void release() override { delete this; }

bool initialize() override;
bool uninitialize() override;

//Here is the different process callbacks possible
// - On clock ticks :
//bool processClock(Kernel::CMessageClock& msg) override;
// - On new input received (the most common behaviour for signal processing) :
//bool processInput(const size_t index) override;

// If you want to use processClock, you must provide the clock frequency.
//uint64_t getClockFrequency() override;

bool process() override;

// As we do with any class in openvibe, we use the macro below to associate this box to an unique identifier.
// The inheritance information is also made available, as we provide the superclass Toolkit::TBoxAlgorithm < IBoxAlgorithm >
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_BoxAlgorithm_TactileStimulation)

protected:
// Input decoder:
Toolkit::TStimulationDecoder<CBoxAlgorithmTactileStimulation> m_input0Decoder;
// Output decoder:
Toolkit::TStimulationEncoder<CBoxAlgorithmTactileStimulation> m_output0Encoder;

};

/// <summary> Descriptor of the box Tactile Stimulator. </summary>
class CBoxAlgorithmTactileStimulationDesc final : virtual public IBoxAlgorithmDesc
{
public:

void release() override { }

CString getName() const override { return CString("Tactile Stimulation"); }
CString getAuthorName() const override { return CString("Tobias Baumann"); }
CString getAuthorCompanyName() const override { return CString("TH-Nürnberg"); }
CString getShortDescription() const override { return CString("Controls the Tactilos on the Lattepanda GPIOs"); }
CString getDetailedDescription() const override { return CString(""); }
CString getCategory() const override { return CString("TactileBCI"); }
CString getVersion() const override { return CString("1.0"); }
CString getStockItemName() const override { return CString("gtk-network"); }

CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_TactileStimulator; }
IPluginObject* create() override { return new CBoxAlgorithmTactileStimulator; }

/*
IBoxListener* createBoxListener() const override { return new CBoxAlgorithmTactileStimulatorListener; }
void releaseBoxListener(IBoxListener* listener) const override { delete listener; }
*/
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
{
prototype.addInput("StimInput",OV_TypeId_Stimulations);

//prototype.addFlag(Kernel::BoxFlag_CanModifyInput);
//prototype.addFlag(Kernel::BoxFlag_CanAddInput);

prototype.addOutput("StimOutput",OV_TypeId_Stimulations);

//prototype.addFlag(Kernel::BoxFlag_CanModifyOutput);
//prototype.addFlag(Kernel::BoxFlag_CanAddOutput);

//No setting specified.To add settings use :
//prototype.addSetting("SettingName",OV_TypeId_XXXX,"default value");

//prototype.addFlag(Kernel::BoxFlag_CanModifySetting);
//prototype.addFlag(Kernel::BoxFlag_CanAddSetting);

prototype.addFlag(OV_AttributeId_Box_FlagIsUnstable);

return true;
}
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_TactileStimulationDesc)
};
} // namespace Tactilebci
} // namespace Plugins
} // namespace OpenViBE

Loading…
Cancel
Save