Commit e2fbd6e5 authored by Jussi Lindgren's avatar Jussi Lindgren

Applications: Designer will now inform of special box states on load

- Added a bash script to loop over boxes and list those that need an update
- Designer will now catch file open/load errors on main level
- Fixed some trivial compiler warnings
parent 35b0e934
......@@ -461,6 +461,30 @@ CInterfacedScenario::CInterfacedScenario(const IKernelContext& rKernelContext, C
m_pTooltip=GTK_WIDGET(gtk_builder_get_object(m_pBuilderTooltip, "tooltip"));
gtk_widget_set_name(m_pTooltip, "gtk-tooltips");
// Output a log message if any box of the scenario is in some special state
CIdentifier l_oBoxIdentifier = OV_UndefinedIdentifier;
boolean l_bWarningUpdate = false, l_bWarningDeprecated = false, l_bNoteUnstable = false;
while ((l_oBoxIdentifier = m_rScenario.getNextBoxIdentifier(l_oBoxIdentifier)) != OV_UndefinedIdentifier)
{
const IBox *l_pBox = m_rScenario.getBoxDetails(l_oBoxIdentifier);
const CBoxProxy l_oBoxProxy(m_rKernelContext, *l_pBox);
if (!l_bWarningUpdate && !l_oBoxProxy.isUpToDate())
{
m_rKernelContext.getLogManager() << LogLevel_Warning << "Scenario requires 'update' of some box(es). You need to replace these boxes or the scenario may not work correctly.\n";
l_bWarningUpdate = true;
}
if (!l_bWarningDeprecated && l_oBoxProxy.isDeprecated())
{
m_rKernelContext.getLogManager() << LogLevel_Warning << "Scenario has deprecated box(es). Please consider using other boxes instead.\n";
l_bWarningDeprecated = true;
}
if (!l_bNoteUnstable && l_oBoxProxy.isUnstable())
{
m_rKernelContext.getLogManager() << LogLevel_Debug << "Scenario has unstable box(es).\n";
l_bNoteUnstable = true;
}
}
}
CInterfacedScenario::~CInterfacedScenario(void)
......
......@@ -437,7 +437,7 @@ OpenViBE::boolean parse_arguments(int argc, char** argv, SConfiguration& rConfig
int go(int argc, char ** argv)
{
OpenViBE::boolean errorWhileLoadingScenario = false;
OpenViBE::boolean l_bErrorWhileLoadingScenario = false;
/*
{ 0, 0, 0, 0 },
{ 0, 16383, 16383, 16383 },
......@@ -636,6 +636,9 @@ int go(int argc, char ** argv)
}
}
}
OpenViBE::boolean l_bPlayRequested = false;
std::map < ECommandLineFlag, std::string >::iterator it;
for(it=l_oConfiguration.m_oFlag.begin(); it!=l_oConfiguration.m_oFlag.end(); it++)
{
......@@ -644,27 +647,29 @@ int go(int argc, char ** argv)
{
case CommandLineFlag_Open:
l_rLogManager << LogLevel_Info << "Opening scenario [" << CString(it->second.c_str()) << "]\n";
app.openScenario(it->second.c_str());
if (!app.openScenario(it->second.c_str()))
{
l_rLogManager << LogLevel_Error << "Scenario open error.\n";
l_bErrorWhileLoadingScenario = true;
}
break;
case CommandLineFlag_Play:
l_rLogManager << LogLevel_Info << "Opening and playing scenario [" << CString(it->second.c_str()) << "]\n";
if(app.openScenario(it->second.c_str()))
if(!app.openScenario(it->second.c_str()) || !app.playScenarioCB()) // lazy eval
{
if(!app.playScenarioCB())
{
errorWhileLoadingScenario = true;
}
l_rLogManager << LogLevel_Error << "Scenario open or load error with --play.\n";
l_bErrorWhileLoadingScenario = true;
}
l_bPlayRequested = true;
break;
case CommandLineFlag_PlayFast:
l_rLogManager << LogLevel_Info << "Opening and fast playing scenario [" << CString(it->second.c_str()) << "]\n";
if(app.openScenario(it->second.c_str()))
if(!app.openScenario(it->second.c_str()) || !app.forwardScenarioCB()) // lazy eval
{
if(!app.forwardScenarioCB())
{
errorWhileLoadingScenario = true;
}
l_rLogManager << LogLevel_Error << "Scenario open or load error with --play-fast.\n";
l_bErrorWhileLoadingScenario = true;
}
l_bPlayRequested = true;
break;
// case CommandLineFlag_Define:
// break;
......@@ -672,6 +677,12 @@ int go(int argc, char ** argv)
break;
}
}
if(!l_bPlayRequested && l_oConfiguration.m_eNoGui == CommandLineFlag_NoGui)
{
l_rLogManager << LogLevel_Info << "Switch --no-gui is enabled but no play operation was requested. Designer will exit automatically.\n";
}
if(app.m_vInterfacedScenario.empty())
{
app.newScenarioCB();
......@@ -697,6 +708,7 @@ int go(int argc, char ** argv)
{
l_pKernelContext->getLogManager() << LogLevel_Fatal << "Catched top level exception\n";
}
}
}
......@@ -710,7 +722,7 @@ int go(int argc, char ** argv)
l_oKernelLoader.uninitialize();
l_oKernelLoader.unload();
}
if(errorWhileLoadingScenario && l_oConfiguration.m_eNoGui == CommandLineFlag_NoGui)
if(l_bErrorWhileLoadingScenario && l_oConfiguration.m_eNoGui == CommandLineFlag_NoGui)
{
return -1;
}
......
......@@ -157,6 +157,7 @@ boolean CBox::setAlgorithmClassIdentifier(
CBoxListenerContext l_oContext(this->getKernelContext(), *this, 0xffffffff);
m_pBoxListener->uninitialize(l_oContext);
m_pBoxAlgorithmDescriptor->releaseBoxListener(m_pBoxListener);
m_pBoxListener = NULL;
}
const IPluginObjectDesc* l_pPluginObjectDescriptor=getKernelContext().getPluginManager().getPluginObjectDescCreating(rAlgorithmClassIdentifier);
......@@ -1020,6 +1021,7 @@ void CBox::clear(void)
CBoxListenerContext l_oContext(this->getKernelContext(), *this, 0xffffffff);
m_pBoxListener->uninitialize(l_oContext);
m_pBoxAlgorithmDescriptor->releaseBoxListener(m_pBoxListener);
m_pBoxListener = NULL;
}
m_pBoxAlgorithmDescriptor=NULL;
......
......@@ -89,7 +89,7 @@ boolean CAlgorithmClassifierOneVsAll::train(const IFeatureVectorSet& rFeatureVec
}
//And then we just change adapt the label for each feature vector but we don't copy them anymore
for(size_t l_iClassifierCounter = 0 ; l_iClassifierCounter < m_oSubClassifierList.size() ; ++l_iClassifierCounter )
for(uint32 l_iClassifierCounter = 0 ; l_iClassifierCounter < static_cast<uint32>(m_oSubClassifierList.size()) ; ++l_iClassifierCounter )
{
TParameterHandler < IMatrix* > ip_pFeatureVectorSet(m_oSubClassifierList[l_iClassifierCounter]->getInputParameter(OVTK_Algorithm_Classifier_InputParameterId_FeatureVectorSet));
ip_pFeatureVectorSet = (IMatrix*)ip_pFeatureVectorSetReference;
......@@ -121,7 +121,7 @@ boolean CAlgorithmClassifierOneVsAll::classify(const IFeatureVector& rFeatureVec
const uint32 l_ui32FeatureVectorSize=rFeatureVector.getSize();
for(uint64 l_iClassifierCounter = 0 ; l_iClassifierCounter < m_oSubClassifierList.size() ; ++l_iClassifierCounter )
for(uint32 l_iClassifierCounter = 0 ; l_iClassifierCounter < static_cast<uint32>(m_oSubClassifierList.size()) ; ++l_iClassifierCounter )
{
IAlgorithmProxy* l_pSubClassifier = this->m_oSubClassifierList[l_iClassifierCounter];
TParameterHandler < IMatrix* > ip_pFeatureVector(l_pSubClassifier->getInputParameter(OVTK_Algorithm_Classifier_InputParameterId_FeatureVector));
......
#!/bin/bash
#
# This script tries to locate boxes in scenarios which need to be updated
#
# Assumes openvibe is compiled and installed to dist/, and that we are in test/
#
SYSTEM=`uname -o`
if [ $SYSTEM == "Cygwin" ]; then
EXT="cmd"
else
EXT="sh"
fi
pushd .. >/dev/null
echo Scenarios requiring update:
find -iname "*xml" | grep "box-tutorials/\|test/\|bci-examples/" | grep -v dist | while read FN; do
dist/openvibe-designer.$EXT --no-session-management --no-pause --no-gui --open "$FN" | grep -q -E ".*WARNING.*Scenario requires.*update.*box"
if [ $? == 0 ]; then
echo $FN
fi
done
popd >/dev/null
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment