init
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
#######################################################################
|
||||
# Software License Agreement (AGPL-3 License)
|
||||
#
|
||||
# OpenViBE SDK Test Software
|
||||
# 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/>.
|
||||
#######################################################################
|
||||
|
||||
PROJECT(openvibe-plugin-inspector)
|
||||
|
||||
FILE(GLOB_RECURSE SRC_FILES src/*.cpp src/*.h)
|
||||
ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_FILES})
|
||||
SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER ${APP_FOLDER})
|
||||
|
||||
INCLUDE("FindOpenViBE")
|
||||
INCLUDE("FindOpenViBECommon")
|
||||
INCLUDE("FindOpenViBEToolkit")
|
||||
INCLUDE("FindOpenViBEModuleSystem")
|
||||
INCLUDE("FindOpenViBEModuleFS")
|
||||
INCLUDE("FindThirdPartyBoost")
|
||||
|
||||
# ---------------------------------
|
||||
# Target macros
|
||||
# Defines target operating system, architecture and compiler
|
||||
# ---------------------------------
|
||||
SET_BUILD_PLATFORM()
|
||||
|
||||
# -----------------------------
|
||||
# Install files
|
||||
# -----------------------------
|
||||
INSTALL(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION ${DIST_BINDIR}
|
||||
LIBRARY DESTINATION ${DIST_LIBDIR}
|
||||
ARCHIVE DESTINATION ${DIST_LIBDIR})
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#include "ovpiCPluginObjectDescEnum.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace PluginInspector {
|
||||
|
||||
// Enumerate plugins by iterating over a user defined list of descriptors, used for metaboxes
|
||||
bool CPluginObjectDescEnum::enumeratePluginObjectDesc(std::vector<const Plugins::IPluginObjectDesc*>& pod)
|
||||
{
|
||||
for (auto* plugin : pod) { this->callback(*plugin); }
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPluginObjectDescEnum::enumeratePluginObjectDesc(const CIdentifier& parentClassID)
|
||||
{
|
||||
CIdentifier id;
|
||||
while ((id = m_kernelCtx.getPluginManager().getNextPluginObjectDescIdentifier(id, parentClassID)) != CIdentifier::undefined())
|
||||
{
|
||||
this->callback(*m_kernelCtx.getPluginManager().getPluginObjectDesc(id));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CPluginObjectDescEnum::transform(const std::string& in, const bool removeSlash)
|
||||
{
|
||||
std::string out;
|
||||
bool wasLastASeparator = true;
|
||||
|
||||
for (size_t i = 0; i < in.length(); ++i)
|
||||
{
|
||||
if ((in[i] >= 'a' && in[i] <= 'z') || (in[i] >= 'A' && in[i] <= 'Z') || (in[i] >= '0' && in[i] <= '9') || (!removeSlash && in[i] == '/'))
|
||||
{
|
||||
if (in[i] == '/') { out += "_"; }
|
||||
else
|
||||
{
|
||||
if (wasLastASeparator)
|
||||
{
|
||||
if ('a' <= in[i] && in[i] <= 'z') { out += in[i] + 'A' - 'a'; }
|
||||
else { out += in[i]; }
|
||||
}
|
||||
else { out += in[i]; }
|
||||
}
|
||||
wasLastASeparator = false;
|
||||
}
|
||||
else { wasLastASeparator = true; }
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace PluginInspector
|
||||
} // namespace OpenViBE
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <openvibe/ov_all.h>
|
||||
#include <toolkit/ovtk_all.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace PluginInspector {
|
||||
class CPluginObjectDescEnum
|
||||
{
|
||||
public:
|
||||
|
||||
explicit CPluginObjectDescEnum(const Kernel::IKernelContext& ctx) : m_kernelCtx(ctx) { }
|
||||
virtual ~CPluginObjectDescEnum() { }
|
||||
|
||||
virtual bool enumeratePluginObjectDesc(std::vector<const Plugins::IPluginObjectDesc*>& pod);
|
||||
virtual bool enumeratePluginObjectDesc(const CIdentifier& parentClassID);
|
||||
|
||||
virtual bool callback(const Plugins::IPluginObjectDesc& pod) = 0;
|
||||
|
||||
static std::string transform(const std::string& in, bool removeSlash = false);
|
||||
|
||||
protected:
|
||||
|
||||
const Kernel::IKernelContext& m_kernelCtx;
|
||||
};
|
||||
} // namespace PluginInspector
|
||||
} // namespace OpenViBE
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
#include "ovpiCPluginObjectDescEnumBoxTemplateGenerator.h"
|
||||
|
||||
#include <system/ovCTime.h>
|
||||
#include <fs/Files.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace PluginInspector {
|
||||
|
||||
static std::map<int, char> indentCharacters = { { 0, '=' }, { 1, '-' }, { 2, '~' }, { 3, '+' } };
|
||||
static std::string generateRstTitle(const std::string& title, const int level)
|
||||
{
|
||||
return title + "\n" + std::string(title.size(), indentCharacters[level]) + "\n";
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------
|
||||
bool CPluginObjectDescEnumBoxTemplateGenerator::initialize()
|
||||
{
|
||||
if (!m_kernelCtx.getScenarioManager().createScenario(m_scenarioID)) { return false; }
|
||||
m_scenario = &m_kernelCtx.getScenarioManager().getScenario(m_scenarioID);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------
|
||||
bool CPluginObjectDescEnumBoxTemplateGenerator::uninitialize()
|
||||
{
|
||||
if (!m_kernelCtx.getScenarioManager().releaseScenario(m_scenarioID)) { return false; }
|
||||
|
||||
std::ofstream ofBoxIdx;
|
||||
FS::Files::openOFStream(ofBoxIdx, (m_docTemplateDirectory + "/index-boxes.rst").c_str());
|
||||
|
||||
if (!ofBoxIdx.good())
|
||||
{
|
||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Error while trying to open file [" << (m_docTemplateDirectory + "/index-boxes.rst").c_str() <<
|
||||
"]\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
ofBoxIdx << ".. _Doc_BoxAlgorithms:\n\n" << generateRstTitle("Boxes list", 0) << "\nAvailable box algorithms are :\n\n" << generateRstIndex(m_categories) <<
|
||||
" \n";
|
||||
|
||||
if (!m_deprecatedBoxesCategories.empty())
|
||||
{
|
||||
ofBoxIdx << "\n\n" << generateRstTitle("Deprecated boxes list", 0) <<
|
||||
"\nThe following boxes are deprecated, they are hidden in Studio and will be removed soon or later, so you should consider not using them:\n"
|
||||
<< generateRstIndex(m_deprecatedBoxesCategories) << " \n";
|
||||
}
|
||||
|
||||
ofBoxIdx << " \n";
|
||||
ofBoxIdx.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------
|
||||
bool CPluginObjectDescEnumBoxTemplateGenerator::callback(const Plugins::IPluginObjectDesc& pod)
|
||||
{
|
||||
const std::string fileName = "BoxAlgorithm_" + transform(pod.getName().toASCIIString());
|
||||
CIdentifier boxID;
|
||||
|
||||
if (pod.getCreatedClass() == OVP_ClassId_BoxAlgorithm_Metabox)
|
||||
{
|
||||
// insert a box into the scenario, initialize it from the proxy-descriptor from the metabox loader
|
||||
if (!m_scenario->addBox(boxID, dynamic_cast<const Plugins::IBoxAlgorithmDesc&>(pod), CIdentifier::undefined()))
|
||||
{
|
||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Skipped [" << fileName << "] (could not create corresponding box)\n";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!m_scenario->addBox(boxID, pod.getCreatedClassIdentifier(), CIdentifier::undefined()))
|
||||
{
|
||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Warning << "Skipped [" << fileName << "] (could not create corresponding box)\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Kernel::IBox& box = *m_scenario->getBoxDetails(boxID);
|
||||
|
||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Trace << "Working on [" << fileName << "]\n";
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
std::ofstream ofs;
|
||||
FS::Files::openOFStream(ofs, (m_docTemplateDirectory + "/Doc_" + fileName + ".rst-template").c_str());
|
||||
|
||||
if (!ofs.good())
|
||||
{
|
||||
m_kernelCtx.getLogManager() << Kernel::LogLevel_Error << "Error while trying to open file ["
|
||||
<< (m_docTemplateDirectory + "/Doc_" + fileName + ".rst-template").c_str()
|
||||
<< "]\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
ofs << ".. _Doc_" << fileName << ":\n\n" << generateRstTitle(pod.getName().toASCIIString(), 0)
|
||||
<< "\n.. container:: attribution\n\n :Author:\n " << pod.getAuthorName().toASCIIString() << "\n"
|
||||
<< " :Company:\n " << pod.getAuthorCompanyName().toASCIIString() << "\n\n\n"
|
||||
<< ".. todo:: Write general box description...\n\n\n";
|
||||
|
||||
|
||||
if (box.getInputCount())
|
||||
{
|
||||
ofs << ".. _Doc_" << fileName << "_Inputs:\n\n" << generateRstTitle("Inputs", 1).c_str()
|
||||
<< ".. todo:: Write general input description...\n\n.. csv-table::\n :header: \"Input Name\", \"Stream Type\"\n\n";
|
||||
|
||||
std::vector<CString> inputNames(box.getInputCount());
|
||||
for (size_t i = 0; i < box.getInputCount(); ++i)
|
||||
{
|
||||
CIdentifier typeID;
|
||||
box.getInputName(i, inputNames[i]);
|
||||
box.getInputType(i, typeID);
|
||||
CString typeName = m_kernelCtx.getTypeManager().getTypeName(typeID);
|
||||
|
||||
ofs << " \"" << inputNames[i] << "\", \"" << typeName << "\"\n";
|
||||
}
|
||||
size_t index = 1;
|
||||
for (const auto& name : inputNames)
|
||||
{
|
||||
ofs << "\n.. _Doc_" << fileName << "_Input_" << index << ":\n\n" << generateRstTitle(name.toASCIIString(), 2)
|
||||
<< "\n.. todo:: Write input description...\n\n\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
if (box.getOutputCount())
|
||||
{
|
||||
ofs << ".. _Doc_" << fileName << "_Outputs:\n\n" << generateRstTitle("Outputs", 1)
|
||||
<< "\n.. todo:: Write general output description...\n\n.. csv-table::\n :header: \"Output Name\", \"Stream Type\"\n\n";
|
||||
|
||||
std::vector<CString> outputNames(box.getOutputCount());
|
||||
for (size_t i = 0; i < box.getOutputCount(); ++i)
|
||||
{
|
||||
CIdentifier typeID;
|
||||
box.getOutputName(i, outputNames[i]);
|
||||
box.getOutputType(i, typeID);
|
||||
CString typeName = m_kernelCtx.getTypeManager().getTypeName(typeID);
|
||||
|
||||
ofs << " \"" << outputNames[i] << "\", \"" << typeName << "\"\n";
|
||||
}
|
||||
size_t index = 1;
|
||||
for (const auto& outputName : outputNames)
|
||||
{
|
||||
ofs << "\n.. _Doc_" << fileName << "_Output_" << index << ":\n\n" << generateRstTitle(outputName.toASCIIString(), 2)
|
||||
<< "\n.. todo:: Write output description...\n\n\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
if (box.getSettingCount())
|
||||
{
|
||||
ofs << ".. _Doc_" << fileName << "_Settings:\n\n" << generateRstTitle("Settings", 1) << "\n"
|
||||
<< ".. todo:: Write settings general description...\n\n.. csv-table::\n :header: \"Setting Name\", \"Type\", \"Default Value\"\n\n";
|
||||
|
||||
std::vector<CString> settingsNames(box.getSettingCount());
|
||||
for (size_t i = 0; i < box.getSettingCount(); ++i)
|
||||
{
|
||||
CIdentifier typeID;
|
||||
CString defaultValue;
|
||||
box.getSettingName(i, settingsNames[i]);
|
||||
box.getSettingType(i, typeID);
|
||||
box.getSettingDefaultValue(i, defaultValue);
|
||||
CString typeName = m_kernelCtx.getTypeManager().getTypeName(typeID);
|
||||
|
||||
ofs << " \"" << settingsNames[i] << "\", \"" << typeName << "\", \"" << defaultValue << "\"\n";
|
||||
}
|
||||
size_t index = 1;
|
||||
for (const auto& name : settingsNames)
|
||||
{
|
||||
ofs << "\n.. _Doc_" << fileName << "_Setting_" << index << ":\n\n" << generateRstTitle(name.toASCIIString(), 2)
|
||||
<< "\n.. todo:: Write setting description... \n\n\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
ofs << ".. _Doc_" << fileName << "_Examples:\n\n" << generateRstTitle("Examples", 1)
|
||||
<< "\n.. todo:: Write example of use...\n\n\n";
|
||||
|
||||
ofs << ".. _Doc_" << fileName << "_Miscellaneous:\n\n" << generateRstTitle("Miscellaneous", 1)
|
||||
<< "\n.. todo:: Write any miscellaneous information...\n\n\n";
|
||||
|
||||
ofs.close();
|
||||
|
||||
// m_categories is used to generate the list of boxes. Documentation for deprecated boxes
|
||||
// should remain available if needed but not be listed
|
||||
if (m_kernelCtx.getPluginManager().isPluginObjectFlaggedAsDeprecated(box.getAlgorithmClassIdentifier()))
|
||||
{
|
||||
m_deprecatedBoxesCategories.push_back(std::pair<std::string, std::string>(pod.getCategory().toASCIIString(), pod.getName().toASCIIString()));
|
||||
}
|
||||
else { m_categories.push_back(std::pair<std::string, std::string>(pod.getCategory().toASCIIString(), pod.getName().toASCIIString())); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------
|
||||
std::string CPluginObjectDescEnumBoxTemplateGenerator::generateRstIndex(std::vector<std::pair<std::string, std::string>> categories) const
|
||||
{
|
||||
std::string res;
|
||||
|
||||
std::string lastCategoryName;
|
||||
std::vector<std::string> lastSplittedCategories;
|
||||
std::sort(categories.begin(), categories.end());
|
||||
|
||||
for (auto& category : categories)
|
||||
{
|
||||
std::string categoryName = category.first;
|
||||
std::string name = category.second;
|
||||
|
||||
if (lastCategoryName != categoryName)
|
||||
{
|
||||
std::vector<std::string> splittedCategories;
|
||||
size_t i = size_t(-1);
|
||||
bool isFinished = false;
|
||||
while (!isFinished)
|
||||
{
|
||||
size_t j = categoryName.find('/', i + 1);
|
||||
if (j == std::string::npos)
|
||||
{
|
||||
j = categoryName.length();
|
||||
isFinished = true;
|
||||
}
|
||||
if (j != i + 1)
|
||||
{
|
||||
splittedCategories.push_back(categoryName.substr(i + 1, j - i - 1));
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
|
||||
auto itLast = lastSplittedCategories.begin();
|
||||
auto it1 = splittedCategories.begin();
|
||||
for (; itLast != lastSplittedCategories.end() && it1 != splittedCategories.end() && *itLast == *it1; ++itLast, ++it1) { }
|
||||
|
||||
for (; it1 != splittedCategories.end(); ++it1)
|
||||
{
|
||||
size_t level = 1;
|
||||
for (auto it2 = splittedCategories.begin(); it2 != it1; ++it2) { level++; }
|
||||
res += "\n\n" + generateRstTitle(*it1, int(level)) + "\n.. toctree::\n :maxdepth: 1\n\n";
|
||||
}
|
||||
|
||||
lastCategoryName = categoryName;
|
||||
lastSplittedCategories = splittedCategories;
|
||||
}
|
||||
|
||||
res += " Doc_BoxAlgorithm_" + transform(name) + "\n";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace PluginInspector
|
||||
} // namespace OpenViBE
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "ovpiCPluginObjectDescEnum.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace PluginInspector {
|
||||
class CPluginObjectDescEnumBoxTemplateGenerator final : public CPluginObjectDescEnum
|
||||
{
|
||||
public:
|
||||
|
||||
CPluginObjectDescEnumBoxTemplateGenerator(const Kernel::IKernelContext& ctx, const std::string& docTemplateDir)
|
||||
: CPluginObjectDescEnum(ctx), m_docTemplateDirectory(docTemplateDir) {}
|
||||
|
||||
bool callback(const Plugins::IPluginObjectDesc& pod) override;
|
||||
bool initialize();
|
||||
bool uninitialize();
|
||||
|
||||
private:
|
||||
// Return a string that correspond to the indexed categories under rst format
|
||||
std::string generateRstIndex(std::vector<std::pair<std::string, std::string>> categories) const;
|
||||
|
||||
protected:
|
||||
|
||||
std::string m_docTemplateDirectory;
|
||||
std::vector<std::pair<std::string, std::string>> m_categories;
|
||||
std::vector<std::pair<std::string, std::string>> m_deprecatedBoxesCategories;
|
||||
CIdentifier m_scenarioID = CIdentifier::undefined();
|
||||
Kernel::IScenario* m_scenario = nullptr;
|
||||
};
|
||||
} // namespace PluginInspector
|
||||
} // namespace OpenViBE
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
#include "ovpiCPluginObjectDescEnumBoxTemplateGenerator.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
|
||||
#include <fs/Files.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
//___________________________________________________________________//
|
||||
// //
|
||||
/*
|
||||
USAGE:
|
||||
plugin-inspector <plugin1 plugin2 ...>
|
||||
<--box-doc-directory dir>
|
||||
*/
|
||||
|
||||
std::vector<std::string> pluginFilestoLoad;
|
||||
|
||||
std::string docTemplateDir;
|
||||
bool ignoreMetaboxes = false;
|
||||
std::vector<std::string> metaboxExtensionsToLoad;
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
|
||||
{
|
||||
std::cout << "[ USAGE ]\n" << "plugin-inspector <plugin1 plugin2 ...>\n" << " <--box-doc-directory dir>\n";
|
||||
return 0;
|
||||
}
|
||||
std::cout << "Analyze parameter: [" << i << " : " << argv[i] << "]." << std::endl;
|
||||
|
||||
if (strcmp(argv[i], "--ignore-metaboxes") == 0) { ignoreMetaboxes = true; }
|
||||
else if (i < argc && strcmp(argv[i], "--box-doc-directory") == 0)
|
||||
{
|
||||
if (++i >= argc)
|
||||
{
|
||||
std::cout << "[ FAILED ] Error while parsing arguments: --box-doc-directory flag found but no path specified afterwards." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
docTemplateDir = argv[i];
|
||||
std::cout << "Templates will be generated in folder: [" << docTemplateDir << "]." << std::endl;
|
||||
}
|
||||
else if (i < argc) { pluginFilestoLoad.push_back(std::string(argv[i])); }
|
||||
}
|
||||
|
||||
OpenViBE::CKernelLoader kernelLoader;
|
||||
|
||||
std::cout << "[ INF ] Created kernel loader, trying to load kernel module" << std::endl;
|
||||
OpenViBE::CString errorMsg;
|
||||
#if defined TARGET_OS_Windows
|
||||
const OpenViBE::CString kernelFile = OpenViBE::Directories::getLibDir() + "/openvibe-kernel.dll";
|
||||
#elif defined TARGET_OS_Linux
|
||||
const OpenViBE::CString kernelFile = OpenViBE::Directories::getLibDir() + "/libopenvibe-kernel.so";
|
||||
#elif defined TARGET_OS_MacOS
|
||||
const OpenViBE::CString kernelFile = OpenViBE::Directories::getLibDir() + "/libopenvibe-kernel.dylib";
|
||||
#endif
|
||||
|
||||
if (!kernelLoader.load(kernelFile, &errorMsg)) { std::cout << "[ FAILED ] Error loading kernel (" << errorMsg << ")" << " from [" << kernelFile << "]\n"; }
|
||||
else
|
||||
{
|
||||
std::cout << "[ INF ] Kernel module loaded, trying to get kernel descriptor" << std::endl;
|
||||
OpenViBE::Kernel::IKernelDesc* kernelDesc = nullptr;
|
||||
kernelLoader.initialize();
|
||||
kernelLoader.getKernelDesc(kernelDesc);
|
||||
if (!kernelDesc) { std::cout << "[ FAILED ] No kernel descriptor" << std::endl; }
|
||||
else
|
||||
{
|
||||
std::cout << "[ INF ] Got kernel descriptor, trying to create kernel" << std::endl;
|
||||
|
||||
OpenViBE::Kernel::IKernelContext* ctx = kernelDesc->createKernel("plugin-inspector", OpenViBE::Directories::getDataDir() + "/kernel/openvibe.conf");
|
||||
if (!ctx) { std::cout << "[ FAILED ] No kernel created by kernel descriptor" << std::endl; }
|
||||
else
|
||||
{
|
||||
ctx->initialize();
|
||||
OpenViBE::Toolkit::initialize(*ctx);
|
||||
|
||||
OpenViBE::Kernel::IConfigurationManager& configurationManager = ctx->getConfigurationManager();
|
||||
|
||||
if (pluginFilestoLoad.empty()) { ctx->getPluginManager().addPluginsFromFiles(configurationManager.expand("${Kernel_Plugins}")); }
|
||||
else
|
||||
{
|
||||
for (const std::string& file : pluginFilestoLoad)
|
||||
{
|
||||
ctx->getPluginManager().addPluginsFromFiles(configurationManager.expand(OpenViBE::CString(file.c_str())));
|
||||
}
|
||||
}
|
||||
|
||||
ctx->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "[ INF ] Generate boxes templates in [" << docTemplateDir << "]\n";
|
||||
|
||||
OpenViBE::PluginInspector::CPluginObjectDescEnumBoxTemplateGenerator boxTemplateGenerator(*ctx, std::string(docTemplateDir));
|
||||
if (!boxTemplateGenerator.initialize())
|
||||
{
|
||||
std::cout << "[ FAILED ] Could not initialize boxTemplateGenerator" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
boxTemplateGenerator.enumeratePluginObjectDesc(OV_ClassId_Plugins_BoxAlgorithmDesc);
|
||||
|
||||
if (!ignoreMetaboxes)
|
||||
{
|
||||
ctx->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "[ INF ] Generate metaboxes templates in [" << docTemplateDir << "]\n";
|
||||
// Do not load the binary metaboxes as they would only be duplicated
|
||||
//ctx->getScenarioManager().unregisterScenarioImporter(OV_ScenarioImportContext_OnLoadMetaboxImport, ".mbb");
|
||||
configurationManager.addOrReplaceConfigurationToken("Kernel_Metabox", "${Path_Data}/metaboxes/");
|
||||
|
||||
ctx->getMetaboxManager().addMetaboxesFromFiles(configurationManager.expand("${Kernel_Metabox}"));
|
||||
|
||||
// Create a list of metabox descriptors from the Map provided by the MetaboxLoader and enumerate all algorithms within
|
||||
std::vector<const OpenViBE::Plugins::IPluginObjectDesc*> metaboxPluginObjectDescriptors;
|
||||
OpenViBE::CIdentifier id;
|
||||
while ((id = ctx->getMetaboxManager().getNextMetaboxObjectDescIdentifier(id)) != OpenViBE::CIdentifier::undefined())
|
||||
{
|
||||
metaboxPluginObjectDescriptors.push_back(ctx->getMetaboxManager().getMetaboxObjectDesc(id));
|
||||
}
|
||||
boxTemplateGenerator.enumeratePluginObjectDesc(metaboxPluginObjectDescriptors);
|
||||
}
|
||||
|
||||
if (!boxTemplateGenerator.uninitialize())
|
||||
{
|
||||
std::cout << "[ FAILED ] Could not uninitialize boxTemplateGenerator" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
ctx->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "Application terminated, releasing allocated objects \n";
|
||||
|
||||
OpenViBE::Toolkit::uninitialize(*ctx);
|
||||
|
||||
kernelDesc->releaseKernel(ctx);
|
||||
}
|
||||
}
|
||||
kernelLoader.uninitialize();
|
||||
kernelLoader.unload();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user