init
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
#include "ovpCBoxAlgorithmModifiableSettings.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace Examples {
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
bool CBoxAlgorithmModifiableSettings::processClock(Kernel::CMessageClock& /*msg*/)
|
||||
{
|
||||
updateSettings();
|
||||
//print settings values
|
||||
for (size_t i = 0; i < m_SettingsValue.size(); ++i)
|
||||
{
|
||||
this->getLogManager() << Kernel::LogLevel_Info << "Setting " << i << " value is " << m_SettingsValue[i] << "\n";
|
||||
}
|
||||
this->getLogManager() << Kernel::LogLevel_Info << "\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
bool CBoxAlgorithmModifiableSettings::updateSettings()
|
||||
{
|
||||
m_SettingsValue.clear();
|
||||
const size_t nSetting = this->getStaticBoxContext().getSettingCount();
|
||||
for (size_t i = 0; i < nSetting; ++i)
|
||||
{
|
||||
CString value = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), i);
|
||||
m_SettingsValue.push_back(value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Examples
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovp_defines.h"
|
||||
|
||||
#include <openvibe/ov_all.h>
|
||||
#include <toolkit/ovtk_all.h>
|
||||
#include <visualization-toolkit/ovviz_all.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace Examples {
|
||||
/**
|
||||
* \class CBoxAlgorithmModifiableSettings
|
||||
* \author lmahe (Inria)
|
||||
* \date Mon Oct 14 16:35:48 2013
|
||||
* \brief The class CBoxAlgorithmModifiableSettings describes the box ModifiableSettings.
|
||||
*
|
||||
*/
|
||||
class CBoxAlgorithmModifiableSettings final : virtual public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override { return true; }
|
||||
bool uninitialize() override { return true; }
|
||||
bool processClock(Kernel::CMessageClock& msg) override;
|
||||
uint64_t getClockFrequency() override { return 0x1ULL << 30; } // 4Hz
|
||||
|
||||
bool process() override { return true; }
|
||||
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_BoxAlgorithm_ModifiableSettings)
|
||||
|
||||
protected:
|
||||
bool updateSettings();
|
||||
|
||||
std::vector<CString> m_SettingsValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* \class CBoxAlgorithmModifiableSettingsDesc
|
||||
* \author lmahe (Inria)
|
||||
* \date Mon Oct 14 16:35:48 2013
|
||||
* \brief Descriptor of the box ModifiableSettings.
|
||||
*
|
||||
*/
|
||||
class CBoxAlgorithmModifiableSettingsDesc final : virtual public IBoxAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
|
||||
void release() override { }
|
||||
|
||||
CString getName() const override { return CString("Modifiable Settings example"); }
|
||||
CString getAuthorName() const override { return CString("lmahe"); }
|
||||
CString getAuthorCompanyName() const override { return CString("Inria"); }
|
||||
|
||||
CString getShortDescription() const override
|
||||
{
|
||||
return CString("Settings of this box are modifiable during playback. Values are displayed in log every 5 seconds");
|
||||
}
|
||||
|
||||
CString getDetailedDescription() const override
|
||||
{
|
||||
return CString(
|
||||
"This box purpose is to test and demonstrate the modifiable settings feature.\n It has a setting of each type and all are modifiable during scenario playback.\n");
|
||||
}
|
||||
|
||||
CString getCategory() const override { return CString("Examples/Basic"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getStockItemName() const override { return CString(""); }
|
||||
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_ModifiableSettings; }
|
||||
IPluginObject* create() override { return new CBoxAlgorithmModifiableSettings; }
|
||||
|
||||
bool hasFunctionality(const EPluginFunctionality functionality) const override { return functionality == EPluginFunctionality::Visualization; }
|
||||
|
||||
|
||||
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
|
||||
{
|
||||
prototype.addSetting("Int", OV_TypeId_Integer, "1", true);
|
||||
prototype.addSetting("Float", OV_TypeId_Float, "1.3", true);
|
||||
prototype.addSetting("Bool", OV_TypeId_Boolean, "false", true);
|
||||
prototype.addSetting("String", OV_TypeId_String, "string", true);
|
||||
prototype.addSetting("filename", OV_TypeId_Filename, "somefile.txt", true);
|
||||
prototype.addSetting("script", OV_TypeId_Script, "somescript.lua", true);
|
||||
prototype.addSetting("color", OV_TypeId_Color, "20,65,90", true);
|
||||
prototype.addSetting("colorgradient", OV_TypeId_ColorGradient, "0:0,0,0; 100:60,40,40", true);
|
||||
prototype.addSetting("unit", OV_TypeId_MeasurementUnit, "V", true);
|
||||
prototype.addSetting("factor", OV_TypeId_Factor, "1e-01", true);
|
||||
|
||||
prototype.addFlag(OV_AttributeId_Box_FlagIsUnstable);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_ModifiableSettingsDesc)
|
||||
};
|
||||
} // namespace Examples
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// Boxes
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
#define OVP_ClassId_BoxAlgorithm_ModifiableSettings OpenViBE::CIdentifier(0x4AB0DD05, 0x32155D41)
|
||||
#define OVP_ClassId_BoxAlgorithm_ModifiableSettingsDesc OpenViBE::CIdentifier(0x3808515D, 0x97C7F9B6)
|
||||
|
||||
// Global defines
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
#include "ovp_global_defines.h"
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#define OV_AttributeId_Box_FlagIsUnstable OpenViBE::CIdentifier(0x666FFFFF, 0x666FFFFF)
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "ovp_defines.h"
|
||||
|
||||
#include "box-algorithms/ovpCBoxAlgorithmModifiableSettings.h"
|
||||
|
||||
OVP_Declare_Begin()
|
||||
context.getTypeManager().registerEnumerationEntry(OV_TypeId_BoxAlgorithmFlag, OV_AttributeId_Box_FlagIsUnstable.toString(),
|
||||
OV_AttributeId_Box_FlagIsUnstable.id());
|
||||
|
||||
OVP_Declare_New(OpenViBE::Plugins::Examples::CBoxAlgorithmModifiableSettingsDesc);
|
||||
OVP_Declare_End()
|
||||
Reference in New Issue
Block a user