init
This commit is contained in:
+105
@@ -0,0 +1,105 @@
|
||||
#pragma once
|
||||
|
||||
#include <openvibe/ov_all.h>
|
||||
#include "../../ovtk_defines.h"
|
||||
#include "../../ovtkIVector.h"
|
||||
#include "../../ovtkIFeatureVector.h"
|
||||
#include "../../ovtkIFeatureVectorSet.h"
|
||||
#include "../ovtkTAlgorithm.h"
|
||||
|
||||
#include <xml/IXMLNode.h>
|
||||
|
||||
#define OVTK_ClassId_Algorithm_Classifier OpenViBE::CIdentifier(0x3B910935, 0xE4DBACC4)
|
||||
#define OVTK_ClassId_Algorithm_ClassifierDesc OpenViBE::CIdentifier(0xFDB84F2F, 0x2F5C510D)
|
||||
|
||||
#define OVTK_Algorithm_Classifier_InputParameterId_FeatureVector OpenViBE::CIdentifier(0x6D69BF98, 0x1EB9EE66) // Single vector to classify
|
||||
#define OVTK_Algorithm_Classifier_InputParameterId_FeatureVectorSet OpenViBE::CIdentifier(0x27C05927, 0x5DE9103A) // Training set
|
||||
#define OVTK_Algorithm_Classifier_InputParameterId_Config OpenViBE::CIdentifier(0xA705428E, 0x5BB1CADD) // The model
|
||||
#define OVTK_Algorithm_Classifier_InputParameterId_NClasses OpenViBE::CIdentifier(0x1B95825A, 0x24F2E949)
|
||||
#define OVTK_Algorithm_Classifier_InputParameterId_ExtraParameter OpenViBE::CIdentifier(0x42AD6BE3, 0xF483DE3F) // Params specific to classifier type
|
||||
|
||||
#define OVTK_Algorithm_Classifier_OutputParameterId_Class OpenViBE::CIdentifier(0x8A39A7EA, 0xF2EE45C4)
|
||||
#define OVTK_Algorithm_Classifier_OutputParameterId_ClassificationValues OpenViBE::CIdentifier(0xDA77D7E4, 0x766B48EA)
|
||||
#define OVTK_Algorithm_Classifier_OutputParameterId_ProbabilityValues OpenViBE::CIdentifier(0xDA77D7E4, 0x766B48EB)
|
||||
#define OVTK_Algorithm_Classifier_OutputParameterId_Config OpenViBE::CIdentifier(0x30590936, 0x61CE5971)
|
||||
|
||||
#define OVTK_Algorithm_Classifier_InputTriggerId_Train OpenViBE::CIdentifier(0x34684752, 0x78A46DE2)
|
||||
#define OVTK_Algorithm_Classifier_InputTriggerId_Classify OpenViBE::CIdentifier(0x843A87D8, 0x566E85A1)
|
||||
#define OVTK_Algorithm_Classifier_InputTriggerId_SaveConfig OpenViBE::CIdentifier(0x79750528, 0x6CC85FC1)
|
||||
#define OVTK_Algorithm_Classifier_InputTriggerId_LoadConfig OpenViBE::CIdentifier(0xF346BBE0, 0xADAFC735)
|
||||
|
||||
#define OVTK_Algorithm_Classifier_OutputTriggerId_Success OpenViBE::CIdentifier(0x24FAB755, 0x78868782)
|
||||
#define OVTK_Algorithm_Classifier_OutputTriggerId_Failed OpenViBE::CIdentifier(0x6E72B255, 0x317FAA04)
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API CAlgorithmClassifier : public TAlgorithm<Plugins::IAlgorithm>
|
||||
{
|
||||
public:
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
void release() override { delete this; }
|
||||
bool process() override;
|
||||
|
||||
virtual bool train(const IFeatureVectorSet& featureVectorSet) = 0;
|
||||
virtual bool classify(const IFeatureVector& featureVector, double& estimatedClass, IVector& distanceValue, IVector& probabilityValue) = 0;
|
||||
|
||||
virtual XML::IXMLNode* saveConfig() = 0;
|
||||
virtual bool loadConfig(XML::IXMLNode* configurationRoot) = 0;
|
||||
|
||||
virtual size_t getNProbabilities() = 0;
|
||||
virtual size_t getNDistances() = 0;
|
||||
|
||||
_IsDerivedFromClass_(TAlgorithm<Plugins::IAlgorithm>, OVTK_ClassId_Algorithm_Classifier)
|
||||
|
||||
protected:
|
||||
bool initializeExtraParameterMechanism();
|
||||
bool uninitializeExtraParameterMechanism();
|
||||
|
||||
uint64_t getUInt64Parameter(const CIdentifier& parameterID);
|
||||
int64_t getInt64Parameter(const CIdentifier& parameterID);
|
||||
double getDoubleParameter(const CIdentifier& parameterID);
|
||||
bool getBooleanParameter(const CIdentifier& parameterID);
|
||||
CString* getCStringParameter(const CIdentifier& parameterID);
|
||||
uint64_t getEnumerationParameter(const CIdentifier& parameterID, const CIdentifier& enumerationIdentifier);
|
||||
|
||||
private:
|
||||
CString& getParameterValue(const CIdentifier& parameterID) const;
|
||||
static void setMatrixOutputDimension(Kernel::TParameterHandler<CMatrix*>& matrix, size_t length);
|
||||
|
||||
Kernel::IAlgorithmProxy* m_AlgorithmProxy = nullptr;
|
||||
void* m_ExtraParametersMap = nullptr;
|
||||
};
|
||||
|
||||
class OVTK_API CAlgorithmClassifierDesc : public Plugins::IAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& algorithmPrototype) const override
|
||||
{
|
||||
algorithmPrototype.addInputParameter(OVTK_Algorithm_Classifier_InputParameterId_FeatureVector, "Feature vector", Kernel::ParameterType_Matrix);
|
||||
algorithmPrototype.addInputParameter(OVTK_Algorithm_Classifier_InputParameterId_FeatureVectorSet, "Feature vector set", Kernel::ParameterType_Matrix);
|
||||
algorithmPrototype.addInputParameter(OVTK_Algorithm_Classifier_InputParameterId_Config, "Configuration", Kernel::ParameterType_Pointer);
|
||||
algorithmPrototype.addInputParameter(OVTK_Algorithm_Classifier_InputParameterId_NClasses, "Number of classes", Kernel::ParameterType_UInteger);
|
||||
algorithmPrototype.addInputParameter(OVTK_Algorithm_Classifier_InputParameterId_ExtraParameter, "Extra parameter", Kernel::ParameterType_Pointer);
|
||||
|
||||
algorithmPrototype.addOutputParameter(OVTK_Algorithm_Classifier_OutputParameterId_Class, "Class", Kernel::ParameterType_Float);
|
||||
algorithmPrototype.addOutputParameter(OVTK_Algorithm_Classifier_OutputParameterId_ClassificationValues, "Hyperplane distance", Kernel::ParameterType_Matrix);
|
||||
algorithmPrototype.addOutputParameter(OVTK_Algorithm_Classifier_OutputParameterId_ProbabilityValues, "Probability values", Kernel::ParameterType_Matrix);
|
||||
algorithmPrototype.addOutputParameter(OVTK_Algorithm_Classifier_OutputParameterId_Config, "Configuration", Kernel::ParameterType_Pointer);
|
||||
|
||||
algorithmPrototype.addInputTrigger(OVTK_Algorithm_Classifier_InputTriggerId_Train, "Train");
|
||||
algorithmPrototype.addInputTrigger(OVTK_Algorithm_Classifier_InputTriggerId_Classify, "Classify");
|
||||
algorithmPrototype.addInputTrigger(OVTK_Algorithm_Classifier_InputTriggerId_LoadConfig, "Load configuration");
|
||||
algorithmPrototype.addInputTrigger(OVTK_Algorithm_Classifier_InputTriggerId_SaveConfig, "Save configuration");
|
||||
|
||||
algorithmPrototype.addOutputTrigger(OVTK_Algorithm_Classifier_OutputTriggerId_Success, "Success");
|
||||
algorithmPrototype.addOutputTrigger(OVTK_Algorithm_Classifier_OutputTriggerId_Failed, "Failed");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_(Plugins::IAlgorithmDesc, OVTK_ClassId_Algorithm_ClassifierDesc)
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtkTAlgorithm.h"
|
||||
#include "../../ovtkIFeatureVectorSet.h"
|
||||
|
||||
#define OVTK_ClassId_Algorithm_ClassifierTrainer OpenViBE::CIdentifier(0x5ABC21E6, 0x3C3D349B)
|
||||
#define OVTK_ClassId_Algorithm_ClassifierTrainerDesc OpenViBE::CIdentifier(0x56DD6401, 0x07033341)
|
||||
#define OVTK_Algorithm_ClassifierTrainer_InputParameterId_FeatureVectorSet OpenViBE::CIdentifier(0x27C05927, 0x5DE9103A)
|
||||
#define OVTK_Algorithm_ClassifierTrainer_OutputParameterId_Config OpenViBE::CIdentifier(0x30590936, 0x61CE5971)
|
||||
#define OVTK_Algorithm_ClassifierTrainer_InputTriggerId_Train OpenViBE::CIdentifier(0x34684752, 0x78A46DE2)
|
||||
#define OVTK_Algorithm_ClassifierTrainer_InputTriggerId_SaveConfig OpenViBE::CIdentifier(0x79750528, 0x6CC85FC1)
|
||||
#define OVTK_Algorithm_ClassifierTrainer_OutputTriggerId_Success OpenViBE::CIdentifier(0x7B8C0EFF, 0x26224D6B)
|
||||
#define OVTK_Algorithm_ClassifierTrainer_OutputTriggerId_Failed OpenViBE::CIdentifier(0x31B97C83, 0x59015D0E)
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API CAlgorithmClassifierTrainer : public TAlgorithm<Plugins::IAlgorithm>
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool process() override;
|
||||
virtual bool train(const IFeatureVectorSet& dataset) = 0;
|
||||
virtual bool saveConfig(IMemoryBuffer& buffer) = 0;
|
||||
|
||||
_IsDerivedFromClass_(TAlgorithm < Plugins::IAlgorithm >, OVTK_ClassId_Algorithm_ClassifierTrainer)
|
||||
};
|
||||
|
||||
class OVTK_API CAlgorithmClassifierTrainerDesc : public Plugins::IAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
prototype.addInputParameter(OVTK_Algorithm_ClassifierTrainer_InputParameterId_FeatureVectorSet, "Feature vector set", Kernel::ParameterType_Matrix);
|
||||
prototype.addOutputParameter(OVTK_Algorithm_ClassifierTrainer_OutputParameterId_Config, "Configuration", Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addInputTrigger(OVTK_Algorithm_ClassifierTrainer_InputTriggerId_Train, "Train");
|
||||
prototype.addInputTrigger(OVTK_Algorithm_ClassifierTrainer_InputTriggerId_SaveConfig, "Save configuration");
|
||||
prototype.addOutputTrigger(OVTK_Algorithm_ClassifierTrainer_OutputTriggerId_Success, "Success");
|
||||
prototype.addOutputTrigger(OVTK_Algorithm_ClassifierTrainer_OutputTriggerId_Failed, "Failed");
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_(Plugins::IAlgorithmDesc, OVTK_ClassId_Algorithm_ClassifierTrainerDesc)
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtkTAlgorithm.h"
|
||||
#include "../../ovtkIVector.h"
|
||||
#include "../../ovtkIFeatureVector.h"
|
||||
#include "../../ovtkIFeatureVectorSet.h"
|
||||
#include "ovtkCAlgorithmClassifier.h"
|
||||
|
||||
#define OVTK_ClassId_Algorithm_PairingStrategy OpenViBE::CIdentifier(0xFD3CB444, 0x58F00765)
|
||||
#define OVTK_ClassId_Algorithm_PairingStrategyDesc OpenViBE::CIdentifier(0x4341B8D6, 0xC65B7BBB)
|
||||
|
||||
#define OVTK_Algorithm_PairingStrategy_InputParameterId_SubClassifierAlgorithm OpenViBE::CIdentifier(0xD9E60DF9, 0x20EC8FC9)
|
||||
#define OVTK_Algorithm_PairingStrategy_InputTriggerId_DesignArchitecture OpenViBE::CIdentifier(0x784A9CDF, 0xA41C27F8)
|
||||
|
||||
typedef int (*fClassifierComparison)(OpenViBE::CMatrix&, OpenViBE::CMatrix&);
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
extern OVTK_API void registerClassificationComparisonFunction(const CIdentifier& classID, fClassifierComparison comparision);
|
||||
extern OVTK_API fClassifierComparison getClassificationComparisonFunction(const CIdentifier& classID);
|
||||
|
||||
|
||||
class OVTK_API CAlgorithmPairingStrategy : public CAlgorithmClassifier
|
||||
{
|
||||
public:
|
||||
bool process() override;
|
||||
void release() override { delete this; }
|
||||
|
||||
virtual bool designArchitecture(const CIdentifier& id, const size_t nClass) = 0;
|
||||
bool train(const IFeatureVectorSet& rFeatureVectorSet) override = 0;
|
||||
bool classify(const IFeatureVector& rFeatureVector, double& classId, IVector& distance, IVector& probability) override = 0;
|
||||
XML::IXMLNode* saveConfig() override = 0;
|
||||
bool loadConfig(XML::IXMLNode* pConfiguratioNode) override = 0;
|
||||
_IsDerivedFromClass_(CAlgorithmClassifier, OVTK_ClassId_Algorithm_PairingStrategy)
|
||||
size_t getNProbabilities() override = 0;
|
||||
size_t getNDistances() override = 0;
|
||||
|
||||
|
||||
protected:
|
||||
// std::vector <double> m_classes;
|
||||
//The vector will be use when the user will be able to specify class label
|
||||
CIdentifier m_subClassifierAlgorithmID = CIdentifier::undefined();
|
||||
};
|
||||
|
||||
class OVTK_API CAlgorithmPairingStrategyDesc : public CAlgorithmClassifierDesc
|
||||
{
|
||||
public:
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CAlgorithmClassifierDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addInputParameter(
|
||||
OVTK_Algorithm_PairingStrategy_InputParameterId_SubClassifierAlgorithm, "Algorithm Identifier", Kernel::ParameterType_Identifier);
|
||||
prototype.addInputTrigger(OVTK_Algorithm_PairingStrategy_InputTriggerId_DesignArchitecture, "Design Architecture");
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_(CAlgorithmClassifierDesc, OVTK_ClassId_Algorithm_PairingStrategyDesc)
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class TAlgorithmParentClass>
|
||||
class TAlgorithm : public TAlgorithmParentClass
|
||||
{
|
||||
public:
|
||||
|
||||
TAlgorithm() { }
|
||||
|
||||
bool initialize(Kernel::IAlgorithmContext& algorithmCtx) override
|
||||
{
|
||||
CScopedAlgorithm scopedAlgorithm(m_algorithmCtx, &algorithmCtx);
|
||||
return initialize();
|
||||
}
|
||||
|
||||
bool uninitialize(Kernel::IAlgorithmContext& algorithmCtx) override
|
||||
{
|
||||
CScopedAlgorithm scopedAlgorithm(m_algorithmCtx, &algorithmCtx);
|
||||
return uninitialize();
|
||||
}
|
||||
|
||||
bool process(Kernel::IAlgorithmContext& algorithmCtx) override
|
||||
{
|
||||
CScopedAlgorithm scopedAlgorithm(m_algorithmCtx, &algorithmCtx);
|
||||
return process();
|
||||
}
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
virtual bool initialize() { return true; }
|
||||
virtual bool uninitialize() { return true; }
|
||||
virtual bool process() = 0;
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
virtual Kernel::IAlgorithmContext& getAlgorithmContext()
|
||||
{
|
||||
return *m_algorithmCtx; // should never be null
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual Kernel::IConfigurationManager& getConfigurationManager() { return m_algorithmCtx->getConfigurationManager(); } // should never be null
|
||||
virtual Kernel::IAlgorithmManager& getAlgorithmManager() { return m_algorithmCtx->getAlgorithmManager(); } // should never be null
|
||||
virtual Kernel::ILogManager& getLogManager() { return m_algorithmCtx->getLogManager(); } // should never be null
|
||||
virtual Kernel::IErrorManager& getErrorManager() { return m_algorithmCtx->getErrorManager(); } // should never be null
|
||||
virtual Kernel::ITypeManager& getTypeManager() { return m_algorithmCtx->getTypeManager(); } // should never be null
|
||||
|
||||
virtual CIdentifier getNextInputParameterIdentifier(const CIdentifier& rPreviousInputParameterIdentifier) const
|
||||
{
|
||||
return m_algorithmCtx->getNextInputParameterIdentifier(rPreviousInputParameterIdentifier);
|
||||
}
|
||||
|
||||
virtual Kernel::IParameter* getInputParameter(const CIdentifier& InputParameterID) { return m_algorithmCtx->getInputParameter(InputParameterID); }
|
||||
|
||||
virtual CIdentifier getNextOutputParameterIdentifier(const CIdentifier& rPreviousOutputParameterIdentifier) const
|
||||
{
|
||||
return m_algorithmCtx->getNextOutputParameterIdentifier(rPreviousOutputParameterIdentifier);
|
||||
}
|
||||
|
||||
virtual Kernel::IParameter* getOutputParameter(const CIdentifier& outputParameterID) { return m_algorithmCtx->getOutputParameter(outputParameterID); }
|
||||
|
||||
virtual bool isInputTriggerActive(const CIdentifier& inputTriggerID) const { return m_algorithmCtx->isInputTriggerActive(inputTriggerID); }
|
||||
|
||||
virtual bool activateOutputTrigger(const CIdentifier& outputTriggerID, const bool bTriggerState)
|
||||
{
|
||||
return m_algorithmCtx->activateOutputTrigger(outputTriggerID, bTriggerState);
|
||||
}
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
_IsDerivedFromClass_(TAlgorithmParentClass, OVTK_ClassId_)
|
||||
|
||||
private:
|
||||
|
||||
class CScopedAlgorithm final
|
||||
{
|
||||
public:
|
||||
|
||||
CScopedAlgorithm(Kernel::IAlgorithmContext*& algorithmCtxRef, Kernel::IAlgorithmContext* algorithmCtx)
|
||||
: m_algorithmCtx(algorithmCtxRef) { m_algorithmCtx = algorithmCtx; }
|
||||
|
||||
~CScopedAlgorithm() { m_algorithmCtx = nullptr; }
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::IAlgorithmContext*& m_algorithmCtx;
|
||||
};
|
||||
|
||||
Kernel::IAlgorithmContext* m_algorithmCtx = nullptr;
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtkTAlgorithm.h"
|
||||
#include "ovtk_scenario_io.h"
|
||||
|
||||
#include <openvibe/kernel/scenario/ovIAlgorithmScenarioExporter.h>
|
||||
|
||||
#define OVTK_ClassId_Algorithm_ScenarioExporter OpenViBE::CIdentifier(0x7C281FEA, 0x40B66277)
|
||||
#define OVTK_ClassId_Algorithm_ScenarioExporterDesc OpenViBE::CIdentifier(0x49A9778E, 0x7BB377F9)
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API CAlgorithmScenarioExporter : public TAlgorithm<Plugins::IAlgorithmScenarioExporter>
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool process() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(TAlgorithm<Plugins::IAlgorithmScenarioExporter>, OVTK_ClassId_Algorithm_ScenarioExporter)
|
||||
};
|
||||
|
||||
class OVTK_API CAlgorithmScenarioExporterDesc : public Plugins::IAlgorithmScenarioExporterDesc
|
||||
{
|
||||
public:
|
||||
|
||||
_IsDerivedFromClass_(Plugins::IAlgorithmScenarioExporterDesc, OVTK_ClassId_Algorithm_ScenarioExporterDesc)
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtkTAlgorithm.h"
|
||||
#include "ovtk_scenario_io.h"
|
||||
#include <openvibe/kernel/scenario/ovIAlgorithmScenarioImporter.h>
|
||||
|
||||
#define OVP_ClassId_Algorithm_ScenarioImporter OpenViBE::CIdentifier(0x1EE72169, 0x2BF146C1)
|
||||
#define OVP_ClassId_Algorithm_ScenarioImporterDesc OpenViBE::CIdentifier(0x503C0DDE, 0x5D4C6CB2)
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API CAlgorithmScenarioImporter : public TAlgorithm<Plugins::IAlgorithmScenarioImporter>
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool process() override;
|
||||
|
||||
_IsDerivedFromClass_(TAlgorithm<Plugins::IAlgorithmScenarioImporter>, OVP_ClassId_Algorithm_ScenarioImporter)
|
||||
};
|
||||
|
||||
class OVTK_API CAlgorithmScenarioImporterDesc : public Plugins::IAlgorithmScenarioImporterDesc
|
||||
{
|
||||
public:
|
||||
|
||||
_IsDerivedFromClass_(Plugins::IAlgorithmScenarioImporterDesc, OVP_ClassId_Algorithm_ScenarioImporterDesc)
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_OpenViBEScenario OpenViBE::CIdentifier(0x1CD93114, 0x6A544E8C)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_FormatVersion OpenViBE::CIdentifier(0xB7818440, 0x928C3366)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Creator OpenViBE::CIdentifier(0x430C9234, 0x4825E245)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_CreatorVersion OpenViBE::CIdentifier(0x1B01311A, 0x2405842B)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Settings OpenViBE::CIdentifier(0x1B6A0E61, 0x34BC6357)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Setting OpenViBE::CIdentifier(0x54312696, 0x2FC005A4)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Setting_ID OpenViBE::CIdentifier(0x1845EA8E, 0x424AC232)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Setting_TypeID OpenViBE::CIdentifier(0x1881283E, 0x4E361232)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Setting_Name OpenViBE::CIdentifier(0x444114FB, 0x0B4C574A)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Setting_Value OpenViBE::CIdentifier(0x6D2B69EA, 0x74B95C99)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Setting_DefaultValue OpenViBE::CIdentifier(0x29C51ACB, 0x494D5778)
|
||||
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Inputs OpenViBE::CIdentifier(0x0D7B4C71, 0x3B6F537F)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input OpenViBE::CIdentifier(0x62275FDD, 0x1F1E57E0)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input_ID OpenViBE::CIdentifier(0xFC45833A, 0xEE785EA2)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input_TypeID OpenViBE::CIdentifier(0x2AFF56A1, 0x4D2D03E3)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input_Name OpenViBE::CIdentifier(0x3CA137F2, 0x60CB338E)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input_LinkedBoxID OpenViBE::CIdentifier(0x30780A0D, 0x03641BCC)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input_LinkedBoxInputIdx OpenViBE::CIdentifier(0x413A5131, 0x7BFA1941)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Input_LinkedBoxInputID OpenViBE::CIdentifier(0x81AF5685, 0x188FEAD2)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Outputs OpenViBE::CIdentifier(0x3A4E3424, 0x3AD22EE5)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output OpenViBE::CIdentifier(0x4C481179, 0x0B4A1D5E)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output_ID OpenViBE::CIdentifier(0x5366EAD8, 0xBB57B9AE)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output_TypeID OpenViBE::CIdentifier(0x157E5B37, 0x142F4D94)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output_Name OpenViBE::CIdentifier(0x2C6B06FD, 0x0973253F)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output_LinkedBoxID OpenViBE::CIdentifier(0x1F790DDB, 0x2E0A002C)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output_LinkedBoxOutputIdx OpenViBE::CIdentifier(0x53A515C8, 0x0B296360)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Output_LinkedBoxOutputID OpenViBE::CIdentifier(0xAC286F77, 0x18F7E33A)
|
||||
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Boxes OpenViBE::CIdentifier(0x4BCB7EA2, 0x49B95B54)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box OpenViBE::CIdentifier(0xF7341CA6, 0x05DBB935)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_ID OpenViBE::CIdentifier(0x388E37B5, 0x3F471DB7)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Name OpenViBE::CIdentifier(0x5472B291, 0x51F94B43)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_AlgorithmClassIdD OpenViBE::CIdentifier(0x2CBBE45B, 0xD9385308)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Inputs OpenViBE::CIdentifier(0xB07E43FA, 0x3BFB5C41)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Input OpenViBE::CIdentifier(0x7B149417, 0x39F0D7BC)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Input_ID OpenViBE::CIdentifier(0x15FF57E3, 0xAD458EF2)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Input_TypeID OpenViBE::CIdentifier(0xC7D436D2, 0x7C808FAD)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Input_Name OpenViBE::CIdentifier(0xA65B1B6D, 0x70799D8F)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Outputs OpenViBE::CIdentifier(0xD5CBFF2C, 0x349EED80)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Output OpenViBE::CIdentifier(0x8FE44764, 0xB6E9EEDE)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Output_ID OpenViBE::CIdentifier(0x4538EF5A, 0xFA511347)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Output_TypeID OpenViBE::CIdentifier(0x7C3CEAC8, 0x55E5B85F)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Output_Name OpenViBE::CIdentifier(0x858B86C9, 0x8FDE0A88)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Settings OpenViBE::CIdentifier(0x456F426E, 0xD5F745C0)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting OpenViBE::CIdentifier(0x6D781687, 0xEC0697F0)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting_ID OpenViBE::CIdentifier(0x45AF5442, 0xA46DA56B)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting_TypeID OpenViBE::CIdentifier(0x4E025442, 0xF15A306B)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting_Name OpenViBE::CIdentifier(0xF653238C, 0xCF13CC1E)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting_DefaultValue OpenViBE::CIdentifier(0x22B803B1, 0xB99EB29C)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting_Value OpenViBE::CIdentifier(0x4B157087, 0xA17AC752)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Setting_Modifiability OpenViBE::CIdentifier(0x7F87A192, 0x16534D27)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Attributes OpenViBE::CIdentifier(0x5A512182, 0xEA975174)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Attribute OpenViBE::CIdentifier(0xAAE1C0BA, 0x0CCB4F6E)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Attribute_ID OpenViBE::CIdentifier(0xFDE975E7, 0x9EE828E5)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Box_Attribute_Value OpenViBE::CIdentifier(0x08700489, 0x15D4C296)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comments OpenViBE::CIdentifier(0x05FFFB9C, 0x0D3F72B9)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment OpenViBE::CIdentifier(0x8A90B4C7, 0x1B1F91C8)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment_ID OpenViBE::CIdentifier(0x5D5AC202, 0x8A8A2049)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment_Text OpenViBE::CIdentifier(0xE1FBD2D0, 0x62644098)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment_Attributes OpenViBE::CIdentifier(0x03A34281, 0x49A94884)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment_Attribute OpenViBE::CIdentifier(0xD1BE5B9E, 0x290F273E)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment_Attribute_ID OpenViBE::CIdentifier(0x4A68A79B, 0x26590AC7)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Comment_Attribute_Value OpenViBE::CIdentifier(0x1762575C, 0x234FCEA9)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Metadata OpenViBE::CIdentifier(0x5BD6509C, 0x3F85473B)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_MetadataEntry OpenViBE::CIdentifier(0x9C2950A7, 0x109E0B28)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_MetadataEntry_ID OpenViBE::CIdentifier(0x85811583, 0x5242A4F3)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_MetadataEntry_Type OpenViBE::CIdentifier(0x596E48C6, 0xE408F6EA)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_MetadataEntry_Data OpenViBE::CIdentifier(0x95006E45, 0xA0E3D014)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Links OpenViBE::CIdentifier(0x5B4FF75F, 0x7FB1E0DA)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link OpenViBE::CIdentifier(0x7E290F90, 0xEB62C398)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_ID OpenViBE::CIdentifier(0x51FEC159, 0x0958BF76)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Source OpenViBE::CIdentifier(0xD7E0F55E, 0x576625E3)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Source_BoxID OpenViBE::CIdentifier(0x49A048C0, 0x564E3FF3)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Source_BoxOutputID OpenViBE::CIdentifier(0x458FAADC, 0xEED89711)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Source_BoxOutputIdx OpenViBE::CIdentifier(0x6C4C2561, 0x0C128F04)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Target OpenViBE::CIdentifier(0x231E8241, 0x89F06614)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Target_BoxID OpenViBE::CIdentifier(0xDB6D995F, 0xE514B76A)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Target_BoxInputID OpenViBE::CIdentifier(0x56899E5F, 0xA5D9C658)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Target_BoxInputIdx OpenViBE::CIdentifier(0x2DEDF2E1, 0x76778F6B)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Attributes OpenViBE::CIdentifier(0x3B3700A0, 0x51159BB0)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Attribute OpenViBE::CIdentifier(0xA1487B45, 0x88C442B6)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Attribute_ID OpenViBE::CIdentifier(0x03710320, 0x0A550AE0)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Link_Attribute_Value OpenViBE::CIdentifier(0x3831E536, 0x6E0C9282)
|
||||
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Attributes OpenViBE::CIdentifier(0x06B858A3, 0xE3F6B199)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Attribute OpenViBE::CIdentifier(0x195DF0C2, 0x01071746)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Attribute_ID OpenViBE::CIdentifier(0x66A99FF0, 0x402B6F19)
|
||||
#define OVTK_Algorithm_ScenarioExporter_NodeId_Scenario_Attribute_Value OpenViBE::CIdentifier(0xA4795600, 0x31AFDFB1)
|
||||
Executable
+363
@@ -0,0 +1,363 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
#include <limits>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class TBoxAlgorithmParentClass>
|
||||
class TBoxAlgorithm : public TBoxAlgorithmParentClass
|
||||
{
|
||||
public:
|
||||
|
||||
TBoxAlgorithm() { }
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
private:
|
||||
|
||||
virtual uint64_t getClockFrequency(Kernel::IBoxAlgorithmContext& ctx)
|
||||
{
|
||||
CScopedBoxAlgorithm scopedBoxAlgorithm(m_boxAlgorithmCtx, &ctx);
|
||||
return getClockFrequency();
|
||||
}
|
||||
|
||||
virtual bool initialize(Kernel::IBoxAlgorithmContext& ctx)
|
||||
{
|
||||
CScopedBoxAlgorithm scopedBoxAlgorithm(m_boxAlgorithmCtx, &ctx);
|
||||
return initialize();
|
||||
}
|
||||
|
||||
virtual bool uninitialize(Kernel::IBoxAlgorithmContext& ctx)
|
||||
{
|
||||
CScopedBoxAlgorithm scopedBoxAlgorithm(m_boxAlgorithmCtx, &ctx);
|
||||
return uninitialize();
|
||||
}
|
||||
|
||||
virtual bool processClock(Kernel::IBoxAlgorithmContext& ctx, Kernel::CMessageClock& msg)
|
||||
{
|
||||
CScopedBoxAlgorithm scopedBoxAlgorithm(m_boxAlgorithmCtx, &ctx);
|
||||
return processClock(msg);
|
||||
}
|
||||
|
||||
virtual bool processInput(Kernel::IBoxAlgorithmContext& ctx, const size_t index)
|
||||
{
|
||||
CScopedBoxAlgorithm scopedBoxAlgorithm(m_boxAlgorithmCtx, &ctx);
|
||||
return processInput(index);
|
||||
}
|
||||
|
||||
virtual bool process(Kernel::IBoxAlgorithmContext& ctx)
|
||||
{
|
||||
CScopedBoxAlgorithm oScopedBoxAlgorithm(m_boxAlgorithmCtx, &ctx);
|
||||
return process();
|
||||
}
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
public:
|
||||
|
||||
virtual uint64_t getClockFrequency() { return 0; }
|
||||
virtual bool initialize() { return true; }
|
||||
virtual bool uninitialize() { return true; }
|
||||
virtual bool processClock(Kernel::CMessageClock& /*msg*/) { return false; }
|
||||
virtual bool processInput(const size_t /*index*/) { return false; }
|
||||
virtual bool process() = 0;
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
virtual Kernel::IBoxAlgorithmContext* getBoxAlgorithmContext() { return m_boxAlgorithmCtx; }
|
||||
// virtual Kernel::IBoxAlgorithmContext& getBoxAlgorithmContext() { return *m_boxAlgorithmCtx; } this one should replace !
|
||||
virtual const Kernel::IBox& getStaticBoxContext() { return *m_boxAlgorithmCtx->getStaticBoxContext(); }
|
||||
virtual Kernel::IBoxIO& getDynamicBoxContext() { return *m_boxAlgorithmCtx->getDynamicBoxContext(); }
|
||||
virtual Kernel::IPlayerContext& getPlayerContext() { return *m_boxAlgorithmCtx->getPlayerContext(); }
|
||||
|
||||
virtual Kernel::IAlgorithmManager& getAlgorithmManager() { return getPlayerContext().getAlgorithmManager(); }
|
||||
virtual Kernel::IConfigurationManager& getConfigurationManager() { return getPlayerContext().getConfigurationManager(); }
|
||||
virtual Kernel::ILogManager& getLogManager() { return getPlayerContext().getLogManager(); }
|
||||
virtual Kernel::IErrorManager& getErrorManager() { return getPlayerContext().getErrorManager(); }
|
||||
virtual Kernel::IScenarioManager& getScenarioManager() { return getPlayerContext().getScenarioManager(); }
|
||||
virtual Kernel::ITypeManager& getTypeManager() { return getPlayerContext().getTypeManager(); }
|
||||
|
||||
virtual bool canCreatePluginObject(const CIdentifier& pluginID) { return getPlayerContext().canCreatePluginObject(pluginID); }
|
||||
|
||||
virtual Plugins::IPluginObject* createPluginObject(const CIdentifier& pluginID) { return getPlayerContext().createPluginObject(pluginID); }
|
||||
|
||||
virtual bool releasePluginObject(Plugins::IPluginObject* pluginObject) { return getPlayerContext().releasePluginObject(pluginObject); }
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
virtual void appendOutputChunkData(const size_t outputIdx, const void* buffer, const size_t size)
|
||||
{
|
||||
Kernel::IBoxAlgorithmContext* context = this->getBoxAlgorithmContext();
|
||||
if (context)
|
||||
{
|
||||
Kernel::IBoxIO* boxContext = context->getDynamicBoxContext();
|
||||
if (boxContext) { boxContext->appendOutputChunkData(outputIdx, static_cast<const uint8_t*>(buffer), size); }
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t TOutputIdx>
|
||||
void appendOutputChunkData(const void* buffer, const size_t size) { appendOutputChunkData(TOutputIdx, buffer, size); }
|
||||
|
||||
_IsDerivedFromClass_(TBoxAlgorithmParentClass, OVTK_ClassId_)
|
||||
|
||||
protected:
|
||||
|
||||
class FSettingValueAutoCast
|
||||
{
|
||||
public:
|
||||
FSettingValueAutoCast(Kernel::IBoxAlgorithmContext& ctx, const size_t index)
|
||||
: m_logManager(ctx.getPlayerContext()->getLogManager()),
|
||||
m_errorManager(ctx.getPlayerContext()->getErrorManager()),
|
||||
m_typeManager(ctx.getPlayerContext()->getTypeManager()),
|
||||
m_configManager(ctx.getPlayerContext()->getConfigurationManager())
|
||||
{
|
||||
ctx.getStaticBoxContext()->getSettingValue(index, m_settingValue);
|
||||
ctx.getStaticBoxContext()->getSettingType(index, m_settingType);
|
||||
}
|
||||
|
||||
FSettingValueAutoCast(Kernel::IBoxAlgorithmContext& ctx, const CString& name)
|
||||
: m_logManager(ctx.getPlayerContext()->getLogManager()),
|
||||
m_errorManager(ctx.getPlayerContext()->getErrorManager()),
|
||||
m_typeManager(ctx.getPlayerContext()->getTypeManager()),
|
||||
m_configManager(ctx.getPlayerContext()->getConfigurationManager())
|
||||
{
|
||||
ctx.getStaticBoxContext()->getSettingValue(name, m_settingValue);
|
||||
ctx.getStaticBoxContext()->getInterfacorType(Kernel::EBoxInterfacorType::Setting, name, m_settingType);
|
||||
}
|
||||
|
||||
FSettingValueAutoCast(Kernel::IBoxAlgorithmContext& ctx, const CIdentifier& identifier)
|
||||
: m_logManager(ctx.getPlayerContext()->getLogManager()),
|
||||
m_errorManager(ctx.getPlayerContext()->getErrorManager()),
|
||||
m_typeManager(ctx.getPlayerContext()->getTypeManager()),
|
||||
m_configManager(ctx.getPlayerContext()->getConfigurationManager())
|
||||
{
|
||||
ctx.getStaticBoxContext()->getSettingValue(identifier, m_settingValue);
|
||||
ctx.getStaticBoxContext()->getInterfacorType(Kernel::EBoxInterfacorType::Setting, identifier, m_settingType);
|
||||
}
|
||||
|
||||
operator uint32_t() const
|
||||
{
|
||||
double result;
|
||||
const CString value = m_configManager.expand(m_settingValue);
|
||||
|
||||
OV_ERROR_UNLESS(m_typeManager.evaluateSettingValue(value, result),
|
||||
"Could not expand numeric expression [" << m_settingValue << "] to unsigned integer 32bits.",
|
||||
Kernel::ErrorType::BadParsing, std::numeric_limits<uint32_t>::max(), m_errorManager, m_logManager);
|
||||
|
||||
return uint32_t(result);
|
||||
}
|
||||
|
||||
operator uint64_t() const
|
||||
{
|
||||
uint64_t stimId = std::numeric_limits<uint64_t>::max();
|
||||
const CString value = m_configManager.expand(m_settingValue);
|
||||
double result;
|
||||
if (m_typeManager.isEnumeration(m_settingType))
|
||||
{
|
||||
stimId = m_typeManager.getEnumerationEntryValueFromName(m_settingType, value);
|
||||
|
||||
OV_ERROR_UNLESS(stimId != std::numeric_limits<uint64_t>::max(),
|
||||
"Did not find an enumeration value for [" << m_typeManager.getTypeName(m_settingType) << "] = [" << m_settingValue <<
|
||||
"]",
|
||||
Kernel::ErrorType::BadParsing, std::numeric_limits<uint64_t>::max(), m_errorManager, m_logManager);
|
||||
}
|
||||
else if (m_typeManager.evaluateSettingValue(value, result)) { return uint64_t(result); }
|
||||
|
||||
// Seems like currently some plugins use FSettingValueAutoCast without knowing then setting type.
|
||||
// In this case, to avoid to pollute the console with useless messages, throw a message only if the
|
||||
// setting should be an integer.
|
||||
OV_ERROR_UNLESS(stimId != std::numeric_limits<uint64_t>::max() || m_settingType != OV_TypeId_Integer,
|
||||
"Could not expand numeric expression [" << m_settingValue << "] to unsigned integer 64bits.",
|
||||
Kernel::ErrorType::BadParsing, std::numeric_limits<uint64_t>::max(), m_errorManager, m_logManager);
|
||||
|
||||
return stimId;
|
||||
}
|
||||
|
||||
operator int() const
|
||||
{
|
||||
double res;
|
||||
const CString value = m_configManager.expand(m_settingValue);
|
||||
|
||||
OV_ERROR_UNLESS(m_typeManager.evaluateSettingValue(value, res),
|
||||
"Could not expand numeric expression [" << m_settingValue << "] to integer 32bits.",
|
||||
Kernel::ErrorType::BadParsing, std::numeric_limits<int>::max(), m_errorManager, m_logManager);
|
||||
|
||||
return int(res);
|
||||
}
|
||||
|
||||
operator int64_t() const
|
||||
{
|
||||
double res;
|
||||
const CString value = m_configManager.expand(m_settingValue);
|
||||
|
||||
OV_ERROR_UNLESS(m_typeManager.evaluateSettingValue(value, res),
|
||||
"Could not expand numeric expression [" << m_settingValue << "] to integer 64bits.",
|
||||
Kernel::ErrorType::BadParsing, std::numeric_limits<int64_t>::max(), m_errorManager, m_logManager);
|
||||
|
||||
return int64_t(res);
|
||||
}
|
||||
|
||||
operator double() const
|
||||
{
|
||||
double res;
|
||||
const CString value = m_configManager.expand(m_settingValue);
|
||||
|
||||
OV_ERROR_UNLESS(m_typeManager.evaluateSettingValue(value, res),
|
||||
"Could not expand numeric expression [" << m_settingValue << "] to double.",
|
||||
Kernel::ErrorType::BadParsing, std::numeric_limits<double>::max(), m_errorManager, m_logManager);
|
||||
|
||||
return double(res);
|
||||
}
|
||||
|
||||
operator bool() const { return m_configManager.expandAsBoolean(m_settingValue); }
|
||||
|
||||
operator CString() const { return m_configManager.expand(m_settingValue); }
|
||||
|
||||
private:
|
||||
Kernel::ILogManager& m_logManager;
|
||||
Kernel::IErrorManager& m_errorManager;
|
||||
Kernel::ITypeManager& m_typeManager;
|
||||
Kernel::IConfigurationManager& m_configManager;
|
||||
CString m_settingValue;
|
||||
CIdentifier m_settingType = CIdentifier::undefined();
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
class CScopedBoxAlgorithm final
|
||||
{
|
||||
public:
|
||||
CScopedBoxAlgorithm(Kernel::IBoxAlgorithmContext*& ctxRef, Kernel::IBoxAlgorithmContext* ctx)
|
||||
: m_boxAlgorithmCtx(ctxRef) { m_boxAlgorithmCtx = ctx; }
|
||||
|
||||
~CScopedBoxAlgorithm() { m_boxAlgorithmCtx = nullptr; }
|
||||
|
||||
protected:
|
||||
Kernel::IBoxAlgorithmContext*& m_boxAlgorithmCtx;
|
||||
};
|
||||
|
||||
Kernel::IBoxAlgorithmContext* m_boxAlgorithmCtx = nullptr;
|
||||
};
|
||||
|
||||
template <class TBoxListenerParentClass>
|
||||
class TBoxListener : public TBoxListenerParentClass
|
||||
{
|
||||
public:
|
||||
|
||||
TBoxListener() { }
|
||||
|
||||
private:
|
||||
|
||||
virtual bool initialize(Kernel::IBoxListenerContext& ctx)
|
||||
{
|
||||
CScopedBoxListener scopedBoxListener(m_boxListenerCtx, &ctx);
|
||||
return initialize();
|
||||
}
|
||||
|
||||
virtual bool uninitialize(Kernel::IBoxListenerContext& ctx)
|
||||
{
|
||||
CScopedBoxListener scopedBoxListener(m_boxListenerCtx, &ctx);
|
||||
return uninitialize();
|
||||
}
|
||||
|
||||
virtual bool process(Kernel::IBoxListenerContext& ctx, const Kernel::EBoxModification eBoxModificationType)
|
||||
{
|
||||
CScopedBoxListener scopedBoxListener(m_boxListenerCtx, &ctx);
|
||||
switch (eBoxModificationType)
|
||||
{
|
||||
case Kernel::EBoxModification::Initialized: return this->onInitialized(m_boxListenerCtx->getBox());
|
||||
case Kernel::EBoxModification::DefaultInitialized: return this->onDefaultInitialized(m_boxListenerCtx->getBox());
|
||||
case Kernel::EBoxModification::NameChanged: return this->onNameChanged(m_boxListenerCtx->getBox());
|
||||
case Kernel::EBoxModification::IdentifierChanged: return this->onIdentifierChanged(m_boxListenerCtx->getBox());
|
||||
case Kernel::EBoxModification::AlgorithmClassIdentifierChanged: return this->onAlgorithmClassIdentifierChanged(m_boxListenerCtx->getBox());
|
||||
case Kernel::EBoxModification::InputConnected: return this->onInputConnected(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::InputDisconnected: return this->onInputDisconnected(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::InputAdded: return this->onInputAdded(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::InputRemoved: return this->onInputRemoved(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::InputTypeChanged: return this->onInputTypeChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::InputNameChanged: return this->onInputNameChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::OutputConnected: return this->onOutputConnected(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::OutputDisconnected: return this->onOutputDisconnected(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::OutputAdded: return this->onOutputAdded(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::OutputRemoved: return this->onOutputRemoved(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::OutputTypeChanged: return this->onOutputTypeChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::OutputNameChanged: return this->onOutputNameChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::SettingAdded: return this->onSettingAdded(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::SettingRemoved: return this->onSettingRemoved(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::SettingTypeChanged: return this->onSettingTypeChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::SettingNameChanged: return this->onSettingNameChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::SettingDefaultValueChanged: return this->onSettingDefaultValueChanged(
|
||||
m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
case Kernel::EBoxModification::SettingValueChanged: return this->onSettingValueChanged(m_boxListenerCtx->getBox(), m_boxListenerCtx->getIndex());
|
||||
default: OV_ERROR_KRF("Unhandled box modification type " << size_t(eBoxModificationType), Kernel::ErrorType::BadArgument);
|
||||
}
|
||||
//return false;
|
||||
}
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
public:
|
||||
|
||||
virtual bool initialize() { return true; }
|
||||
virtual bool uninitialize() { return true; }
|
||||
virtual bool onInitialized(Kernel::IBox& /*box*/) { return true; }
|
||||
virtual bool onDefaultInitialized(Kernel::IBox& /*box*/) { return true; }
|
||||
virtual bool onNameChanged(Kernel::IBox& /*box*/) { return true; }
|
||||
virtual bool onIdentifierChanged(Kernel::IBox& /*box*/) { return true; }
|
||||
virtual bool onAlgorithmClassIdentifierChanged(Kernel::IBox& /*box*/) { return true; }
|
||||
virtual bool onInputConnected(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onInputDisconnected(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onInputAdded(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onInputRemoved(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onInputTypeChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onInputNameChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onOutputConnected(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onOutputDisconnected(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onOutputAdded(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onOutputRemoved(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onOutputTypeChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onOutputNameChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onSettingAdded(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onSettingRemoved(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onSettingTypeChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onSettingNameChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onSettingDefaultValueChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
virtual bool onSettingValueChanged(Kernel::IBox& /*box*/, const size_t /*index*/) { return true; }
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
virtual Kernel::IAlgorithmManager& getAlgorithmManager() const { return m_boxListenerCtx->getAlgorithmManager(); }
|
||||
virtual Kernel::IPlayerManager& getPlayerManager() const { return m_boxListenerCtx->getPlayerManager(); }
|
||||
virtual Kernel::IPluginManager& getPluginManager() const { return m_boxListenerCtx->getPluginManager(); }
|
||||
virtual Kernel::IMetaboxManager& getMetaboxManager() const { return m_boxListenerCtx->getMetaboxManager(); }
|
||||
virtual Kernel::IScenarioManager& getScenarioManager() const { return m_boxListenerCtx->getScenarioManager(); }
|
||||
virtual Kernel::ITypeManager& getTypeManager() const { return m_boxListenerCtx->getTypeManager(); }
|
||||
virtual Kernel::ILogManager& getLogManager() const { return m_boxListenerCtx->getLogManager(); }
|
||||
virtual Kernel::IErrorManager& getErrorManager() const { return m_boxListenerCtx->getErrorManager(); }
|
||||
virtual Kernel::IConfigurationManager& getConfigurationManager() const { return m_boxListenerCtx->getConfigurationManager(); }
|
||||
|
||||
virtual Kernel::IScenario& getScenario() const { return m_boxListenerCtx->getScenario(); }
|
||||
|
||||
// ====================================================================================================================================
|
||||
|
||||
_IsDerivedFromClass_(TBoxListenerParentClass, OVTK_ClassId_)
|
||||
|
||||
private:
|
||||
|
||||
class CScopedBoxListener final
|
||||
{
|
||||
public:
|
||||
CScopedBoxListener(Kernel::IBoxListenerContext*& ctxRef, Kernel::IBoxListenerContext* ctx)
|
||||
: m_boxListenerCtx(ctxRef) { m_boxListenerCtx = ctx; }
|
||||
|
||||
~CScopedBoxListener() { m_boxListenerCtx = nullptr; }
|
||||
|
||||
protected:
|
||||
Kernel::IBoxListenerContext*& m_boxListenerCtx;
|
||||
};
|
||||
|
||||
Kernel::IBoxListenerContext* m_boxListenerCtx = nullptr;
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
#pragma once
|
||||
|
||||
#include <ebml/CReader.h>
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
|
||||
#include "../training/ovtkISignalTrial.h"
|
||||
#include "../training/ovtkISignalTrialSet.h"
|
||||
#include "ovtkTBoxAlgorithm.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
|
||||
template <class TBoxAlgorithmParentClass>
|
||||
class TTrainingBoxAlgorithm : public TBoxAlgorithm<TBoxAlgorithmParentClass>
|
||||
{
|
||||
public:
|
||||
|
||||
TTrainingBoxAlgorithm();
|
||||
virtual ~TTrainingBoxAlgorithm();
|
||||
|
||||
// Signal input reader callback
|
||||
virtual void setChannelCount(const size_t count) { m_pendingSignal->setChannelCount(count); }
|
||||
virtual void setChannelName(const size_t index, const char* name) { m_pendingSignal->setChannelName(index, name); }
|
||||
virtual void setSampleCountPerBuffer(const size_t count) { m_nSamplePerBuffer = count; }
|
||||
virtual void setSamplingRate(const size_t sampling) { m_pendingSignal->setSamplingRate(sampling); }
|
||||
virtual void setSampleBuffer(const double* buffer);
|
||||
|
||||
// Stimulation input reader callback
|
||||
virtual void setStimulationCount(size_t /*count*/) {}
|
||||
virtual void setStimulation(const size_t index, uint64_t identifier, uint64_t date);
|
||||
|
||||
// What should be implemented by the derived class
|
||||
virtual CIdentifier getStimulationIdentifierTrialStart() = 0;
|
||||
virtual CIdentifier getStimulationIdentifierTrialEnd() = 0;
|
||||
virtual CIdentifier getStimulationIdentifierTrialLabelRangeStart() = 0;
|
||||
virtual CIdentifier getStimulationIdentifierTrialLabelRangeEnd() = 0;
|
||||
virtual CIdentifier getStimulationIdentifierTrain() = 0;
|
||||
virtual bool train(ISignalTrialSet& trialSet) = 0;
|
||||
|
||||
_IsDerivedFromClass_(TBoxAlgorithm<TBoxAlgorithmParentClass>, OVTK_ClassId_)
|
||||
|
||||
private:
|
||||
|
||||
ISignalTrial* m_pendingSignal = nullptr;
|
||||
|
||||
uint64_t m_trialStartTime = 0;
|
||||
uint64_t m_trialEndTime = 0;
|
||||
size_t m_nSamplePerBuffer = 0;
|
||||
CIdentifier m_trialLabel = CIdentifier::undefined();
|
||||
|
||||
std::vector<ISignalTrial*> m_signalTrials;
|
||||
};
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
template <class TBoxAlgorithmParentClass>
|
||||
TTrainingBoxAlgorithm<TBoxAlgorithmParentClass>::TTrainingBoxAlgorithm() : m_trialStartTime(ULLONG_MAX), m_trialEndTime(ULLONG_MAX)
|
||||
{
|
||||
m_pendingSignal = createSignalTrial();
|
||||
}
|
||||
|
||||
template <class TBoxAlgorithmParentClass>
|
||||
TTrainingBoxAlgorithm<TBoxAlgorithmParentClass>::~TTrainingBoxAlgorithm()
|
||||
{
|
||||
releaseSignalTrial(m_pendingSignal);
|
||||
for (auto itSignalTrial = m_signalTrials.begin(); itSignalTrial != m_signalTrials.end(); ++itSignalTrial) { releaseSignalTrial(*itSignalTrial); }
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
// Signal input reader callback
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
template <class TBoxAlgorithmParentClass>
|
||||
void TTrainingBoxAlgorithm<TBoxAlgorithmParentClass>::setSampleBuffer(const double* buffer)
|
||||
{
|
||||
insertBufferSamples(*m_pendingSignal, m_pendingSignal->getSampleCount(), m_nSamplePerBuffer, buffer, m_pendingSignal);
|
||||
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Debug
|
||||
<< "Appended " << m_nSamplePerBuffer << " bytes resulting in " << (m_pendingSignal->getDuration() >> 32) << " seconds of signal\n";
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
// Stimulation input reader callback
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
template <class TBoxAlgorithmParentClass>
|
||||
void TTrainingBoxAlgorithm<TBoxAlgorithmParentClass>::setStimulation(const size_t /*index*/, const uint64_t identifier, const uint64_t date)
|
||||
{
|
||||
if (identifier == this->getStimulationIdentifierTrain())
|
||||
{
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager()
|
||||
<< Kernel::LogLevel_Trace
|
||||
<< "Constituting a signal trial set based on previous signal trials...\n";
|
||||
|
||||
ISignalTrialSet* signalTrialSet = createSignalTrialSet();
|
||||
for (auto it = m_signalTrials.begin(); it != m_signalTrials.end(); ++it) { signalTrialSet->addSignalTrial(**it); }
|
||||
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Info << "Calling train function...\n";
|
||||
|
||||
this->train(*signalTrialSet);
|
||||
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Trace
|
||||
<< "Training done... will clear signal trials and signal trial set now...\n";
|
||||
|
||||
for (auto it = m_signalTrials.begin(); it != m_signalTrials.end(); ++it) { releaseSignalTrial(*it); }
|
||||
releaseSignalTrialSet(signalTrialSet);
|
||||
m_signalTrials.clear();
|
||||
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Info << "Training phase finished !\n";
|
||||
}
|
||||
else if (identifier == this->getStimulationIdentifierTrialStart())
|
||||
{
|
||||
m_trialStartTime = date;
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Trace
|
||||
<< "Saved trial start time " << CTime(m_trialStartTime) << "...\n";
|
||||
}
|
||||
else if (identifier == this->getStimulationIdentifierTrialEnd())
|
||||
{
|
||||
m_trialEndTime = date;
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Trace
|
||||
<< "Saved trial end time " << CTime(m_trialEndTime) << "...\n";
|
||||
}
|
||||
else if (this->getStimulationIdentifierTrialLabelRangeStart() <= CIdentifier(identifier) && CIdentifier(identifier) <= this->
|
||||
getStimulationIdentifierTrialLabelRangeEnd())
|
||||
{
|
||||
m_trialLabel = identifier;
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Trace
|
||||
<< "Labeled trial " << m_trialLabel << "...\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Debug
|
||||
<< "Unhandled stimulation " << CIdentifier(identifier) << " at time " << CTime(date) << "\n";
|
||||
}
|
||||
|
||||
if (m_trialEndTime != ULLONG_MAX && m_trialStartTime != ULLONG_MAX && m_trialEndTime > m_trialStartTime)
|
||||
{
|
||||
size_t nSample = size_t(((m_trialEndTime - m_trialStartTime) * m_pendingSignal->getSamplingRate()) >> 32);
|
||||
|
||||
this->getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << Kernel::LogLevel_Trace
|
||||
<< "Created trial " << CTime(m_trialStartTime) << "-" << CTime(m_trialEndTime) << " with " << nSample << " samples\n";
|
||||
|
||||
ISignalTrial* signalTrial = createSignalTrial();
|
||||
copyHeader(*signalTrial, m_pendingSignal);
|
||||
selectTime(*signalTrial, m_trialStartTime, m_trialEndTime, m_pendingSignal);
|
||||
signalTrial->setLabelIdentifier(m_trialLabel);
|
||||
|
||||
m_signalTrials.push_back(signalTrial);
|
||||
|
||||
m_trialStartTime = ULLONG_MAX;
|
||||
m_trialEndTime = ULLONG_MAX;
|
||||
m_trialLabel = CIdentifier::undefined();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TAcquisitionDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> op_bufferDuration;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_experimentInfoStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_signalStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_stimulationStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_channelLocalisationStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_channelUnitsStream;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_AcquisitionDecoder));
|
||||
m_codec->initialize();
|
||||
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_AcquisitionDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
|
||||
op_bufferDuration.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_AcquisitionDecoder_OutputParameterId_BufferDuration));
|
||||
op_experimentInfoStream.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_AcquisitionDecoder_OutputParameterId_ExperimentInfoStream));
|
||||
op_signalStream.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_AcquisitionDecoder_OutputParameterId_SignalStream));
|
||||
op_stimulationStream.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_AcquisitionDecoder_OutputParameterId_StimulationStream));
|
||||
op_channelLocalisationStream.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelLocalisationStream));
|
||||
op_channelUnitsStream.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelUnitsStream));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
op_channelUnitsStream.uninitialize();
|
||||
op_channelLocalisationStream.uninitialize();
|
||||
op_stimulationStream.uninitialize();
|
||||
op_signalStream.uninitialize();
|
||||
op_experimentInfoStream.uninitialize();
|
||||
op_bufferDuration.uninitialize();
|
||||
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getBufferDuration() { return op_bufferDuration; }
|
||||
Kernel::TParameterHandler<IMemoryBuffer*>& getExperimentInfoStream() { return op_experimentInfoStream; }
|
||||
Kernel::TParameterHandler<IMemoryBuffer*>& getSignalStream() { return op_signalStream; }
|
||||
Kernel::TParameterHandler<IMemoryBuffer*>& getStimulationStream() { return op_stimulationStream; }
|
||||
Kernel::TParameterHandler<IMemoryBuffer*>& getChannelLocalisationStream() { return op_channelLocalisationStream; }
|
||||
Kernel::TParameterHandler<IMemoryBuffer*>& getChannelUnitsStream() { return op_channelUnitsStream; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_AcquisitionDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_AcquisitionDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_AcquisitionDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TAcquisitionDecoder : public TAcquisitionDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>
|
||||
{
|
||||
using TAcquisitionDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::m_boxAlgorithm;
|
||||
|
||||
public:
|
||||
using TAcquisitionDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::uninitialize;
|
||||
|
||||
TAcquisitionDecoder() { }
|
||||
|
||||
explicit TAcquisitionDecoder(T& boxAlgorithm)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm);
|
||||
}
|
||||
|
||||
virtual ~TAcquisitionDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TChannelLocalisationDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> m_oDynamic;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
using T::m_oMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_ChannelLocalisationDecoder));
|
||||
m_codec->initialize();
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ChannelLocalisationDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
m_oMatrix.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ChannelLocalisationDecoder_OutputParameterId_Matrix));
|
||||
m_oDynamic.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ChannelLocalisationDecoder_OutputParameterId_Dynamic));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_oDynamic.uninitialize();
|
||||
m_oMatrix.uninitialize();
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<bool>& getOutputDynamic() { return m_oDynamic; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ChannelLocalisationDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ChannelLocalisationDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ChannelLocalisationDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TChannelLocalisationDecoder : public TChannelLocalisationDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>
|
||||
{
|
||||
using TChannelLocalisationDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TChannelLocalisationDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::uninitialize;
|
||||
|
||||
TChannelLocalisationDecoder() { }
|
||||
|
||||
TChannelLocalisationDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TChannelLocalisationDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TChannelUnitsDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> m_oDynamic;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
using T::m_oMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_ChannelUnitsDecoder));
|
||||
m_codec->initialize();
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ChannelUnitsDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
m_oMatrix.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ChannelUnitsDecoder_OutputParameterId_Matrix));
|
||||
m_oDynamic.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ChannelUnitsDecoder_OutputParameterId_Dynamic));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_oDynamic.uninitialize();
|
||||
m_oMatrix.uninitialize();
|
||||
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<bool>& getOutputDynamic() { return m_oDynamic; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ChannelUnitsDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ChannelUnitsDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ChannelUnitsDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TChannelUnitsDecoder : public TChannelUnitsDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>
|
||||
{
|
||||
using TChannelUnitsDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TChannelUnitsDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::uninitialize;
|
||||
|
||||
TChannelUnitsDecoder() { }
|
||||
|
||||
TChannelUnitsDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TChannelUnitsDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "../ovtkTCodec.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<const IMemoryBuffer*> m_iBuffer;
|
||||
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_connectorIdx;
|
||||
|
||||
virtual void setInputChunk(const IMemoryBuffer* pInputChunkMemoryBuffer) { m_iBuffer = pInputChunkMemoryBuffer; }
|
||||
|
||||
virtual Kernel::TParameterHandler<const IMemoryBuffer*>& getInputMemoryBuffer() { return m_iBuffer; }
|
||||
|
||||
virtual bool isOutputTriggerActive(const CIdentifier oTrigger) { return m_codec->isOutputTriggerActive(oTrigger); }
|
||||
|
||||
virtual bool process(const CIdentifier& oTrigger) { return m_codec->process(oTrigger); }
|
||||
virtual bool process() { return m_codec->process(); }
|
||||
|
||||
public:
|
||||
// We make visible the initialize methods of the superclass (should be TCodec), in the same scope (public)
|
||||
using T::initialize;
|
||||
|
||||
/*
|
||||
This public function handles every aspects of the decoding process:
|
||||
- fill the input memory buffer with a chunk
|
||||
- decode it (specific for each decoder)
|
||||
- mark input as deprecated
|
||||
*/
|
||||
virtual bool decode(const size_t chunkIdx, const bool markInputAsDeprecated = true)
|
||||
{
|
||||
this->setInputChunk(m_boxAlgorithm->getDynamicBoxContext().getInputChunk(m_connectorIdx, chunkIdx));
|
||||
if (! m_codec->process()) return false;
|
||||
if (markInputAsDeprecated) m_boxAlgorithm->getDynamicBoxContext().markInputAsDeprecated(m_connectorIdx, chunkIdx);
|
||||
return true;
|
||||
}
|
||||
|
||||
// We explicitly delete the decode function taking two integers as parameters
|
||||
// in order to raise errors in plugins using the older API
|
||||
#ifndef TARGET_OS_MacOS // Current clang has a bug which fails to link these
|
||||
virtual bool decode(int, int) = delete;
|
||||
virtual bool decode(size_t, size_t) = delete;
|
||||
#endif
|
||||
|
||||
// The functions that need to be specified by the decoders (specific Trigger ID)
|
||||
virtual bool isHeaderReceived() = 0;
|
||||
virtual bool isBufferReceived() = 0;
|
||||
virtual bool isEndReceived() = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
This class provides an access to the superclass TDecoder.
|
||||
Use case : iterating over a vector of TDecoder, calling decode() each time.
|
||||
You don't need to know which type of decoder is in the vector.
|
||||
*/
|
||||
template <class T>
|
||||
class TDecoder : public TDecoderLocal<TCodec<T>>
|
||||
{
|
||||
public:
|
||||
virtual ~TDecoder() { }
|
||||
protected:
|
||||
// constructor is protected, ensuring we can't instanciate a TDecoder
|
||||
TDecoder() { }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TExperimentInfoDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_experimentID;
|
||||
Kernel::TParameterHandler<CString*> m_experimentDate;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_subjectID;
|
||||
Kernel::TParameterHandler<CString*> m_subjectName;
|
||||
Kernel::TParameterHandler<uint64_t> m_subjectAge;
|
||||
Kernel::TParameterHandler<uint64_t> m_subjectGender;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_laboratoryID;
|
||||
Kernel::TParameterHandler<CString*> m_laboratoryName;
|
||||
Kernel::TParameterHandler<uint64_t> m_technicianID;
|
||||
Kernel::TParameterHandler<CString*> m_technicianName;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_ExperimentInfoDecoder));
|
||||
m_codec->initialize();
|
||||
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
|
||||
m_experimentID.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentID));
|
||||
m_experimentDate.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentDate));
|
||||
|
||||
m_subjectID.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectID));
|
||||
m_subjectName.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectName));
|
||||
m_subjectAge.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectAge));
|
||||
m_subjectGender.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectGender));
|
||||
|
||||
m_laboratoryID.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryID));
|
||||
m_laboratoryName.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryName));
|
||||
m_technicianID.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianID));
|
||||
m_technicianName.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_experimentID.uninitialize();
|
||||
m_experimentDate.uninitialize();
|
||||
m_subjectID.uninitialize();
|
||||
m_subjectName.uninitialize();
|
||||
m_subjectAge.uninitialize();
|
||||
m_subjectGender.uninitialize();
|
||||
m_laboratoryID.uninitialize();
|
||||
m_laboratoryName.uninitialize();
|
||||
m_technicianID.uninitialize();
|
||||
m_technicianName.uninitialize();
|
||||
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputExperimentID() { return m_experimentID; }
|
||||
Kernel::TParameterHandler<CString*>& getOutputExperimentDate() { return m_experimentDate; }
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputSubjectID() { return m_subjectID; }
|
||||
Kernel::TParameterHandler<CString*>& getOutputSubjectName() { return m_subjectName; }
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputSubjectAge() { return m_subjectAge; }
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputSubjectGender() { return m_subjectGender; }
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputLaboratoryID() { return m_laboratoryID; }
|
||||
Kernel::TParameterHandler<CString*>& getOutputLaboratoryName() { return m_laboratoryName; }
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputTechnicianID() { return m_technicianID; }
|
||||
Kernel::TParameterHandler<CString*>& getOutputTechnicianName() { return m_technicianName; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_ExperimentInfoDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TExperimentInfoDecoder : public TExperimentInfoDecoderLocal<TDecoder<T>>
|
||||
{
|
||||
using TExperimentInfoDecoderLocal<TDecoder<T>>::m_boxAlgorithm;
|
||||
|
||||
public:
|
||||
using TExperimentInfoDecoderLocal<TDecoder<T>>::uninitialize;
|
||||
|
||||
TExperimentInfoDecoder() { }
|
||||
|
||||
TExperimentInfoDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TExperimentInfoDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TFeatureVectorDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
using T::m_oMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_FeatureVectorDecoder));
|
||||
m_codec->initialize();
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_FeatureVectorDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
m_oMatrix.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_FeatureVectorDecoder_OutputParameterId_Matrix));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
using T::uninitialize;
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_FeatureVectorDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_FeatureVectorDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_FeatureVectorDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TFeatureVectorDecoder : public TFeatureVectorDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>
|
||||
{
|
||||
using TFeatureVectorDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TFeatureVectorDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::uninitialize;
|
||||
|
||||
TFeatureVectorDecoder() { }
|
||||
|
||||
TFeatureVectorDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TFeatureVectorDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TSignalDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_sampling;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
using T::m_oMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_SignalDecoder));
|
||||
m_codec->initialize();
|
||||
m_sampling.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_SignalDecoder_OutputParameterId_Sampling));
|
||||
m_oMatrix.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_SignalDecoder_OutputParameterId_Matrix));
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SignalDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_sampling.uninitialize();
|
||||
m_oMatrix.uninitialize();
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputSamplingRate() { return m_sampling; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_SignalDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_SignalDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_SignalDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TSignalDecoder : public TSignalDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>
|
||||
{
|
||||
using TSignalDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TSignalDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::uninitialize;
|
||||
|
||||
TSignalDecoder() { }
|
||||
|
||||
TSignalDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TSignalDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TSpectrumDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> m_frequencyAbscissa;
|
||||
Kernel::TParameterHandler<uint64_t> m_sampling;
|
||||
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
using T::m_oMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_SpectrumDecoder));
|
||||
m_codec->initialize();
|
||||
m_oMatrix.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_SpectrumDecoder_OutputParameterId_Matrix));
|
||||
m_frequencyAbscissa.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_SpectrumDecoder_OutputParameterId_FrequencyAbscissa));
|
||||
m_sampling.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_SpectrumDecoder_OutputParameterId_Sampling));
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SpectrumDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_oMatrix.uninitialize();
|
||||
m_frequencyAbscissa.uninitialize();
|
||||
m_sampling.uninitialize();
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputSamplingRate() { return m_sampling; }
|
||||
Kernel::TParameterHandler<CMatrix*>& getOutputFrequencyAbscissa() { return m_frequencyAbscissa; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_SpectrumDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_SpectrumDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_SpectrumDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TSpectrumDecoder : public TSpectrumDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>
|
||||
{
|
||||
using TSpectrumDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TSpectrumDecoderLocal<TStreamedMatrixDecoderLocal<TDecoder<T>>>::uninitialize;
|
||||
|
||||
TSpectrumDecoder() { }
|
||||
|
||||
TSpectrumDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TSpectrumDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TStimulationDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*> m_oStimulationSet;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_StimulationDecoder));
|
||||
m_codec->initialize();
|
||||
m_oStimulationSet.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet));
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_StimulationDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_oStimulationSet.uninitialize();
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*>& getOutputStimulationSet() { return m_oStimulationSet; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StimulationDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TStimulationDecoder : public TStimulationDecoderLocal<TDecoder<T>>
|
||||
{
|
||||
using TStimulationDecoderLocal<TDecoder<T>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TStimulationDecoderLocal<TDecoder<T>>::uninitialize;
|
||||
|
||||
TStimulationDecoder() { }
|
||||
|
||||
TStimulationDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TStimulationDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TStreamStructureDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_StreamStructureDecoder));
|
||||
m_codec->initialize();
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_StreamStructureDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StreamStructureDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StreamStructureDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StreamStructureDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TStreamStructureDecoder : public TStreamStructureDecoderLocal<TDecoder<T>>
|
||||
{
|
||||
using TStreamStructureDecoderLocal<TDecoder<T>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TStreamStructureDecoderLocal<TDecoder<T>>::uninitialize;
|
||||
|
||||
TStreamStructureDecoder() { }
|
||||
|
||||
TStreamStructureDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TStreamStructureDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TStreamedMatrixDecoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> m_oMatrix;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_iBuffer;
|
||||
|
||||
virtual bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_StreamedMatrixDecoder));
|
||||
m_codec->initialize();
|
||||
m_iBuffer.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_StreamedMatrixDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
m_oMatrix.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_StreamedMatrixDecoder_OutputParameterId_Matrix));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
virtual bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_oMatrix.uninitialize();
|
||||
m_iBuffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual Kernel::TParameterHandler<CMatrix*>& getOutputMatrix() { return m_oMatrix; }
|
||||
|
||||
virtual bool isHeaderReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StreamedMatrixDecoder_OutputTriggerId_ReceivedHeader); }
|
||||
virtual bool isBufferReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StreamedMatrixDecoder_OutputTriggerId_ReceivedBuffer); }
|
||||
virtual bool isEndReceived() { return m_codec->isOutputTriggerActive(OVP_GD_Algorithm_StreamedMatrixDecoder_OutputTriggerId_ReceivedEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TStreamedMatrixDecoder : public TStreamedMatrixDecoderLocal<TDecoder<T>>
|
||||
{
|
||||
using TStreamedMatrixDecoderLocal<TDecoder<T>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TStreamedMatrixDecoderLocal<TDecoder<T>>::uninitialize;
|
||||
|
||||
TStreamedMatrixDecoder() { }
|
||||
|
||||
TStreamedMatrixDecoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TStreamedMatrixDecoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "ovtkTStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TChannelLocalisationEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> m_iDynamic;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
using T::m_iMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_ChannelLocalisationEncoder));
|
||||
m_codec->initialize();
|
||||
m_iMatrix.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ChannelLocalisationEncoder_InputParameterId_Matrix));
|
||||
m_iDynamic.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ChannelLocalisationEncoder_InputParameterId_Dynamic));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ChannelLocalisationEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iMatrix.uninitialize();
|
||||
m_iDynamic.uninitialize();
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<bool>& getInputDynamic() { return m_iDynamic; }
|
||||
|
||||
protected:
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_ChannelLocalisationEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_ChannelLocalisationEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_ChannelLocalisationEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TChannelLocalisationEncoder : public TChannelLocalisationEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>
|
||||
{
|
||||
using TChannelLocalisationEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TChannelLocalisationEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::uninitialize;
|
||||
|
||||
TChannelLocalisationEncoder() { }
|
||||
|
||||
TChannelLocalisationEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TChannelLocalisationEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "ovtkTStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TChannelUnitsEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> m_iDynamic;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
using T::m_iMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_ChannelUnitsEncoder));
|
||||
m_codec->initialize();
|
||||
m_iMatrix.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ChannelUnitsEncoder_InputParameterId_Matrix));
|
||||
m_iDynamic.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ChannelUnitsEncoder_InputParameterId_Dynamic));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ChannelUnitsEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iMatrix.uninitialize();
|
||||
m_iDynamic.uninitialize();
|
||||
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<bool>& getInputDynamic() { return m_iDynamic; }
|
||||
|
||||
protected:
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_ChannelUnitsEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_ChannelUnitsEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_ChannelUnitsEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TChannelUnitsEncoder : public TChannelUnitsEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>
|
||||
{
|
||||
using TChannelUnitsEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TChannelUnitsEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::uninitialize;
|
||||
|
||||
TChannelUnitsEncoder() { }
|
||||
|
||||
TChannelUnitsEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TChannelUnitsEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "../ovtkTCodec.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> m_buffer;
|
||||
|
||||
using T::initialize;
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_connectorIdx;
|
||||
|
||||
virtual void setOutputChunk(IMemoryBuffer* pOutputChunkMemoryBuffer) { m_buffer = pOutputChunkMemoryBuffer; }
|
||||
|
||||
virtual Kernel::TParameterHandler<IMemoryBuffer*>& getOutputMemoryBuffer() { return m_buffer; }
|
||||
|
||||
virtual bool isOutputTriggerActive(const CIdentifier oTrigger) { return m_codec->isOutputTriggerActive(oTrigger); }
|
||||
|
||||
virtual bool process(const CIdentifier& oTrigger) { return m_codec->process(oTrigger); }
|
||||
virtual bool process() { return m_codec->process(); }
|
||||
|
||||
// The functions that need to be specified by the encoders (specific Trigger ID)
|
||||
virtual bool encodeHeaderImpl() = 0;
|
||||
virtual bool encodeBufferImpl() = 0;
|
||||
virtual bool encodeEndImpl() = 0;
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
These public methods handle every aspect of the encoding process :
|
||||
- prepare the output memory buffer with a chunk
|
||||
- encode (specific for each encoder)
|
||||
- mark output as ready to be sent has to be done manually, for accurate timing.
|
||||
*/
|
||||
|
||||
bool encodeHeader()
|
||||
{
|
||||
this->setOutputChunk(m_boxAlgorithm->getDynamicBoxContext().getOutputChunk(m_connectorIdx));
|
||||
if (!this->encodeHeaderImpl()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool encodeBuffer()
|
||||
{
|
||||
this->setOutputChunk(m_boxAlgorithm->getDynamicBoxContext().getOutputChunk(m_connectorIdx));
|
||||
if (!this->encodeBufferImpl()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool encodeEnd()
|
||||
{
|
||||
this->setOutputChunk(m_boxAlgorithm->getDynamicBoxContext().getOutputChunk(m_connectorIdx));
|
||||
if (!this->encodeEndImpl()) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
This class provides an access to the superclass TEncoder.
|
||||
Use case : iterating over a vector of TEncoder, calling encodeHeader() each time.
|
||||
You don't need to know which type of encoder is in the vector.
|
||||
*/
|
||||
template <class T>
|
||||
class TEncoder : public TEncoderLocal<TCodec<T>>
|
||||
{
|
||||
public:
|
||||
virtual ~TEncoder() { }
|
||||
protected:
|
||||
// constructor is protected, ensuring we can't instanciate a TEncoder
|
||||
TEncoder() { }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TExperimentInfoEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_experimentID;
|
||||
Kernel::TParameterHandler<CString*> m_experimentDate;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_subjectID;
|
||||
Kernel::TParameterHandler<CString*> m_subjectName;
|
||||
Kernel::TParameterHandler<uint64_t> m_subjectAge;
|
||||
Kernel::TParameterHandler<uint64_t> m_subjectGender;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> m_laboratoryID;
|
||||
Kernel::TParameterHandler<CString*> m_laboratoryName;
|
||||
Kernel::TParameterHandler<uint64_t> m_technicianID;
|
||||
Kernel::TParameterHandler<CString*> m_technicianName;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_ExperimentInfoEncoder));
|
||||
m_codec->initialize();
|
||||
m_experimentID.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentID));
|
||||
m_experimentDate.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentDate));
|
||||
|
||||
m_subjectID.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectID));
|
||||
m_subjectName.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectName));
|
||||
m_subjectAge.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectAge));
|
||||
m_subjectGender.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectGender));
|
||||
|
||||
m_laboratoryID.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryID));
|
||||
m_laboratoryName.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryName));
|
||||
m_technicianID.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianID));
|
||||
m_technicianName.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianName));
|
||||
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_ExperimentInfoEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_experimentID.uninitialize();
|
||||
m_experimentDate.uninitialize();
|
||||
m_subjectID.uninitialize();
|
||||
m_subjectName.uninitialize();
|
||||
m_subjectAge.uninitialize();
|
||||
m_subjectGender.uninitialize();
|
||||
m_laboratoryID.uninitialize();
|
||||
m_laboratoryName.uninitialize();
|
||||
m_technicianID.uninitialize();
|
||||
m_technicianName.uninitialize();
|
||||
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getInputExperimentID() { return m_experimentID; }
|
||||
Kernel::TParameterHandler<CString*>& getInputExperimentDate() { return m_experimentDate; }
|
||||
Kernel::TParameterHandler<uint64_t>& getInputSubjectID() { return m_subjectID; }
|
||||
Kernel::TParameterHandler<CString*>& getInputSubjectName() { return m_subjectName; }
|
||||
Kernel::TParameterHandler<uint64_t>& getInputSubjectAge() { return m_subjectAge; }
|
||||
Kernel::TParameterHandler<uint64_t>& getInputSubjectGender() { return m_subjectGender; }
|
||||
Kernel::TParameterHandler<uint64_t>& getInputLaboratoryID() { return m_laboratoryID; }
|
||||
Kernel::TParameterHandler<CString*>& getInputLaboratoryName() { return m_laboratoryName; }
|
||||
Kernel::TParameterHandler<uint64_t>& getInputTechnicianID() { return m_technicianID; }
|
||||
Kernel::TParameterHandler<CString*>& getInputTechnicianName() { return m_technicianName; }
|
||||
|
||||
protected:
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_ExperimentInfoEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_ExperimentInfoEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_ExperimentInfoEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TExperimentInfoEncoder : public TExperimentInfoEncoderLocal<TEncoder<T>>
|
||||
{
|
||||
using TExperimentInfoEncoderLocal<TEncoder<T>>::m_boxAlgorithm;
|
||||
|
||||
public:
|
||||
using TExperimentInfoEncoderLocal<TEncoder<T>>::uninitialize;
|
||||
|
||||
TExperimentInfoEncoder() { }
|
||||
|
||||
TExperimentInfoEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TExperimentInfoEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TFeatureVectorEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
// the feature vector stream is just a streamed matrix with some constraint (dimension = 2).
|
||||
// no specific parameter.
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
using T::m_iMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_FeatureVectorEncoder));
|
||||
m_codec->initialize();
|
||||
m_iMatrix.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_FeatureVectorEncoder_InputParameterId_Matrix));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_FeatureVectorEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_FeatureVectorEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_FeatureVectorEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_FeatureVectorEncoder_InputTriggerId_EncodeEnd); }
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
using T::uninitialize;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TFeatureVectorEncoder : public TFeatureVectorEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>
|
||||
{
|
||||
using TFeatureVectorEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TFeatureVectorEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::uninitialize;
|
||||
|
||||
TFeatureVectorEncoder() { }
|
||||
|
||||
TFeatureVectorEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TFeatureVectorEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TSignalEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
//The signal stream is a streamed matrix plus a sampling rate
|
||||
Kernel::TParameterHandler<uint64_t> m_iSampling;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
using T::m_iMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_SignalEncoder));
|
||||
m_codec->initialize();
|
||||
m_iMatrix.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SignalEncoder_InputParameterId_Matrix));
|
||||
m_iSampling.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SignalEncoder_InputParameterId_Sampling));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_StreamedMatrixEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
//again... we propagate initialize from upperclass.
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iMatrix.uninitialize();
|
||||
m_iSampling.uninitialize();
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getInputSamplingRate() { return m_iSampling; }
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
The methods specific to the Signal encoder (overriding the TStreamedMatrixEncoderLocal implementations):
|
||||
*/
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_SignalEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_SignalEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_SignalEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
/*
|
||||
The Signal encoder can be instanciated easily through this class.
|
||||
You just need one template class : the box (T).
|
||||
*/
|
||||
template <class T>
|
||||
class TSignalEncoder : public TSignalEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>
|
||||
{
|
||||
using TSignalEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TSignalEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::uninitialize;
|
||||
|
||||
TSignalEncoder() { }
|
||||
|
||||
TSignalEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TSignalEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
#include "ovtkTStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TSpectrumEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> m_iFrequencyAbscissa;
|
||||
Kernel::TParameterHandler<uint64_t> m_iSampling;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
using T::m_iMatrix;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_SpectrumEncoder));
|
||||
m_codec->initialize();
|
||||
m_iMatrix.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SpectrumEncoder_InputParameterId_Matrix));
|
||||
m_iFrequencyAbscissa.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SpectrumEncoder_InputParameterId_FrequencyAbscissa));
|
||||
m_iSampling.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_SpectrumEncoder_InputParameterId_Sampling));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_SpectrumEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iMatrix.uninitialize();
|
||||
m_iFrequencyAbscissa.uninitialize();
|
||||
m_iSampling.uninitialize();
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getInputSamplingRate() { return m_iSampling; }
|
||||
Kernel::TParameterHandler<CMatrix*>& getInputFrequencyAbscissa() { return m_iFrequencyAbscissa; }
|
||||
|
||||
size_t getInputFrequencyAbscissaCount() { return m_iFrequencyAbscissa->getDimensionSize(0); }
|
||||
|
||||
|
||||
protected:
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_SpectrumEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_SpectrumEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_SpectrumEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TSpectrumEncoder : public TSpectrumEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>
|
||||
{
|
||||
using TSpectrumEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TSpectrumEncoderLocal<TStreamedMatrixEncoderLocal<TEncoder<T>>>::uninitialize;
|
||||
|
||||
TSpectrumEncoder() { }
|
||||
|
||||
TSpectrumEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TSpectrumEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TStimulationEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*> m_iStimulationSet;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_StimulationEncoder));
|
||||
m_codec->initialize();
|
||||
m_iStimulationSet.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_StimulationEncoder_InputParameterId_StimulationSet));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_StimulationEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iStimulationSet.uninitialize();
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*>& getInputStimulationSet() { return m_iStimulationSet; }
|
||||
|
||||
protected:
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_StimulationEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_StimulationEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_StimulationEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TStimulationEncoder : public TStimulationEncoderLocal<TEncoder<T>>
|
||||
{
|
||||
using TStimulationEncoderLocal<TEncoder<T>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TStimulationEncoderLocal<TEncoder<T>>::uninitialize;
|
||||
|
||||
TStimulationEncoder() { }
|
||||
|
||||
TStimulationEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TStimulationEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../../ovtk_base.h"
|
||||
|
||||
#include "ovtkTEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TStreamedMatrixEncoderLocal : public T
|
||||
{
|
||||
protected:
|
||||
//specific attribute : a matrix handler
|
||||
Kernel::TParameterHandler<CMatrix*> m_iMatrix;
|
||||
|
||||
using T::m_codec;
|
||||
using T::m_boxAlgorithm;
|
||||
using T::m_buffer;
|
||||
|
||||
bool initializeImpl()
|
||||
{
|
||||
m_codec = &m_boxAlgorithm->getAlgorithmManager().getAlgorithm(
|
||||
m_boxAlgorithm->getAlgorithmManager().createAlgorithm(OVP_GD_ClassId_Algorithm_StreamedMatrixEncoder));
|
||||
m_codec->initialize();
|
||||
m_iMatrix.initialize(m_codec->getInputParameter(OVP_GD_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix));
|
||||
m_buffer.initialize(m_codec->getOutputParameter(OVP_GD_Algorithm_StreamedMatrixEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
// we propagate the visiblity of TCodec::initialize
|
||||
using T::initialize;
|
||||
|
||||
bool uninitialize()
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr || m_codec == nullptr) { return false; }
|
||||
|
||||
m_iMatrix.uninitialize();
|
||||
m_buffer.uninitialize();
|
||||
m_codec->uninitialize();
|
||||
m_boxAlgorithm->getAlgorithmManager().releaseAlgorithm(*m_codec);
|
||||
m_boxAlgorithm = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*>& getInputMatrix() { return m_iMatrix; }
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
The methods specific to the Streamed Matrix encoder :
|
||||
*/
|
||||
bool encodeHeaderImpl() { return m_codec->process(OVP_GD_Algorithm_StreamedMatrixEncoder_InputTriggerId_EncodeHeader); }
|
||||
bool encodeBufferImpl() { return m_codec->process(OVP_GD_Algorithm_StreamedMatrixEncoder_InputTriggerId_EncodeBuffer); }
|
||||
bool encodeEndImpl() { return m_codec->process(OVP_GD_Algorithm_StreamedMatrixEncoder_InputTriggerId_EncodeEnd); }
|
||||
};
|
||||
|
||||
/*
|
||||
This class provides an access to the Local class.
|
||||
It makes a lot easier the declaration of a Streamed Matrix encoder, as you don't have to specify any more template than the Box class (T).
|
||||
*/
|
||||
template <class T>
|
||||
class TStreamedMatrixEncoder : public TStreamedMatrixEncoderLocal<TEncoder<T>>
|
||||
{
|
||||
using TStreamedMatrixEncoderLocal<TEncoder<T>>::m_boxAlgorithm;
|
||||
public:
|
||||
using TStreamedMatrixEncoderLocal<TEncoder<T>>::uninitialize;
|
||||
|
||||
TStreamedMatrixEncoder() { }
|
||||
|
||||
TStreamedMatrixEncoder(T& boxAlgorithm, size_t index)
|
||||
{
|
||||
m_boxAlgorithm = NULL;
|
||||
this->initialize(boxAlgorithm, index);
|
||||
}
|
||||
|
||||
virtual ~TStreamedMatrixEncoder() { this->uninitialize(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
@@ -0,0 +1,107 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
/*
|
||||
Few words about the Codec Toolkit:
|
||||
----------------------------------
|
||||
The Codec Toolkit gives a simple and easy way to use the Encoders and Decoders, which are the most frequently used algorithms when developing a plugin.
|
||||
The Toolkit makes wide use of Templates, in a way that may seem complex for a reviewer. Complexity is not in the number of line of code, but in the architecture.
|
||||
The comments will try to help, and you may find relevant information on the dedicated tutorial and online doc:
|
||||
- http://openvibe.inria.fr/documentation/unstable/Doc_Tutorial_Developer_SignalProcessing_CodecToolkit.html
|
||||
- http://openvibe.inria.fr/documentation/unstable/Doc_Tutorial_Developer_SignalProcessing_CodecToolkit_Ref.html
|
||||
|
||||
Contact :
|
||||
---------
|
||||
Laurent Bonnet, INRIA Rennes.
|
||||
www.openvibe.inria.fr/forum
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
The Template inheritance:
|
||||
-------------------------
|
||||
|
||||
The Codec Toolkit uses template inheritance. This means that every class in templated by its superclass, starting with the most basic class : TCodec.
|
||||
This architecture allows the Toolkit developer to enhance it anywhere in the inheritance diagram.
|
||||
Here is the inheritance architecture hidden behind the templates :
|
||||
|
||||
Level 0 : TCodec
|
||||
> Purely Abstract
|
||||
> Contains the box pointer and the codec algorithm
|
||||
> Implements the public initialize(T&) function
|
||||
|
||||
Level 1 : TEncoderLocal TDecoderLocal
|
||||
> Partial implementation
|
||||
> Contains the input or output memory buffer, and high level public functions (to decode and encode)
|
||||
> This level is accessible but not instanciable, through the TEncoder and TDecoder subclasses.
|
||||
|
||||
Level 2 : T_XXX_DecoderLocal T_XXX_EncoderLocal
|
||||
> Implementation Level, for each stream type (except Streamed Matrix subtypes)
|
||||
> These local classes contains
|
||||
> - The specific parameter handlers (e.g. a matrix for the Streamed Matrix codecs)
|
||||
> - the specific implementations of each functions (init, uninit, isXXXreceived, encodeXXX)
|
||||
> They are instanciable through their non-local subclasses (e.g. TStreamedMatrixDecoder)
|
||||
|
||||
Level 3 : T_StreamedMatrixSubType_DecoderLocal T_StreamedMatrixSubType_EncoderLocal
|
||||
> Implementation level of the Streamed Matrix subtypes (Feature Vector, Spectrum, Signal)
|
||||
> They are instanciable through their non-local subclasses (e.g. TFeatureVectorDecoder)
|
||||
|
||||
Please look at TDecoder, TEncoder, TStreamedMatrixEncoder and TSignalEncoder classes for more details.
|
||||
The Codec Toolkit reference page may also be useful.
|
||||
|
||||
GL&HF
|
||||
*/
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class T>
|
||||
class TCodec
|
||||
{
|
||||
protected:
|
||||
|
||||
// We will need the dynamic box context when trying to decode and encode, thus we keep a pointer on the underlying box.
|
||||
T* m_boxAlgorithm = nullptr;
|
||||
|
||||
// Every codec has an algorithm
|
||||
Kernel::IAlgorithmProxy* m_codec = nullptr;
|
||||
size_t m_connectorIdx = 0;//one codec per connector
|
||||
|
||||
public:
|
||||
TCodec() : m_boxAlgorithm(nullptr) { }
|
||||
virtual ~TCodec() { }
|
||||
|
||||
//The initialization need a reference to the underlying box
|
||||
//it will certainly be called in the box in such manner : m_codec.initialize(*this);
|
||||
bool initialize(T& boxAlgorithm, const size_t connectorIdx)
|
||||
{
|
||||
if (m_boxAlgorithm == nullptr)
|
||||
{
|
||||
m_boxAlgorithm = &boxAlgorithm;
|
||||
m_connectorIdx = connectorIdx; //TODO : can we check the box static context and verify the requested connector exist?
|
||||
}
|
||||
else { return false; }
|
||||
// we call the initialization process specific to each codec
|
||||
return initializeImpl();
|
||||
}
|
||||
|
||||
// As we need to properly uninit parameter handlers before anything else, we can't design a common uninit behavior
|
||||
virtual bool uninitialize() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
// Note that this method is NOT public.
|
||||
virtual bool initializeImpl() = 0;
|
||||
|
||||
// for easier access to algorithm functionnality, we redefine some functions:
|
||||
virtual bool isOutputTriggerActive(const CIdentifier trigger) { return m_codec->isOutputTriggerActive(trigger); }
|
||||
|
||||
virtual bool process(const CIdentifier& trigger) { return m_codec->process(trigger); }
|
||||
virtual bool process() { return m_codec->process(); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
@@ -0,0 +1,318 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE SDK
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <openvibe/ov_all.h>
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
#include "decoders/ovtkTStreamedMatrixDecoder.h"
|
||||
#include "decoders/ovtkTSignalDecoder.h"
|
||||
#include "decoders/ovtkTSpectrumDecoder.h"
|
||||
#include "decoders/ovtkTFeatureVectorDecoder.h"
|
||||
|
||||
#include "encoders/ovtkTStreamedMatrixEncoder.h"
|
||||
#include "encoders/ovtkTSignalEncoder.h"
|
||||
#include "encoders/ovtkTSpectrumEncoder.h"
|
||||
#include "encoders/ovtkTFeatureVectorEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
|
||||
// ______________________________________________________________________________________________________________________________________________________________________________
|
||||
// ______________________________________________________________________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
#define decoder_return_impl(what) \
|
||||
if(m_signalDecoder) { return m_signalDecoder->what; } \
|
||||
if(m_spectrumDecoder) { return m_spectrumDecoder->what; } \
|
||||
if(m_featureVectorDecoder) { return m_featureVectorDecoder->what; } \
|
||||
return m_streamedMatrixDecoder->what;
|
||||
|
||||
template <class T>
|
||||
class TGenericDecoder
|
||||
{
|
||||
protected:
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_streamedMatrixDecoder = nullptr;
|
||||
m_signalDecoder = nullptr;
|
||||
m_spectrumDecoder = nullptr;
|
||||
m_featureVectorDecoder = nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
TGenericDecoder() : m_streamedMatrixDecoder(nullptr), m_signalDecoder(nullptr), m_spectrumDecoder(nullptr), m_featureVectorDecoder(nullptr)
|
||||
{
|
||||
this->reset();
|
||||
}
|
||||
|
||||
~TGenericDecoder() { this->uninitialize(); }
|
||||
|
||||
TGenericDecoder<T>& operator=(TStreamedMatrixDecoder<T>* decoder)
|
||||
{
|
||||
this->reset();
|
||||
m_streamedMatrixDecoder = decoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TGenericDecoder<T>& operator=(TSignalDecoder<T>* decoder)
|
||||
{
|
||||
this->reset();
|
||||
m_signalDecoder = decoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TGenericDecoder<T>& operator=(TSpectrumDecoder<T>* decoder)
|
||||
{
|
||||
this->reset();
|
||||
m_spectrumDecoder = decoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TGenericDecoder<T>& operator=(TFeatureVectorDecoder<T>* decoder)
|
||||
{
|
||||
this->reset();
|
||||
m_featureVectorDecoder = decoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void uninitialize() { this->reset(); }
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*>& getOutputMatrix()
|
||||
{
|
||||
decoder_return_impl(getOutputMatrix());
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getOutputSamplingRate()
|
||||
{
|
||||
if (m_signalDecoder) { return m_signalDecoder->getOutputSamplingRate(); }
|
||||
return m_spectrumDecoder->getOutputSamplingRate();
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*>& getOutputFrequencyAbcissa() { return m_spectrumDecoder->getOutputFrequencyAbscissa(); }
|
||||
|
||||
bool decode(int, int) = delete;
|
||||
bool decode(size_t, size_t) = delete;
|
||||
|
||||
bool decode(const size_t chunkIdx, bool bMarkInputAsDeprecated = true)
|
||||
{
|
||||
decoder_return_impl(decode(chunkIdx, bMarkInputAsDeprecated));
|
||||
}
|
||||
|
||||
bool isHeaderReceived()
|
||||
{
|
||||
decoder_return_impl(isHeaderReceived());
|
||||
}
|
||||
|
||||
bool isBufferReceived()
|
||||
{
|
||||
decoder_return_impl(isBufferReceived());
|
||||
}
|
||||
|
||||
bool isEndReceived()
|
||||
{
|
||||
decoder_return_impl(isEndReceived());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
TStreamedMatrixDecoder<T>* m_streamedMatrixDecoder = nullptr;
|
||||
TSignalDecoder<T>* m_signalDecoder = nullptr;
|
||||
TSpectrumDecoder<T>* m_spectrumDecoder = nullptr;
|
||||
TFeatureVectorDecoder<T>* m_featureVectorDecoder = nullptr;
|
||||
};
|
||||
|
||||
// ______________________________________________________________________________________________________________________________________________________________________________
|
||||
// ______________________________________________________________________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
#define encoder_return_impl(what) \
|
||||
if(m_signalEncoder) { return m_signalEncoder->what; } \
|
||||
if(m_spectrumEncoder) { return m_spectrumEncoder->what; } \
|
||||
if(m_featureVectorEncoder) { return m_featureVectorEncoder->what; } \
|
||||
return m_streamedMatrixDecoder->what;
|
||||
|
||||
template <class T>
|
||||
class TGenericEncoder
|
||||
{
|
||||
protected:
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_streamedMatrixDecoder = nullptr;
|
||||
m_signalEncoder = nullptr;
|
||||
m_spectrumEncoder = nullptr;
|
||||
m_featureVectorEncoder = nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
TGenericEncoder() : m_streamedMatrixDecoder(nullptr), m_signalEncoder(nullptr), m_spectrumEncoder(nullptr), m_featureVectorEncoder(nullptr)
|
||||
{
|
||||
this->reset();
|
||||
}
|
||||
|
||||
~TGenericEncoder() { this->uninitialize(); }
|
||||
|
||||
TGenericEncoder<T>& operator=(TStreamedMatrixEncoder<T>* pEncoder)
|
||||
{
|
||||
this->reset();
|
||||
m_streamedMatrixDecoder = pEncoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TGenericEncoder<T>& operator=(TSignalEncoder<T>* pEncoder)
|
||||
{
|
||||
this->reset();
|
||||
m_signalEncoder = pEncoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TGenericEncoder<T>& operator=(TSpectrumEncoder<T>* pEncoder)
|
||||
{
|
||||
this->reset();
|
||||
m_spectrumEncoder = pEncoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TGenericEncoder<T>& operator=(TFeatureVectorEncoder<T>* pEncoder)
|
||||
{
|
||||
this->reset();
|
||||
m_featureVectorEncoder = pEncoder;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void uninitialize() { this->reset(); }
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*>& getInputMatrix()
|
||||
{
|
||||
encoder_return_impl(getInputMatrix());
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<uint64_t>& getInputSamplingRate()
|
||||
{
|
||||
if (m_signalEncoder) { return m_signalEncoder->getInputSamplingRate(); }
|
||||
return m_spectrumEncoder->getInputSamplingRate();
|
||||
}
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*>& getInputFrequencyAbcissa() { return m_spectrumEncoder->getInputFrequencyAbscissa(); }
|
||||
|
||||
bool encodeHeader()
|
||||
{
|
||||
encoder_return_impl(encodeHeader());
|
||||
}
|
||||
|
||||
bool encodeBuffer()
|
||||
{
|
||||
encoder_return_impl(encodeBuffer());
|
||||
}
|
||||
|
||||
bool encodeEnd()
|
||||
{
|
||||
encoder_return_impl(encodeEnd());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
TStreamedMatrixEncoder<T>* m_streamedMatrixDecoder = nullptr;
|
||||
TSignalEncoder<T>* m_signalEncoder = nullptr;
|
||||
TSpectrumEncoder<T>* m_spectrumEncoder = nullptr;
|
||||
TFeatureVectorEncoder<T>* m_featureVectorEncoder = nullptr;
|
||||
};
|
||||
|
||||
// ______________________________________________________________________________________________________________________________________________________________________________
|
||||
// ______________________________________________________________________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
template <class T>
|
||||
class TGenericListener final : public T
|
||||
{
|
||||
public:
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Type_None = 0x00000000,
|
||||
Type_StreamedMatrix = 0x00000001,
|
||||
Type_Signal = 0x00000002,
|
||||
Type_Spectrum = 0x00000004,
|
||||
Type_Covariance = 0x00000008,
|
||||
Type_All = 0xffffffff
|
||||
} EType;
|
||||
|
||||
explicit TGenericListener(const size_t typeFlag = Type_All)
|
||||
{
|
||||
if (typeFlag & Type_StreamedMatrix) m_allowedTypeIDs[OV_TypeId_StreamedMatrix] = true;
|
||||
if (typeFlag & Type_Signal) m_allowedTypeIDs[OV_TypeId_Signal] = true;
|
||||
if (typeFlag & Type_Spectrum) m_allowedTypeIDs[OV_TypeId_Spectrum] = true;
|
||||
if (typeFlag & Type_Covariance) m_allowedTypeIDs[OV_TypeId_CovarianceMatrix] = true;
|
||||
}
|
||||
|
||||
bool isValidInputType(const CIdentifier& typeID, size_t /*index*/)
|
||||
{
|
||||
return m_allowedTypeIDs[typeID];
|
||||
//return (typeID==OV_TypeId_Signal || typeID==OV_TypeId_Spectrum);
|
||||
}
|
||||
|
||||
virtual bool onInputTypeChanged(Kernel::IBox& box, const size_t index)
|
||||
{
|
||||
CIdentifier typeID = CIdentifier::undefined();
|
||||
box.getInputType(index, typeID);
|
||||
if (this->isValidInputType(typeID, index)) { box.setOutputType(index, typeID); }
|
||||
else
|
||||
{
|
||||
box.getOutputType(index, typeID);
|
||||
box.setInputType(index, typeID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isValidOutputType(const CIdentifier& typeID, size_t /*index*/)
|
||||
{
|
||||
return m_allowedTypeIDs[typeID];
|
||||
//return (typeID==OV_TypeId_Signal || typeID==OV_TypeId_Spectrum);
|
||||
}
|
||||
|
||||
virtual bool onOutputTypeChanged(Kernel::IBox& box, const size_t index)
|
||||
{
|
||||
CIdentifier typeID = CIdentifier::undefined();
|
||||
box.getOutputType(index, typeID);
|
||||
if (this->isValidOutputType(typeID, index)) { box.setInputType(index, typeID); }
|
||||
else
|
||||
{
|
||||
box.getInputType(index, typeID);
|
||||
box.setOutputType(index, typeID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(T, CIdentifier::undefined())
|
||||
|
||||
private:
|
||||
|
||||
std::map<CIdentifier, bool> m_allowedTypeIDs;
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "ovtkIVector.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API IFeatureVector : public IVector
|
||||
{
|
||||
public:
|
||||
|
||||
virtual double getLabel() const = 0;
|
||||
virtual bool setLabel(const double label) = 0;
|
||||
|
||||
_IsDerivedFromClass_(IVector, OVTK_ClassId_FeatureVector)
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class IFeatureVector;
|
||||
|
||||
class OVTK_API IFeatureVectorSet : public IObject
|
||||
{
|
||||
public:
|
||||
|
||||
virtual size_t getFeatureVectorCount() const = 0;
|
||||
virtual bool setFeatureVectorCount(const size_t featureVector) = 0;
|
||||
virtual bool addFeatureVector(const IFeatureVector& featureVector) = 0;
|
||||
|
||||
virtual IFeatureVector& getFeatureVector(const size_t index) = 0;
|
||||
virtual const IFeatureVector& getFeatureVector(const size_t index) const = 0;
|
||||
virtual size_t getLabelCount() const = 0;
|
||||
|
||||
_IsDerivedFromClass_(IObject, OVTK_ClassId_FeatureVectorSet)
|
||||
|
||||
const IFeatureVector& operator [](const size_t index) const { return this->getFeatureVector(index); }
|
||||
|
||||
IFeatureVector& operator [](const size_t index) { return this->getFeatureVector(index); }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API IVector : public IObject
|
||||
{
|
||||
public:
|
||||
|
||||
virtual uint32_t getSize() const = 0;
|
||||
virtual bool setSize(const uint32_t size) = 0;
|
||||
virtual double* getBuffer() = 0;
|
||||
virtual const double* getBuffer() const = 0;
|
||||
virtual const char* getElementLabel(const uint32_t index) const = 0;
|
||||
virtual bool setElementLabel(const uint32_t index, const char* sElementLabel) = 0;
|
||||
|
||||
_IsDerivedFromClass_(IObject, OVTK_ClassId_Vector)
|
||||
|
||||
const double& operator [](const uint32_t index) const { return this->getBuffer()[index]; }
|
||||
double& operator [](const uint32_t index) { return this->getBuffer()[index]; }
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
#include "ovp_global_defines.h"
|
||||
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
|
||||
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
// Basic includes //
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
|
||||
#include "ovtk_defines.h"
|
||||
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
// Tools //
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
|
||||
#include "tools/ovtkMatrix.h"
|
||||
#include "tools/ovtkStimulationSet.h"
|
||||
#include "tools/ovtkString.h"
|
||||
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
// Codecs //
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
|
||||
#include "codecs/ovtkTCodec.h"
|
||||
#include "codecs/ovtkTGenericCodec.h"
|
||||
#include "codecs/encoders/ovtkTEncoder.h"
|
||||
#include "codecs/decoders/ovtkTDecoder.h"
|
||||
|
||||
#include "codecs/decoders/ovtkTAcquisitionDecoder.h"
|
||||
|
||||
#include "codecs/decoders/ovtkTStreamStructureDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTStimulationStreamEncoder.h"
|
||||
#include "codecs/decoders/ovtkTStimulationStreamDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTStreamedMatrixEncoder.h"
|
||||
#include "codecs/decoders/ovtkTStreamedMatrixDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTSignalEncoder.h"
|
||||
#include "codecs/decoders/ovtkTSignalDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTChannelLocalisationEncoder.h"
|
||||
#include "codecs/decoders/ovtkTChannelLocalisationDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTChannelUnitsEncoder.h"
|
||||
#include "codecs/decoders/ovtkTChannelUnitsDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTExperimentInfoEncoder.h"
|
||||
#include "codecs/decoders/ovtkTExperimentInfoDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTFeatureVectorEncoder.h"
|
||||
#include "codecs/decoders/ovtkTFeatureVectorDecoder.h"
|
||||
|
||||
#include "codecs/encoders/ovtkTSpectrumEncoder.h"
|
||||
#include "codecs/decoders/ovtkTSpectrumDecoder.h"
|
||||
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
// //
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
|
||||
#include "ovtkIVector.h"
|
||||
#include "ovtkIFeatureVector.h"
|
||||
#include "ovtkIFeatureVectorSet.h"
|
||||
|
||||
#include "box-algorithms/ovtkTBoxAlgorithm.h"
|
||||
|
||||
#include "algorithms/ovtkTAlgorithm.h"
|
||||
#include "algorithms/classification/ovtkCAlgorithmClassifier.h"
|
||||
#include "algorithms/classification/ovtkCAlgorithmPairingStrategy.h"
|
||||
|
||||
#include "algorithms/scenario-io/ovtkCAlgorithmScenarioImporter.h"
|
||||
#include "algorithms/scenario-io/ovtkCAlgorithmScenarioExporter.h"
|
||||
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
// //
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
OVTK_API bool initialize(const Kernel::IKernelContext& ctx);
|
||||
OVTK_API bool uninitialize(const Kernel::IKernelContext& ctx);
|
||||
|
||||
bool initializeStimulationList(const Kernel::IKernelContext& ctx);
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "ovtk_defines.h"
|
||||
|
||||
#include <openvibe/ov_all.h>
|
||||
|
||||
namespace EBML {
|
||||
class IWriter;
|
||||
class IWriterCallback;
|
||||
class IWriterHelper;
|
||||
class IReader;
|
||||
class IReaderCallback;
|
||||
class IReaderHelper;
|
||||
} // namespace EBML
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
template <class THandledType>
|
||||
class TScopeHandle
|
||||
{
|
||||
public:
|
||||
|
||||
TScopeHandle(THandledType& rHandler, THandledType& rHandledValue) : m_handler(rHandler), m_lastHandledValue(rHandler) { m_handler = rHandledValue; }
|
||||
~TScopeHandle() { m_handler = m_lastHandledValue; }
|
||||
|
||||
private:
|
||||
|
||||
THandledType& m_handler;
|
||||
THandledType m_lastHandledValue;
|
||||
};
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,856 @@
|
||||
#pragma once
|
||||
|
||||
#include <toolkit/ovtk_stimulations.h>
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// OpenViBE toolkit input and output type identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
#define OVTK_TypeId_Boolean OpenViBE::CIdentifier(0x2CDB2F0B, 0x12F231EA)
|
||||
#define OVTK_TypeId_Integer OpenViBE::CIdentifier(0x007DEEF9, 0x2F3E95C6)
|
||||
#define OVTK_TypeId_Float OpenViBE::CIdentifier(0x512A166F, 0x5C3EF83F)
|
||||
#define OVTK_TypeId_String OpenViBE::CIdentifier(0x79A9EDEB, 0x245D83FC)
|
||||
#define OVTK_TypeId_Filename OpenViBE::CIdentifier(0x330306DD, 0x74A95F98)
|
||||
#define OVTK_TypeId_Stimulation OpenViBE::CIdentifier(0x2C132D6E, 0x44AB0D97)
|
||||
#define OVTK_TypeId_GDF_Stimulation OpenViBE::CIdentifier(0xA538DBF0, 0xBC229750)
|
||||
|
||||
#define OVTK_TypeId_ClassificationAlgorithm OpenViBE::CIdentifier(0xD765A736, 0xED708C65)
|
||||
#define OVTK_TypeId_ClassificationStrategy OpenViBE::CIdentifier(0xBE9EBA5C, 0xA8415D37)
|
||||
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// OpenViBE toolkit stream type identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
#define OVTK_TypeId_EBMLStream OpenViBE::CIdentifier(0x434F6587, 0x2EFD2B7E)
|
||||
#define OVTK_TypeId_ExperimentInfo OpenViBE::CIdentifier(0x403488E7, 0x565D70B6)
|
||||
#define OVTK_TypeId_ExperimentationInformation OpenViBE::CIdentifier(0x403488E7, 0x565D70B6) // deprecated token, kept for compatibility, equal to the one above
|
||||
#define OVTK_TypeId_Stimulations OpenViBE::CIdentifier(0x6F752DD0, 0x082A321E)
|
||||
#define OVTK_TypeId_StreamedMatrix OpenViBE::CIdentifier(0x544A003E, 0x6DCBA5F6)
|
||||
#define OVTK_TypeId_FeatureVector OpenViBE::CIdentifier(0x17341935, 0x152FF448)
|
||||
#define OVTK_TypeId_Signal OpenViBE::CIdentifier(0x5BA36127, 0x195FEAE1)
|
||||
#define OVTK_TypeId_Spectrum OpenViBE::CIdentifier(0x1F261C0A, 0x593BF6BD)
|
||||
#define OVTK_TypeId_ChannelLocalisation OpenViBE::CIdentifier(0x013DF452, 0xA3A8879A)
|
||||
#define OVTK_TypeId_ChannelUnits OpenViBE::CIdentifier(0x6AB26B81, 0x0F8C02F3)
|
||||
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// ISO 5218 conformant sex identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
// deprecated
|
||||
#define OVTK_Value_Sex_Unknown 0
|
||||
#define OVTK_Value_Sex_Male 1
|
||||
#define OVTK_Value_Sex_Female 2
|
||||
#define OVTK_Value_Sex_NotSpecified 9
|
||||
|
||||
#define OVTK_Value_Gender_Unknown 0
|
||||
#define OVTK_Value_Gender_Male 1
|
||||
#define OVTK_Value_Gender_Female 2
|
||||
#define OVTK_Value_Gender_NotSpecified 9
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// OpenViBE toolkit stimulation identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
#define OVTK_StimulationId_Label(i) 0x00008100|((i)&0xff)
|
||||
#define OVTK_StimulationId_LabelStart 0x00008100
|
||||
#define OVTK_StimulationId_LabelEnd 0x000081ff
|
||||
|
||||
// These are low-order stimulations that may be required for some legacy communication
|
||||
// channels like parallel port handling only 1 byte codes. The name and number of these stimuli exactly matches.
|
||||
#define OVTK_StimulationId_NumberStart 0x00000000
|
||||
#define OVTK_StimulationId_NumberEnd 0x000000ff
|
||||
|
||||
#define OVTK_GDF_Condition(i) (i)
|
||||
|
||||
#define OVTK_StimulationId_ThresholdPassed_Positive 0x00008209
|
||||
#define OVTK_StimulationId_ThresholdPassed_Negative 0x00008210
|
||||
|
||||
#define OVTK_StimulationId_NoArtifact 0x00008301
|
||||
#define OVTK_StimulationId_Artifact 0x00008302
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Measurement units //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// These units attempt to be compatible with those specified by Alois Schloegl in the BioSig project, see http://biosig.sf.net/
|
||||
//
|
||||
// See also e.g.
|
||||
// ISO/IEEE 11073-10101:2004, Health informatics - Point-of-care medical device communication - Part 10101: Nomenclature
|
||||
//
|
||||
// @TODO it would be better to read these from a database file (along with the symbols now specified in ovtk_main.cpp),
|
||||
// however we still need the defines if we wish to provide compile-time token support.
|
||||
//
|
||||
// Note: Since these will be stored as double when transmitted by OpenViBE, they should not exceed the floats integer precision
|
||||
//
|
||||
|
||||
#define OVTK_UNIT_Unspecified 0
|
||||
#define OVTK_UNIT_Dimensionless 512
|
||||
#define OVTK_UNIT_10_2_Percent 544
|
||||
#define OVTK_UNIT_10_3_Parts_Per_Thousand 576
|
||||
#define OVTK_UNIT_10_6_Parts_Per_Million 608
|
||||
#define OVTK_UNIT_10_9_Parts_Per_Milliard 640
|
||||
#define OVTK_UNIT_10_12_Parts_Per_Billion 672
|
||||
#define OVTK_UNIT_10_18_Parts_Per_Trillion 704
|
||||
#define OVTK_UNIT_Angle_Degree 736
|
||||
#define OVTK_UNIT_Angle_Radian 768
|
||||
#define OVTK_UNIT_Grams_Per_Gram 800
|
||||
#define OVTK_UNIT_Grams_Per_Kilogram 832
|
||||
#define OVTK_UNIT_Moles_Per_Mole 864
|
||||
#define OVTK_UNIT_Litres_Per_Litre 896
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Cubic_Metre 928
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Cubic_Centimetre 960
|
||||
#define OVTK_UNIT_Volume_Percent 6240
|
||||
#define OVTK_UNIT_Ph 992
|
||||
#define OVTK_UNIT_Drop 1024
|
||||
#define OVTK_UNIT_Red_Blood_Cells 1056
|
||||
#define OVTK_UNIT_Beat 1088
|
||||
#define OVTK_UNIT_Breath 1120
|
||||
#define OVTK_UNIT_Cell 1152
|
||||
#define OVTK_UNIT_Cough 1184
|
||||
#define OVTK_UNIT_Sigh 1216
|
||||
#define OVTK_UNIT_Percent_Of_Packed_Cell_Volume 1248
|
||||
#define OVTK_UNIT_Metres 1280
|
||||
#define OVTK_UNIT_Yard 1312
|
||||
#define OVTK_UNIT_Foot 1344
|
||||
#define OVTK_UNIT_Inch 1376
|
||||
#define OVTK_UNIT_Litres_Per_Square_Metre 1408
|
||||
#define OVTK_UNIT_Per_Metre 1440
|
||||
#define OVTK_UNIT_Square_Metres 1472
|
||||
#define OVTK_UNIT_Square_Inch 1504
|
||||
#define OVTK_UNIT_Per_Square_Metre 1536
|
||||
#define OVTK_UNIT_Cubic_Metres 1568
|
||||
#define OVTK_UNIT_Litres 1600
|
||||
#define OVTK_UNIT_Litres_Per_Breath 1632
|
||||
#define OVTK_UNIT_Litres_Per_Beat 6112
|
||||
#define OVTK_UNIT_Per_Cubic_Metre 1664
|
||||
#define OVTK_UNIT_Per_Litre 1696
|
||||
#define OVTK_UNIT_Gram 1728
|
||||
#define OVTK_UNIT_Pound 1760
|
||||
#define OVTK_UNIT_Ounce 1792
|
||||
#define OVTK_UNIT_Per_Gram 1824
|
||||
#define OVTK_UNIT_Gram_Metre 1856
|
||||
#define OVTK_UNIT_Grams_Meter_Per_Square_Metre 1888
|
||||
#define OVTK_UNIT_Gram_Metre_Squared 1920
|
||||
#define OVTK_UNIT_Kilograms_Per_Square_Metre 1952
|
||||
#define OVTK_UNIT_Grams_Per_Cubic_Metre 1984
|
||||
#define OVTK_UNIT_Grams_Per_Cubic_Centimetre 2016
|
||||
#define OVTK_UNIT_Grams_Per_Litre 2048
|
||||
#define OVTK_UNIT_Grams_Per_Centilitre 2080
|
||||
#define OVTK_UNIT_Grams_Per_Decilitre 2112
|
||||
#define OVTK_UNIT_Grams_Per_Millilitre 2144
|
||||
#define OVTK_UNIT_Second 2176
|
||||
#define OVTK_UNIT_Minute 2208
|
||||
#define OVTK_UNIT_Hour 2240
|
||||
#define OVTK_UNIT_Day 2272
|
||||
#define OVTK_UNIT_Weeks 2304
|
||||
#define OVTK_UNIT_Months 2336
|
||||
#define OVTK_UNIT_Year 2368
|
||||
#define OVTK_UNIT_Time_Of_Day_Hh_Mm_Ss 2400
|
||||
#define OVTK_UNIT_Date_Yyyy_Mm_Dd 2432
|
||||
#define OVTK_UNIT_Per_Second 2464
|
||||
#define OVTK_UNIT_Hertz 2496
|
||||
#define OVTK_UNIT_Per_Minute 2528
|
||||
#define OVTK_UNIT_Per_Hour 2560
|
||||
#define OVTK_UNIT_Per_Day 2592
|
||||
#define OVTK_UNIT_Per_Week 2624
|
||||
#define OVTK_UNIT_Per_Month 2656
|
||||
#define OVTK_UNIT_Per_Year 2688
|
||||
#define OVTK_UNIT_Beat_Per_Minute 2720
|
||||
#define OVTK_UNIT_Puls_Per_Minute 2752
|
||||
#define OVTK_UNIT_Respirations_Per_Minute 2784
|
||||
#define OVTK_UNIT_Metres_Per_Second 2816
|
||||
#define OVTK_UNIT_Litres_Per_Minute_Per_Square_Meter 2848
|
||||
#define OVTK_UNIT_Square_Metres_Per_Second 2880
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Second 2912
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Minute 2944
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Hour 2976
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Day 3008
|
||||
#define OVTK_UNIT_Litres_Per_Second 3040
|
||||
#define OVTK_UNIT_Litres_Per_Minute 3072
|
||||
#define OVTK_UNIT_Litres_Per_Hour 3104
|
||||
#define OVTK_UNIT_Litres_Per_Day 3136
|
||||
#define OVTK_UNIT_Litres_Per_Kilogram 3168
|
||||
#define OVTK_UNIT_Cubic_Metres_Per_Kilogram 3200
|
||||
#define OVTK_UNIT_Meter_Per_Pascal_Second 3232
|
||||
#define OVTK_UNIT_Litre_Per_Min_Per_Millimetre_Of_Mercury 3264
|
||||
#define OVTK_UNIT_Grams_Per_Second 3296
|
||||
#define OVTK_UNIT_Grams_Per_Minute 3328
|
||||
#define OVTK_UNIT_Grams_Per_Hour 3360
|
||||
#define OVTK_UNIT_Grams_Per_Day 3392
|
||||
#define OVTK_UNIT_Grams_Per_Kilogram_Per_Second 3424
|
||||
#define OVTK_UNIT_Grams_Per_Kilogram_Per_Minute 3456
|
||||
#define OVTK_UNIT_Grams_Per_Kilogram_Per_Hour 3488
|
||||
#define OVTK_UNIT_Grams_Per_Kilogram_Per_Day 3520
|
||||
#define OVTK_UNIT_Grams_Per_Litre_Per_Second 3552
|
||||
#define OVTK_UNIT_Grams_Per_Litre_Per_Minute 3584
|
||||
#define OVTK_UNIT_Grams_Per_Litre_Per_Hour 3616
|
||||
#define OVTK_UNIT_Grams_Per_Litre_Per_Day 3648
|
||||
#define OVTK_UNIT_Grams_Per_Meter_Per_Second 3680
|
||||
#define OVTK_UNIT_Gram_Metres_Per_Second 3712
|
||||
#define OVTK_UNIT_Newton_Seconds 3744
|
||||
#define OVTK_UNIT_Newton 3776
|
||||
#define OVTK_UNIT_Dyne 3808
|
||||
#define OVTK_UNIT_Pascal 3840
|
||||
#define OVTK_UNIT_Millimetres_Of_Mercury 3872
|
||||
#define OVTK_UNIT_Centimetre_Of_Water 3904
|
||||
#define OVTK_UNIT_Bar 3936
|
||||
#define OVTK_UNIT_Joules 3968
|
||||
#define OVTK_UNIT_Electronvolts 4000
|
||||
#define OVTK_UNIT_Watts 4032
|
||||
#define OVTK_UNIT_Pascal_Second_Per_Cubic_Meter 4064
|
||||
#define OVTK_UNIT_Pascal_Second_Per_Litre 4096
|
||||
#define OVTK_UNIT_Dyne_Second_Per_Cm5 4128
|
||||
#define OVTK_UNIT_Litre_Per_Centimetre_Of_Water 5888
|
||||
#define OVTK_UNIT_Litre_Per_Millimetre_Of_Mercury 6272
|
||||
#define OVTK_UNIT_Litre_Per_Pascal 6304
|
||||
#define OVTK_UNIT_Centimetre_Of_Water_Per_Litre 6144
|
||||
#define OVTK_UNIT_Millimetre_Of_Mercury_Per_Litre 6336
|
||||
#define OVTK_UNIT_Pascal_Per_Litre 6368
|
||||
#define OVTK_UNIT_Amperes 4160
|
||||
#define OVTK_UNIT_Coulombs 4192
|
||||
#define OVTK_UNIT_Amperes_Hour 6080
|
||||
#define OVTK_UNIT_Amperes_Per_Metre 4224
|
||||
#define OVTK_UNIT_Volts 4256
|
||||
#define OVTK_UNIT_Ohms 4288
|
||||
#define OVTK_UNIT_Ohm_Metres 4320
|
||||
#define OVTK_UNIT_Farads 4352
|
||||
#define OVTK_UNIT_Kelvin 4384
|
||||
#define OVTK_UNIT_Degree_Celcius 6048
|
||||
#define OVTK_UNIT_Degree_Fahrenheit 4416
|
||||
#define OVTK_UNIT_Kelvins_Per_Watt 4448
|
||||
#define OVTK_UNIT_Candelas 4480
|
||||
#define OVTK_UNIT_Osmoles 4512
|
||||
#define OVTK_UNIT_Moles 4544
|
||||
#define OVTK_UNIT_Equivalent 4576
|
||||
#define OVTK_UNIT_Osmoles_Per_Litre 4608
|
||||
#define OVTK_UNIT_Moles_Per_Cubic_Centimetre 4640
|
||||
#define OVTK_UNIT_Moles_Per_Cubic_Metre 4672
|
||||
#define OVTK_UNIT_Moles_Per_Litre 4704
|
||||
#define OVTK_UNIT_Moles_Per_Millilitre 4736
|
||||
#define OVTK_UNIT_Equivalents_Per_Cubic_Centimetre 4768
|
||||
#define OVTK_UNIT_Equivalents_Per_Cubic_Metre 4800
|
||||
#define OVTK_UNIT_Equivalents_Per_Litre 4832
|
||||
#define OVTK_UNIT_Equivalents_Per_Millilitre 4864
|
||||
#define OVTK_UNIT_Osmoles_Per_Kilogram 4896
|
||||
#define OVTK_UNIT_Moles_Per_Kilogram 4928
|
||||
#define OVTK_UNIT_Moles_Per_Second 4960
|
||||
#define OVTK_UNIT_Moles_Per_Minute 4992
|
||||
#define OVTK_UNIT_Moles_Per_Hour 5024
|
||||
#define OVTK_UNIT_Moles_Per_Day 5056
|
||||
#define OVTK_UNIT_Equivalents_Per_Second 5088
|
||||
#define OVTK_UNIT_Equivalents_Per_Minute 5120
|
||||
#define OVTK_UNIT_Equivalents_Per_Hour 5152
|
||||
#define OVTK_UNIT_Equivalents_Per_Day 5184
|
||||
#define OVTK_UNIT_Moles_Per_Kilogram_Per_Second 5216
|
||||
#define OVTK_UNIT_Moles_Per_Kilogram_Per_Minute 5248
|
||||
#define OVTK_UNIT_Moles_Per_Kilogram_Per_Hour 5280
|
||||
#define OVTK_UNIT_Moles_Per_Kilogram_Per_Day 5312
|
||||
#define OVTK_UNIT_Equivalents_Per_Kilogram_Per_Second 5344
|
||||
#define OVTK_UNIT_Equivalents_Per_Kilogram_Per_Minute 5376
|
||||
#define OVTK_UNIT_Equivalents_Per_Kilogram_Per_Hour 5408
|
||||
#define OVTK_UNIT_Equivalents_Per_Kilogram_Per_Day 5440
|
||||
#define OVTK_UNIT_International_Unit 5472
|
||||
#define OVTK_UNIT_International_Units_Per_Cubic_Centimetre 5504
|
||||
#define OVTK_UNIT_International_Units_Per_Cubic_Meter 5536
|
||||
#define OVTK_UNIT_International_Units_Per_Litre 5568
|
||||
#define OVTK_UNIT_International_Units_Per_Millilitre 5600
|
||||
#define OVTK_UNIT_International_Units_Per_Second 5632
|
||||
#define OVTK_UNIT_International_Units_Per_Minute 5664
|
||||
#define OVTK_UNIT_International_Units_Per_Hour 5696
|
||||
#define OVTK_UNIT_International_Units_Per_Day 5728
|
||||
#define OVTK_UNIT_International_Units_Per_Kilogram_Per_Second 5760
|
||||
#define OVTK_UNIT_International_Units_Per_Kilogram_Per_Minute 5792
|
||||
#define OVTK_UNIT_International_Units_Per_Kilogram_Per_Hour 5824
|
||||
#define OVTK_UNIT_International_Units_Per_Kilogram_Per_Day 5856
|
||||
#define OVTK_UNIT_Centimetre_Of_Water_Per_Litre_Per_Second 5920
|
||||
#define OVTK_UNIT_Litre_Squared_Per_Second 5952
|
||||
#define OVTK_UNIT_Centimetre_Of_Water_Per_Percent 5984
|
||||
#define OVTK_UNIT_Dyne_Seconds_Per_Square_Meter_Per_Centimetre_To_The_Power_Of_5 6016
|
||||
#define OVTK_UNIT_Millimetres_Of_Mercury_Per_Percent 6176
|
||||
#define OVTK_UNIT_Pascal_Per_Percent 6208
|
||||
#define OVTK_UNIT_Relative_Power_Decibel 6432
|
||||
#define OVTK_UNIT_Meter_Per_Second_Squared 6624
|
||||
#define OVTK_UNIT_Radians_Per_Second_Squared 6656
|
||||
#define OVTK_UNIT_Foot_Per_Minute 6688
|
||||
#define OVTK_UNIT_Inch_Per_Minute 6720
|
||||
#define OVTK_UNIT_Step_Per_Minute 6752
|
||||
#define OVTK_UNIT_Kilocalories 6784
|
||||
#define OVTK_UNIT_Revolution_Per_Minute 6816
|
||||
#define OVTK_UNIT_V_Per_S 65152
|
||||
#define OVTK_UNIT_M_Per_M 65184
|
||||
#define OVTK_UNIT_Velocity_Kilometer_Per_Hour 65216
|
||||
#define OVTK_UNIT_Left_Stroke_Work_Index_Lswi 65248
|
||||
#define OVTK_UNIT_Indexed_Left_Cardiac_Work_Lcwi 65280
|
||||
#define OVTK_UNIT_Mhg_Per_S 65312
|
||||
#define OVTK_UNIT_Millimol_Per_Liter_X_Millimeter 65344
|
||||
#define OVTK_UNIT_Rotations_Per_Minute 65376
|
||||
#define OVTK_UNIT_Dyne_Seconds_Square_Meter_Per_Centimetre_To_The_Power_Of_5 65440
|
||||
#define OVTK_UNIT_Litres_Per_Square_Meter 65472
|
||||
#define OVTK_UNIT_Tesla 65504
|
||||
|
||||
// OpenViBE extensions, starting from 100001
|
||||
#define OVTK_UNIT_Degree_Per_Second 100001
|
||||
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Measurement Factors //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// These are the usual metric prefixes (also known as SI prefixes)
|
||||
//
|
||||
// The number of each prefix encodes the exponent in the 1e00 notation.
|
||||
//
|
||||
// OpenViBE enums are unsigned integers. Here we use the convention of ORring with 0x00010000 to denote the negative exponents.
|
||||
//
|
||||
// Note: Since these will be stored as double when transmitted by OpenViBE, they should not exceed the floats integer precision
|
||||
//
|
||||
|
||||
#define OVTK_FACTOR_Yotta 24
|
||||
#define OVTK_FACTOR_Zetta 21
|
||||
#define OVTK_FACTOR_Exa 18
|
||||
#define OVTK_FACTOR_Peta 15
|
||||
#define OVTK_FACTOR_Tera 12
|
||||
#define OVTK_FACTOR_Giga 9
|
||||
#define OVTK_FACTOR_Mega 6
|
||||
#define OVTK_FACTOR_Kilo 3
|
||||
#define OVTK_FACTOR_Hecto 2
|
||||
#define OVTK_FACTOR_Deca 1
|
||||
#define OVTK_FACTOR_Base 0
|
||||
#define OVTK_FACTOR_Deci (1 | 0x00010000) // 65537
|
||||
#define OVTK_FACTOR_Centi (2 | 0x00010000) // 65538
|
||||
#define OVTK_FACTOR_Milli (3 | 0x00010000) // 65539
|
||||
#define OVTK_FACTOR_Micro (6 | 0x00010000) // 65540
|
||||
#define OVTK_FACTOR_Nano (9 | 0x00010000) // 65541
|
||||
#define OVTK_FACTOR_Pico (12 | 0x00010000) // 65542
|
||||
#define OVTK_FACTOR_Femto (15 | 0x00010000) // 65543
|
||||
#define OVTK_FACTOR_Atto (18 | 0x00010000) // 65544
|
||||
#define OVTK_FACTOR_Zepto (21 | 0x00010000) // 65545
|
||||
#define OVTK_FACTOR_Yocto (24 | 0x00010000) // 65546
|
||||
|
||||
// Convert the factor code to a signer integer
|
||||
#define OVTK_DECODE_FACTOR(factor) ( ((factor) & 0x00010000) ? -int((factor) & 0x0000FFFF) : int(factor) )
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Acquisition stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Acquisition stream description
|
||||
*
|
||||
* v1 july 2006
|
||||
* v2 march 2008
|
||||
* v3 november 2014
|
||||
*
|
||||
* This is a multiplexed stream
|
||||
*
|
||||
* version 3 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Acquisition_Header_ExperimentInfo
|
||||
* ... some experiment information stream header
|
||||
* OVTK_NodeId_Acquisition_Header_Signal
|
||||
* ... some signal stream header
|
||||
* OVTK_NodeId_Acquisition_Header_Stimulation
|
||||
* ... some stimulation stream header
|
||||
* OVTK_NodeId_Acquisition_Header_ChannelLocalisation
|
||||
* ... some channel localisation stream header
|
||||
* OVTK_NodeId_Acquisition_Header_ChannelUnits
|
||||
* ... some channel units stream header
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Acquisition_Buffer_ExperimentInfo
|
||||
* ... some experiment information stream buffer
|
||||
* OVTK_NodeId_Acquisition_Buffer_Signal
|
||||
* ... some signal stream buffer
|
||||
* OVTK_NodeId_Acquisition_Buffer_Stimulation
|
||||
* ... some stimulation stream buffer
|
||||
* OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation
|
||||
* ... some channel localisation stream buffer
|
||||
* OVTK_NodeId_Acquisition_Buffer_ChannelUnits
|
||||
* ... some channel units stream buffer
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer
|
||||
* ...
|
||||
*/
|
||||
|
||||
#define OVTK_NodeId_Acquisition_Header_BufferDuration EBML::CIdentifier(0x00000000, 0x00000080)
|
||||
#define OVTK_NodeId_Acquisition_Header_ExperimentInfo EBML::CIdentifier(0x00000000, 0x00000081)
|
||||
#define OVTK_NodeId_Acquisition_Header_Signal EBML::CIdentifier(0x00000000, 0x00000082)
|
||||
#define OVTK_NodeId_Acquisition_Header_Stimulation EBML::CIdentifier(0x00000000, 0x00000083)
|
||||
#define OVTK_NodeId_Acquisition_Header_ChannelLocalisation EBML::CIdentifier(0x00000000, 0x00000084)
|
||||
#define OVTK_NodeId_Acquisition_Header_ChannelUnits EBML::CIdentifier(0x00000000, 0x00000085)
|
||||
#define OVTK_NodeId_Acquisition_Buffer_ExperimentInfo EBML::CIdentifier(0x00000000, 0x00000041)
|
||||
#define OVTK_NodeId_Acquisition_Buffer_Signal EBML::CIdentifier(0x00000000, 0x00000042)
|
||||
#define OVTK_NodeId_Acquisition_Buffer_Stimulation EBML::CIdentifier(0x00000000, 0x00000043)
|
||||
#define OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation EBML::CIdentifier(0x00000000, 0x00000044)
|
||||
#define OVTK_NodeId_Acquisition_Buffer_ChannelUnits EBML::CIdentifier(0x00000000, 0x00000045)
|
||||
|
||||
#define OVTK_NodeId_Acquisition_Header EBML::CIdentifier(0x00000000, 0x00004239) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_AcquisitionInfo EBML::CIdentifier(0x00000000, 0x00004240) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_ExperimentId EBML::CIdentifier(0x00000000, 0x00004241) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_SubjectAge EBML::CIdentifier(0x00000000, 0x00004242) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_SubjectGender EBML::CIdentifier(0x00000000, 0x00004243) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_ChannelCount EBML::CIdentifier(0x00000000, 0x00004244) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_Sampling EBML::CIdentifier(0x00000000, 0x00004245) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_ChannelNames EBML::CIdentifier(0x00000000, 0x00004246) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_ChannelName EBML::CIdentifier(0x00000000, 0x00004247) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_GainFactors EBML::CIdentifier(0x00000000, 0x00004248) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_GainFactor EBML::CIdentifier(0x00000000, 0x00004249) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_ChannelLocations EBML::CIdentifier(0x00000000, 0x00004250) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_ChannelLocation EBML::CIdentifier(0x00000000, 0x00004251) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_Buffer EBML::CIdentifier(0x00000000, 0x0000005A) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_Samples EBML::CIdentifier(0x00000000, 0x0000005B) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_SamplesPerChannelCount EBML::CIdentifier(0x00000000, 0x0000005C) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_SampleBlock EBML::CIdentifier(0x00000000, 0x0000005D) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_Stimulations EBML::CIdentifier(0x00000000, 0x00000060) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_StimulationsCount EBML::CIdentifier(0x00000000, 0x00000061) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_Stimulation EBML::CIdentifier(0x00000000, 0x00000062) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_StimulationSampleIndex EBML::CIdentifier(0x00000000, 0x00000063) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_StimulationIdentifier EBML::CIdentifier(0x00000000, 0x00000064) // deprecated
|
||||
#define OVTK_NodeId_Acquisition_SubjectSex EBML::CIdentifier(0x00000000, 0x00004243) // deprecated
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Protocol hierarchy //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* - Standard EBML stream
|
||||
* - Experiment information
|
||||
* - Stimulation
|
||||
* - Streamed Matrix
|
||||
* - Signal
|
||||
* - Spectrum
|
||||
* - Feature vector
|
||||
* - Channel localisation
|
||||
* - Channel units
|
||||
*/
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Standard EBML stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
#define OVTK_NodeId_Header EBML::CIdentifier(0x002B395F, 0x108ADFAE)
|
||||
#define OVTK_NodeId_Header_StreamType EBML::CIdentifier(0x00CDD0F7, 0x46B0278D)
|
||||
#define OVTK_NodeId_Header_StreamVersion EBML::CIdentifier(0x006F5A08, 0x7796EBC5)
|
||||
#define OVTK_NodeId_Buffer EBML::CIdentifier(0x00CF2101, 0x02375310)
|
||||
#define OVTK_NodeId_End EBML::CIdentifier(0x00D9DDC3, 0x0B12873A)
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Streamed matrix stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
#define OVTK_NodeId_Header_StreamedMatrix EBML::CIdentifier(0x0072F560, 0x7ED2CBED)
|
||||
#define OVTK_NodeId_Header_StreamedMatrix_DimensionCount EBML::CIdentifier(0x003FEBD4, 0x2725D428)
|
||||
#define OVTK_NodeId_Header_StreamedMatrix_Dimension EBML::CIdentifier(0x0000E3C0, 0x3A7D5141)
|
||||
#define OVTK_NodeId_Header_StreamedMatrix_Dimension_Size EBML::CIdentifier(0x001302F7, 0x36D8438A)
|
||||
#define OVTK_NodeId_Header_StreamedMatrix_Dimension_Label EBML::CIdentifier(0x00153E40, 0x190227E0)
|
||||
#define OVTK_NodeId_Buffer_StreamedMatrix EBML::CIdentifier(0x00120663, 0x08FBC165)
|
||||
#define OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer EBML::CIdentifier(0x00B18C10, 0x427D098C)
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Signal stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Signal stream description
|
||||
* v1 november 6th 2006
|
||||
* v2 may 24th 2007
|
||||
*
|
||||
* version 2 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:2)
|
||||
* OVTK_NodeId_Header_Signal
|
||||
* OVTK_NodeId_Header_Signal_Sampling (integer)
|
||||
* OVTK_NodeId_Header_StreamedMatrix
|
||||
* OVTK_NodeId_Header_StreamedMatrix_DimensionCount (integer:2)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:channel count)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:number of samples per buffer)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string)
|
||||
* ...
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
|
||||
#define OVTK_NodeId_Header_Signal EBML::CIdentifier(0x007855DE, 0x3748D375)
|
||||
#define OVTK_NodeId_Header_Signal_Sampling EBML::CIdentifier(0x00141C43, 0x0C37006B)
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Channel localisation stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Channel localisation description
|
||||
* v1 nov 04th 2008
|
||||
*
|
||||
* version 1 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:2)
|
||||
* OVTK_NodeId_Header_ChannelLocalisation
|
||||
* OVTK_NodeId_Header_ChannelLocalisation_Dynamic (bool)
|
||||
* OVTK_NodeId_Header_StreamedMatrix
|
||||
* OVTK_NodeId_Header_StreamedMatrix_DimensionCount (integer:2)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:channel count)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:3)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:x)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:y)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:z)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
|
||||
#define OVTK_NodeId_Header_ChannelLocalisation EBML::CIdentifier(0xF2CFE60B, 0xEFD63E3B)
|
||||
#define OVTK_NodeId_Header_ChannelLocalisation_Dynamic EBML::CIdentifier(0x5338AF5C, 0x07C469C3)
|
||||
|
||||
/*
|
||||
* Channel units description
|
||||
* v1 nov 2014
|
||||
*
|
||||
* version 1 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:1)
|
||||
* OVTK_NodeId_Header_ChannelUnits
|
||||
* OVTK_NodeId_Header_ChannelUnits_Dynamic (boolean)
|
||||
* OVTK_NodeId_Header_StreamedMatrix
|
||||
* OVTK_NodeId_Header_StreamedMatrix_DimensionCount (integer:2)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:channel count)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:2)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:unit)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:factor)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
#define OVTK_NodeId_Header_ChannelUnits EBML::CIdentifier(0x17400C76, 0x16CF14C8)
|
||||
#define OVTK_NodeId_Header_ChannelUnits_Dynamic EBML::CIdentifier(0x7307023C, 0x7F754D2E)
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Stimulation stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Stimulation stream description
|
||||
* v1 november 6th 2006
|
||||
* v2 may 24th 2007
|
||||
* v3 ??
|
||||
*
|
||||
* version 3 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:2)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_Stimulation
|
||||
* OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations (integer)
|
||||
* OVTK_NodeId_Buffer_Stimulation_Stimulation
|
||||
* OVTK_NodeId_Buffer_Stimulation_Stimulation_ID (integer)
|
||||
* OVTK_NodeId_Buffer_Stimulation_Stimulation_Date (integer)
|
||||
* OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration (integer)
|
||||
* OVTK_NodeId_Stimulation_Stimulation
|
||||
* ...
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
|
||||
#define OVTK_NodeId_Buffer_Stimulation EBML::CIdentifier(0x006DEABE, 0x7FC05A20)
|
||||
#define OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations EBML::CIdentifier(0x00BB790B, 0x2B8574D8)
|
||||
#define OVTK_NodeId_Buffer_Stimulation_Stimulation EBML::CIdentifier(0x0016EAC6, 0x29FBCAA1)
|
||||
#define OVTK_NodeId_Buffer_Stimulation_Stimulation_ID EBML::CIdentifier(0x006FA5DB, 0x4BAC31E9)
|
||||
#define OVTK_NodeId_Buffer_Stimulation_Stimulation_Date EBML::CIdentifier(0x00B866D8, 0x14DA5374)
|
||||
#define OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration EBML::CIdentifier(0x14EE055F, 0x87FBCC9C)
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Experiment information node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Experiment information stream description (fixed on november 6th 2006)
|
||||
*
|
||||
* version 1 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:1)
|
||||
* OVTK_NodeId_Header_ExperimentInfo
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Experiment
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Experiment_ID (integer)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Experiment_Date (date)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Subject
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Subject_ID (integer)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Subject_Name (string)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Subject_Age (integer)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Subject_Gender (integer)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Context
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID (integer)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName (string)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID (integer)
|
||||
* OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName (string)
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
|
||||
#define OVTK_NodeId_Header_ExperimentInfo EBML::CIdentifier(0x00746BA0, 0x115AE04D)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Experiment EBML::CIdentifier(0x0011D6B7, 0x48F1AA39)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Experiment_ID EBML::CIdentifier(0x006ACD74, 0x1C960C26)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Experiment_Date EBML::CIdentifier(0x002F8FB7, 0x6DA7552D)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Subject EBML::CIdentifier(0x003EC620, 0x333E0A94)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Subject_ID EBML::CIdentifier(0x00D62974, 0x473D4AA5)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Subject_Name EBML::CIdentifier(0x0041FD0A, 0x6BCD9A99)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Subject_Age EBML::CIdentifier(0x00DF7DD9, 0x33336C51)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Subject_Sex EBML::CIdentifier(0x0069BB84, 0x3FC8E149) /* for retro compat */
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Subject_Gender EBML::CIdentifier(0x0069BB84, 0x3FC8E149)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Context EBML::CIdentifier(0x0018C291, 0x7985DFDD)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID EBML::CIdentifier(0x003F11B9, 0x26D76D9C)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName EBML::CIdentifier(0x00EB1F23, 0x51C23B83)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID EBML::CIdentifier(0x00874A7F, 0x60DC34C2)
|
||||
#define OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName EBML::CIdentifier(0x00C8C393, 0x31CE5B3E)
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Feature vector stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Feature vector stream description
|
||||
* v1 may 24th 2007
|
||||
*
|
||||
* version 1 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:1)
|
||||
* OVTK_NodeId_Header_StreamedMatrix
|
||||
* OVTK_NodeId_Header_StreamedMatrix_DimensionCount (integer:1)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:feature count)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:feature 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:feature 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// Spectrum stream node identifiers //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
* Spectrum stream description
|
||||
* v1 june 4th 2007
|
||||
*
|
||||
* version 1 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:1)
|
||||
* OVTK_NodeId_Header_StreamedMatrix
|
||||
* OVTK_NodeId_Header_StreamedMatrix_DimensionCount (integer:2)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:channel count)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:number of frequency band)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:frequency band 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:frequency band 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_Spectrum
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyBand
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyBand_Start (double)
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyBand_Stop (double)
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyBand
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyBand_Start (double)
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyBand_Stop (double)
|
||||
* ...
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
|
||||
/*
|
||||
* Spectrum stream description
|
||||
* v2 january 27th 2017
|
||||
*
|
||||
* version 2 :
|
||||
* ----------------------------------------------------------------- *
|
||||
* OVTK_NodeId_Header
|
||||
* OVTK_NodeId_Header_StreamType (integer:)
|
||||
* OVTK_NodeId_Header_StreamVersion (integer:1)
|
||||
* OVTK_NodeId_Header_StreamedMatrix
|
||||
* OVTK_NodeId_Header_StreamedMatrix_DimensionCount (integer:2)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:channel count)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:channel 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Size (integer:number of frequency)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:frequency 1 name)
|
||||
* OVTK_NodeId_Header_StreamedMatrix_Dimension_Label (string:frequency 2 name)
|
||||
* ...
|
||||
* OVTK_NodeId_Header_Spectrum
|
||||
* OVTK_NodeId_Header_Spectrum_Sampling (double)
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyAbscissa (double)
|
||||
* OVTK_NodeId_Header_Spectrum_FrequencyAbscissa (double)
|
||||
* ...
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* OVTK_NodeId_Buffer
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix
|
||||
* OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer (array of double)
|
||||
* ...
|
||||
* OVTK_NodeId_End
|
||||
* ----------------------------------------------------------------- *
|
||||
*/
|
||||
#define OVTK_NodeId_Header_Spectrum EBML::CIdentifier(0x00CCFA4B, 0x14F37D4D)
|
||||
#define OVTK_NodeId_Header_Spectrum_FrequencyBand_Deprecated EBML::CIdentifier(0x0010983C, 0x21F8BDE5)
|
||||
#define OVTK_NodeId_Header_Spectrum_FrequencyBand_Start_Deprecated EBML::CIdentifier(0x00AA5654, 0x2403A2CB)
|
||||
#define OVTK_NodeId_Header_Spectrum_FrequencyBand_Stop_Deprecated EBML::CIdentifier(0x00A44C82, 0x05BE50D5)
|
||||
#define OVTK_NodeId_Header_Spectrum_FrequencyAbscissa EBML::CIdentifier(0x00D7287D, 0x622A2BF5)
|
||||
#define OVTK_NodeId_Header_Spectrum_Sampling EBML::CIdentifier(0x006876E9, 0x1DCB0CA1)
|
||||
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
/*
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x0027615F, 0x2243F7B5)
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x00866CC6, 0x1EFE4BDC)
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x00C91900, 0x55E50FF0)
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x00E0E260, 0x646BF99E)
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x00DCE72C, 0x386A40C5)
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x00C520C6, 0x09AE98B5)
|
||||
#define OVTK_NodeId_ EBML::CIdentifier(0x00F1CBCB, 0x56BD6821)
|
||||
*/
|
||||
#define OVTK_ClassId_ OpenViBE::CIdentifier(0x00C6D56F, 0x30890D27)
|
||||
#define OVTK_ClassId_Stimulation OpenViBE::CIdentifier(0xE4E131F0, 0xC6550E9E)
|
||||
#define OVTK_ClassId_BaseAlgorithms_DataImporterT OpenViBE::CIdentifier(0xA6BB8664, 0xF1B9DE96)
|
||||
#define OVTK_ClassId_BaseAlgorithms_DataExporterT OpenViBE::CIdentifier(0xA432362A, 0x5CD4F227)
|
||||
|
||||
#define OVTK_ClassId_Vector OpenViBE::CIdentifier(0x5D113170, 0x941C8932)
|
||||
#define OVTK_ClassId_FeatureVector OpenViBE::CIdentifier(0xF44A9CBD, 0x459DBA69)
|
||||
#define OVTK_ClassId_FeatureVectorSet OpenViBE::CIdentifier(0x6D5FB77B, 0x5BDD0420)
|
||||
|
||||
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
// API Definition //
|
||||
//__________________________________________________________________//
|
||||
// //
|
||||
|
||||
// Taken from
|
||||
// - http://people.redhat.com/drepper/dsohowto.pdf
|
||||
// - http://www.nedprod.com/programs/gccvisibility.html
|
||||
#if defined OVTK_Shared
|
||||
#if defined TARGET_OS_Windows
|
||||
#define OVTK_API_Export __declspec(dllexport)
|
||||
#define OVTK_API_Import __declspec(dllimport)
|
||||
#elif defined TARGET_OS_Linux || defined TARGET_OS_MacOS
|
||||
#define OVTK_API_Export __attribute__((visibility("default")))
|
||||
#define OVTK_API_Import __attribute__((visibility("default")))
|
||||
#else
|
||||
#define OVTK_API_Export
|
||||
#define OVTK_API_Import
|
||||
#endif
|
||||
#else
|
||||
#define OVTK_API_Export
|
||||
#define OVTK_API_Import
|
||||
#endif
|
||||
|
||||
#if defined OVTK_Exports
|
||||
#define OVTK_API OVTK_API_Export
|
||||
#else
|
||||
#define OVTK_API OVTK_API_Import
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
namespace Matrix {
|
||||
// Can be used : CMatrix class behaviour is a little different but this function is never used (except in test). Avoid to used it, intended to be removed.
|
||||
OVTK_API bool toString(const CMatrix& matrix, CString& str, const size_t precision = 6);
|
||||
OVTK_API bool fromString(CMatrix& matrix, const CString& str);
|
||||
OVTK_API bool saveToTextFile(const CMatrix& matrix, const CString& filename, const size_t precision = 6);
|
||||
OVTK_API bool loadFromTextFile(CMatrix& matrix, const CString& filename);
|
||||
|
||||
//@todo All is useless now. Avoid to used it, intended to be removed.
|
||||
OVTK_API bool copy(CMatrix& dst, const CMatrix& src);
|
||||
OVTK_API bool copyDescription(CMatrix& dst, const CMatrix& src);
|
||||
OVTK_API bool copyContent(CMatrix& dst, const CMatrix& src);
|
||||
OVTK_API bool clearContent(CMatrix& matrix); //(resetBuffer)
|
||||
OVTK_API bool isDescriptionSimilar(const CMatrix& src1, const CMatrix& src2, bool checkLabels = true); //(isDescriptionEqual)
|
||||
OVTK_API bool isContentSimilar(const CMatrix& src1, const CMatrix& src2); //(isBufferEqual)
|
||||
OVTK_API bool isContentValid(const CMatrix& src, const bool checkNotANumber = true, const bool checkInfinity = true); //(isBufferValid)
|
||||
} // namespace Matrix
|
||||
|
||||
//@todo All is useless now. Avoid to used it, intended to be removed.
|
||||
namespace MatrixManipulation {
|
||||
inline bool copy(CMatrix& dst, const CMatrix& src) { return Matrix::copy(dst, src); }
|
||||
inline bool copyDescription(CMatrix& dst, const CMatrix& src) { return Matrix::copyDescription(dst, src); }
|
||||
inline bool copyContent(CMatrix& dst, const CMatrix& src) { return Matrix::copyContent(dst, src); }
|
||||
inline bool clearContent(CMatrix& rMatrix) { return Matrix::clearContent(rMatrix); }
|
||||
} // namespace MatrixManipulation
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
namespace StimulationSet {
|
||||
OVTK_API bool shift(IStimulationSet& stimSet, uint64_t timeShift);
|
||||
OVTK_API bool copy(IStimulationSet& dst, const IStimulationSet& src, uint64_t timeShift = 0);
|
||||
OVTK_API bool append(IStimulationSet& dst, const IStimulationSet& src, uint64_t timeShift = 0);
|
||||
OVTK_API bool appendRange(IStimulationSet& dst, const IStimulationSet& src, uint64_t srcStartTime, uint64_t srcEndTime, uint64_t timeShift = 0);
|
||||
OVTK_API bool removeRange(IStimulationSet& stimSet, uint64_t startTime, uint64_t endTime);
|
||||
} // namespace StimulationSet
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
namespace String {
|
||||
class OVTK_API ISplitCallback
|
||||
{
|
||||
public:
|
||||
virtual ~ISplitCallback() { }
|
||||
virtual void beginSplit() const { }
|
||||
virtual void endSplit() const { }
|
||||
virtual void setToken(const char* token) const = 0;
|
||||
};
|
||||
|
||||
template <class TContainer>
|
||||
class TSplitCallback final : public ISplitCallback
|
||||
{
|
||||
public:
|
||||
|
||||
explicit TSplitCallback(TContainer& tokenContainers) : m_tokenContainer(&tokenContainers) { }
|
||||
|
||||
void setToken(const char* token) const override { m_tokenContainer->push_back(token); }
|
||||
|
||||
protected:
|
||||
|
||||
TContainer* m_tokenContainer = nullptr;
|
||||
};
|
||||
|
||||
OVTK_API size_t split(const CString& str, const ISplitCallback& splitCB, uint8_t separator);
|
||||
OVTK_API size_t split(const CString& str, const ISplitCallback& splitCB, uint8_t* separator, const size_t nSeparator);
|
||||
OVTK_API bool isAlmostEqual(const CString& str1, const CString& str2, bool caseSensitive = true, bool removeStartSpaces = true, bool removeEndSpaces = true);
|
||||
} // namespace String
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class OVTK_API ISignalTrial : public IObject
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool setSamplingRate(size_t sampling) = 0;
|
||||
virtual bool setChannelCount(size_t count) = 0;
|
||||
virtual bool setChannelName(size_t index, const char* name) = 0;
|
||||
virtual bool setLabelIdentifier(const CIdentifier& labelIdentifier) = 0;
|
||||
virtual bool setSampleCount(size_t count, bool preserve) = 0;
|
||||
|
||||
virtual size_t getSamplingRate() const = 0;
|
||||
virtual size_t getChannelCount() const = 0;
|
||||
virtual const char* getChannelName(const size_t index) const = 0;
|
||||
virtual CIdentifier getLabelIdentifier() const = 0;
|
||||
virtual size_t getSampleCount() const = 0;
|
||||
virtual uint64_t getDuration() const = 0;
|
||||
virtual double* getChannelSampleBuffer(size_t index) const = 0;
|
||||
|
||||
_IsDerivedFromClass_(IObject, OVTK_ClassId_)
|
||||
};
|
||||
|
||||
extern OVTK_API ISignalTrial* createSignalTrial();
|
||||
extern OVTK_API void releaseSignalTrial(ISignalTrial* trial);
|
||||
|
||||
// operations
|
||||
extern OVTK_API ISignalTrial& copyHeader(ISignalTrial& trial, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& copy(ISignalTrial& trial, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& selectSamples(ISignalTrial& trial, size_t sampleStart, size_t sampleEnd, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& selectTime(ISignalTrial& trial, uint64_t timeStart, uint64_t timeEnd, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& removeSamples(ISignalTrial& trial, size_t sampleStart, size_t sampleEnd, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& removeTime(ISignalTrial& trial, uint64_t timeStart, uint64_t timeEnd, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& insertBufferSamples(ISignalTrial& trial, size_t sampleStart, size_t nSample, const double* buffer, const ISignalTrial* srcTrial = nullptr);
|
||||
extern OVTK_API ISignalTrial& insertBufferTime(ISignalTrial& trial, uint64_t timeStart, size_t nSample, const double* buffer, const ISignalTrial* srcTrial = nullptr);
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovtk_base.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Toolkit {
|
||||
class ISignalTrial;
|
||||
|
||||
class OVTK_API ISignalTrialSet : public IObject
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool addSignalTrial(ISignalTrial& signalTrial) = 0;
|
||||
virtual bool clear() = 0;
|
||||
|
||||
virtual size_t getSignalTrialCount() const = 0;
|
||||
virtual ISignalTrial& getSignalTrial(const size_t index) const = 0;
|
||||
|
||||
_IsDerivedFromClass_(IObject, OVTK_ClassId_)
|
||||
};
|
||||
|
||||
extern OVTK_API ISignalTrialSet* createSignalTrialSet();
|
||||
extern OVTK_API void releaseSignalTrialSet(ISignalTrialSet* signalTrialSet);
|
||||
} // namespace Toolkit
|
||||
} // namespace OpenViBE
|
||||
Reference in New Issue
Block a user