Commit 1082b25b authored by MONSEIGNE Thibaut's avatar MONSEIGNE Thibaut

Fix: Coding Rules First Fat Roughing Reformat Code

parent e663544f
......@@ -25,10 +25,7 @@ CTrainerApplication::CTrainerApplication() :
bool CTrainerApplication::setup(IKernelContext* poKernelContext)
{
if (!CApplication::setup(poKernelContext))
{
return false;
}
if (!CApplication::setup(poKernelContext)) { return false; }
(*m_poLogManager) << LogLevel_Debug << " * CTrainerApplication::setup()\n";
......
......@@ -58,10 +58,7 @@ CImpactApplication::~CImpactApplication()
bool CImpactApplication::setup(IKernelContext* poKernelContext)
{
if (!CApplication::setup(poKernelContext))
{
return false;
}
if (!CApplication::setup(poKernelContext)) { return false; }
IConfigurationManager* l_poConfigurationManager = &(m_poKernelContext->getConfigurationManager());
......
......@@ -31,10 +31,7 @@ CLogListenerFileBuffered::~CLogListenerFileBuffered()
bool CLogListenerFileBuffered::isActive(ELogLevel eLogLevel)
{
map<ELogLevel, bool>::iterator itLogLevel = m_vActiveLevel.find(eLogLevel);
if (itLogLevel == m_vActiveLevel.end())
{
return true;
}
if (itLogLevel == m_vActiveLevel.end()) { return true; }
return itLogLevel->second;
}
......
......@@ -69,10 +69,7 @@ bool parse_arguments(int argc, char** argv, SConfiguration& rConfiguration)
}
rConfiguration.m_bLoadPluginsFromPaths = true;
}
else
{
return false;
}
else { return false; }
}
// Configuration path
else if (*it == "-c")
......@@ -82,10 +79,7 @@ bool parse_arguments(int argc, char** argv, SConfiguration& rConfiguration)
rConfiguration.m_bConfigPathOverload = true;
rConfiguration.m_sConfigPath = *++it;
}
else
{
return false;
}
else { return false; }
}
// List path
else if (*it == "-l")
......@@ -108,10 +102,7 @@ bool parse_arguments(int argc, char** argv, SConfiguration& rConfiguration)
rConfiguration.m_bKernelPathOverload = true;
rConfiguration.m_sKernelPath = *++it;
}
else
{
return false;
}
else { return false; }
}
// Dump path
else if (*it == "-d")
......@@ -121,10 +112,7 @@ bool parse_arguments(int argc, char** argv, SConfiguration& rConfiguration)
rConfiguration.m_bDumpPathOverload = true;
rConfiguration.m_sDumpPath = *++it;
}
else
{
return false;
}
else { return false; }
}
}
......
......@@ -358,10 +358,7 @@ namespace OpenViBEAcquisitionServer
* \note Default implementation always returns false, meaning that no flag is set
*/
virtual bool isFlagSet(
const EDriverFlag eFlag) const
{
return false;
}
const EDriverFlag eFlag) const { return false; }
//@}
/** \name Driver configuration */
......
......@@ -72,10 +72,7 @@ CConfigurationBioSemiActiveTwo::CConfigurationBioSemiActiveTwo(const char* sGtkB
bool CConfigurationBioSemiActiveTwo::preConfigure()
{
if(!CConfigurationBuilder::preConfigure())
{
return false;
}
if(!CConfigurationBuilder::preConfigure()) { return false; }
// deduced from connection to device, cannot be edited.
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(m_pBuilderConfigureInterface, "combobox_sampling_frequency")), false);
......@@ -149,10 +146,7 @@ bool CConfigurationBioSemiActiveTwo::postConfigure()
m_rUseEXChannels = ::gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( gtk_builder_get_object(m_pBuilderConfigureInterface, "checkbutton_ex_channel") ) ) ? true : false;
}
if(!CConfigurationBuilder::postConfigure())
{
return false;
}
if(!CConfigurationBuilder::postConfigure()) { return false; }
return true;
}
......
......@@ -141,10 +141,7 @@ gint information_window_callback(void* pInformationWindow)
SInformationWindow* l_pInformationWindow = reinterpret_cast<SInformationWindow*>(pInformationWindow);
std::lock_guard<std::mutex> l_lock(reinterpret_cast<SInformationWindow*>(pInformationWindow)->m_oMutex);
// If nothing changed, directly return from the callback
if(!l_pInformationWindow->m_bIsChanged)
{
return TRUE;
}
if(!l_pInformationWindow->m_bIsChanged) { return TRUE; }
if(l_pInformationWindow->m_bIsAcquisitionEnded)
{
// If the acquisition is ended, delete the window
......@@ -565,10 +562,7 @@ bool CDriverBioSemiActiveTwo::uninitialize()
//___________________________________________________________________//
// //
bool CDriverBioSemiActiveTwo::isConfigurable()
{
return true;
}
bool CDriverBioSemiActiveTwo::isConfigurable() { return true; }
bool CDriverBioSemiActiveTwo::configure()
{
......
......@@ -75,10 +75,7 @@ namespace
bool CConfigurationBrainProductsActiCHamp::preConfigure()
{
if (!CConfigurationBuilder::preConfigure())
{
return false;
}
if (!CConfigurationBuilder::preConfigure()) { return false; }
m_pImageErrorIcon = GTK_WIDGET(::gtk_builder_get_object(m_pBuilderConfigureInterface, "image_error_icon"));
m_pLabelErrorMessage = GTK_LABEL(::gtk_builder_get_object(m_pBuilderConfigureInterface, "label_error_message"));
......@@ -176,10 +173,7 @@ bool CConfigurationBrainProductsActiCHamp::postConfigure()
| (gtk_toggle_button_get_active(m_pToggleModule5) ? 0x20 : 0x00);
}
if (!CConfigurationBuilder::postConfigure())
{
return false;
}
if (!CConfigurationBuilder::postConfigure()) { return false; }
return true;
}
......
......@@ -822,10 +822,7 @@ bool CDriverBrainProductsActiCHamp::uninitialize()
//___________________________________________________________________//
// //
bool CDriverBrainProductsActiCHamp::isConfigurable()
{
return true;
}
bool CDriverBrainProductsActiCHamp::isConfigurable() { return true; }
bool CDriverBrainProductsActiCHamp::configure()
{
......
......@@ -120,10 +120,7 @@ CConfigurationBrainProductsBrainampSeries::CConfigurationBrainProductsBrainampSe
bool CConfigurationBrainProductsBrainampSeries::preConfigure()
{
if (!CConfigurationBuilder::preConfigure())
{
return false;
}
if (!CConfigurationBuilder::preConfigure()) { return false; }
GtkComboBox* l_pComboBoxDevice = GTK_COMBO_BOX(::gtk_builder_get_object(m_pBuilderConfigureInterface, "combobox_device"));
GtkComboBox* l_pComboBoxLowPass = GTK_COMBO_BOX(::gtk_builder_get_object(m_pBuilderConfigureInterface, "combobox_lowpass_filter"));
......@@ -201,10 +198,7 @@ bool CConfigurationBrainProductsBrainampSeries::postConfigure()
m_reImpedance = EParameter(gtk_combo_box_get_active(l_pComboBoxImpedance));
}
if (!CConfigurationBuilder::postConfigure())
{
return false;
}
if (!CConfigurationBuilder::postConfigure()) { return false; }
return true;
}
......
......@@ -325,10 +325,7 @@ bool CDriverBrainProductsBrainampSeries::initialize(
m_rDriverContext.getLogManager() << LogLevel_Trace << (m_rDriverContext.isImpedanceCheckRequested() ? "Impedance will be checked" : "Impedance won't be checked") << "\n";
if (m_rDriverContext.isImpedanceCheckRequested())
{
if (!this->startImpedanceCheck())
{
return false;
}
if (!this->startImpedanceCheck()) { return false; }
}
return true;
......@@ -343,10 +340,7 @@ bool CDriverBrainProductsBrainampSeries::start()
if (m_rDriverContext.isImpedanceCheckRequested())
{
if (!this->stopImpedanceCheck())
{
return false;
}
if (!this->stopImpedanceCheck()) { return false; }
}
// -- Configures pull up/down for triggers
......@@ -542,10 +536,7 @@ bool CDriverBrainProductsBrainampSeries::stop()
if (m_rDriverContext.isImpedanceCheckRequested())
{
if (!this->startImpedanceCheck())
{
return false;
}
if (!this->startImpedanceCheck()) { return false; }
}
return true;
......@@ -560,10 +551,7 @@ bool CDriverBrainProductsBrainampSeries::uninitialize()
if (m_rDriverContext.isImpedanceCheckRequested())
{
if (!this->stopImpedanceCheck())
{
return false;
}
if (!this->stopImpedanceCheck()) { return false; }
}
// -- Deletes device setup object
......@@ -652,10 +640,7 @@ bool CDriverBrainProductsBrainampSeries::stopImpedanceCheck()
//___________________________________________________________________//
// //
bool CDriverBrainProductsBrainampSeries::isConfigurable()
{
return true;
}
bool CDriverBrainProductsBrainampSeries::isConfigurable() { return true; }
bool CDriverBrainProductsBrainampSeries::configure()
......@@ -692,10 +677,7 @@ bool CDriverBrainProductsBrainampSeries::getDeviceDetails(const uint32 ui32Index
// -- Opens device
void* l_pDevice = ::CreateFile(l_sDeviceName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, nullptr);
if (l_pDevice == INVALID_HANDLE_VALUE)
{
return false;
}
if (l_pDevice == INVALID_HANDLE_VALUE) { return false; }
// -- Gets amplifiers type
......
......@@ -32,15 +32,9 @@ CHeaderAdapterBrainProductsBrainampSeries::CHeaderAdapterBrainProductsBrainampSe
: CHeaderAdapter(rAdaptedHeader)
, m_peChannelSelected(peChannelSelected) {}
bool CHeaderAdapterBrainProductsBrainampSeries::setChannelCount(const uint32_t ui32ChannelCount)
{
return false;
}
bool CHeaderAdapterBrainProductsBrainampSeries::setChannelCount(const uint32_t ui32ChannelCount) { return false; }
bool CHeaderAdapterBrainProductsBrainampSeries::setChannelName(const uint32_t ui32ChannelIndex, const char* sChannelName)
{
return false;
}
bool CHeaderAdapterBrainProductsBrainampSeries::setChannelName(const uint32_t ui32ChannelIndex, const char* sChannelName) { return false; }
uint32_t CHeaderAdapterBrainProductsBrainampSeries::getChannelCount() const
{
......
......@@ -80,10 +80,7 @@ CConfigurationBrainProductsLiveAmp::CConfigurationBrainProductsLiveAmp(
bool CConfigurationBrainProductsLiveAmp::preConfigure()
{
if (! CConfigurationBuilder::preConfigure())
{
return false;
}
if (! CConfigurationBuilder::preConfigure()) { return false; }
m_tSerialNumber = GTK_ENTRY (::gtk_builder_get_object(m_pBuilderConfigureInterface, "entrySerialNr"));
m_pComboBoxPhysicalSampleRate = GTK_COMBO_BOX(::gtk_builder_get_object(m_pBuilderConfigureInterface, "combobox_sampling_frequency"));
......@@ -156,10 +153,7 @@ bool CConfigurationBrainProductsLiveAmp::postConfigure()
m_rBadImpedanceLimit = uint32_t(gtk_spin_button_get_value(m_pSpinButtonBadImpedanceLimit));
}
if (! CConfigurationBuilder::postConfigure()) // normal header is filled (Subject ID, Age, Gender, channels, sampling frequency), ressources are realesed
{
return false;
}
if (! CConfigurationBuilder::postConfigure()) { return false; } // normal header is filled (Subject ID, Age, Gender, channels, sampling frequency), ressources are realesed
return true;
}
......
......@@ -460,10 +460,7 @@ bool CDriverBrainProductsLiveAmp::configure()
m_sSerialNumber,
m_bUseBipolarChannels);
if (!m_oConfiguration.configure(m_oHeader))
{
return false;
}
if (!m_oConfiguration.configure(m_oHeader)) { return false; }
// update sampling rate
if (sampRateIndex >= 0 && sampRateIndex < m_vSamplingRatesArray.size())
......
......@@ -145,10 +145,7 @@ CConfigurationBrainProductsVAmp::CConfigurationBrainProductsVAmp(IDriverContext&
bool CConfigurationBrainProductsVAmp::preConfigure()
{
if(!CConfigurationBuilder::preConfigure())
{
return false;
}
if(!CConfigurationBuilder::preConfigure()) { return false; }
// Finds all the widgets
m_pDialogFastModeSettings=GTK_WIDGET(gtk_builder_get_object(m_pBuilderConfigureInterface, "dialog_fast_mode_settings"));
......@@ -407,10 +404,7 @@ bool CConfigurationBrainProductsVAmp::postConfigure()
//remove the idle function for the service check
if(m_giIdleID != 0) g_source_remove(m_giIdleID);
if(!CConfigurationBuilder::postConfigure()) // normal header is filled, ressources are realesed
{
return false;
}
if(!CConfigurationBuilder::postConfigure()) // normal header is filled, ressources are realesed { return false; }
// Force sampling frequency
#if 0
......
......@@ -347,15 +347,9 @@ bool CDriverBrainProductsVAmp::initialize(
bool CDriverBrainProductsVAmp::start()
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "START called.\n";
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
if(m_rDriverContext.isStarted())
{
return false;
}
if(m_rDriverContext.isStarted()) { return false; }
m_bFirstStart = true;
uint32 l_uint32_tErrorCode = FA_ERR_OK;
......@@ -394,10 +388,7 @@ bool CDriverBrainProductsVAmp::loop()
{
uint32_t i, j;
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
t_faDataModel16 l_DataBufferVAmp16; // buffer for the next block in normal mode
uint32 l_uint32_tReadLengthVAmp16 = sizeof(t_faDataModel16);
......@@ -713,15 +704,9 @@ bool CDriverBrainProductsVAmp::loop()
bool CDriverBrainProductsVAmp::stop()
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "STOP called.\n";
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
if(!m_rDriverContext.isStarted())
{
return false;
}
if(!m_rDriverContext.isStarted()) { return false; }
if(m_rDriverContext.isImpedanceCheckRequested())
{
......@@ -743,15 +728,9 @@ bool CDriverBrainProductsVAmp::stop()
bool CDriverBrainProductsVAmp::uninitialize()
{
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
if(m_rDriverContext.isStarted())
{
return false;
}
if(m_rDriverContext.isStarted()) { return false; }
uint32 l_uint32_tErrorCode = faStop(m_oHeader.getDeviceId());
if (l_uint32_tErrorCode != FA_ERR_OK)
......@@ -789,19 +768,13 @@ bool CDriverBrainProductsVAmp::uninitialize()
//___________________________________________________________________//
// //
bool CDriverBrainProductsVAmp::isConfigurable()
{
return true;
}
bool CDriverBrainProductsVAmp::isConfigurable() { return true; }
bool CDriverBrainProductsVAmp::configure()
{
CConfigurationBrainProductsVAmp m_oConfiguration(m_rDriverContext, OpenViBE::Directories::getDataDir() + "/applications/acquisition-server/interface-BrainProducts-VAmp.ui", &m_oHeader, m_bAcquireAuxiliaryAsEEG, m_bAcquireTriggerAsEEG); // the specific header is passed into the specific configuration
if(!m_oConfiguration.configure(*(m_oHeader.getBasicHeader()))) // the basic configure will use the basic header
{
return false;
}
if(!m_oConfiguration.configure(*(m_oHeader.getBasicHeader()))) { return false; } // the basic configure will use the basic header
m_oSettings.save();
......
......@@ -290,10 +290,7 @@ bool CDriverEGIAmpServer::uninitialize()
//___________________________________________________________________//
// //
bool CDriverEGIAmpServer::isConfigurable()
{
return true;
}
bool CDriverEGIAmpServer::isConfigurable() { return true; }
bool CDriverEGIAmpServer::configure()
{
......
......@@ -24,10 +24,7 @@ CConfigurationEmotivEPOC::CConfigurationEmotivEPOC(IDriverContext& rDriverContex
bool CConfigurationEmotivEPOC::preConfigure()
{
if(! CConfigurationBuilder::preConfigure())
{
return false;
}
if(! CConfigurationBuilder::preConfigure()) { return false; }
::GtkToggleButton* l_pCheckbuttonGyro = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilderConfigureInterface, "checkbutton_gyro"));
gtk_toggle_button_set_active(l_pCheckbuttonGyro,m_rUseGyroscope);
......@@ -70,10 +67,7 @@ bool CConfigurationEmotivEPOC::postConfigure()
}
if(! CConfigurationBuilder::postConfigure()) // normal header is filled, ressources are realesed
{
return false;
}
if(! CConfigurationBuilder::postConfigure()) // normal header is filled, ressources are realesed { return false; }
return true;
}
......
......@@ -98,10 +98,7 @@ bool CDriverEmotivEPOC::restoreState()
bool CDriverEmotivEPOC::buildPath()
{
char * l_sPath = getenv("PATH");
if(l_sPath == NULL)
{
return false;
}
if(l_sPath == NULL) { return false; }
m_sOldPath = l_sPath;
......@@ -186,10 +183,7 @@ bool CDriverEmotivEPOC::initialize(
// and http://www.bci2000.org/wiki/index.php/Contributions:Emotiv ) suggested
// that the units from the device are in microvolts, but with a typical DC offset around 4000.
// Hard to find official source.
for(uint32_t c=0;c<14;c++)
{
m_oHeader.setChannelUnits(c, OVTK_UNIT_Volts, OVTK_FACTOR_Micro);
}
for(uint32_t c=0;c<14;c++) { m_oHeader.setChannelUnits(c, OVTK_UNIT_Volts, OVTK_FACTOR_Micro); }
if(m_bUseGyroscope)
{
// Even less sure about the units of these, leaving as unspecified.
......@@ -302,15 +296,9 @@ bool CDriverEmotivEPOC::initialize(
bool CDriverEmotivEPOC::start()
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "START called.\n";
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
if(m_rDriverContext.isStarted())
{
return false;
}
if(m_rDriverContext.isStarted()) { return false; }
m_tDataHandle = IEE_DataCreate();
//float l_fBufferSizeInSeconds = (float32)m_ui32SampleCountPerSentBlock/(float32)m_oHeader.getSamplingFrequency();
......@@ -327,10 +315,7 @@ bool CDriverEmotivEPOC::start()
bool CDriverEmotivEPOC::loop()
{
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
if(m_rDriverContext.isStarted())
{
......@@ -425,15 +410,9 @@ bool CDriverEmotivEPOC::loop()
bool CDriverEmotivEPOC::stop()
{
m_rDriverContext.getLogManager() << LogLevel_Trace << "STOP called.\n";
if(!m_rDriverContext.isConnected())
{
return false;
}
if(!m_rDriverContext.isConnected()) { return false; }
if(!m_rDriverContext.isStarted())
{
return false;
}
if(!m_rDriverContext.isStarted()) { return false; }
IEE_DataFree(m_tDataHandle);
......@@ -457,10 +436,7 @@ bool CDriverEmotivEPOC::uninitialize()
//___________________________________________________________________//
// //
bool CDriverEmotivEPOC::isConfigurable()
{
return true;
}
bool CDriverEmotivEPOC::isConfigurable() { return true; }
bool CDriverEmotivEPOC::configure()
{
......@@ -468,10 +444,7 @@ bool CDriverEmotivEPOC::configure()
OpenViBE::Directories::getDataDir() + "/applications/acquisition-server/interface-Emotiv-EPOC.ui",
m_bUseGyroscope, m_sPathToEmotivSDK, m_ui32UserID);
if(!m_oConfiguration.configure(m_oHeader))
{
return false;
}
if(!m_oConfiguration.configure(m_oHeader)) { return false; }
m_oSettings.save();
......
......@@ -16,10 +16,7 @@ CConfigurationDriverGenericOscillator::CConfigurationDriverGenericOscillator(IDr
bool CConfigurationDriverGenericOscillator::preConfigure()
{
if (!CConfigurationBuilder::preConfigure())
{
return false;
}
if (!CConfigurationBuilder::preConfigure()) { return false; }
GtkToggleButton* l_pToggleSendPeriodicStimulations = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilderConfigureInterface, "checkbutton_send_periodic_stimulations"));
GtkSpinButton* l_pStimulationInterval = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderConfigureInterface, "spinbutton_stimulation_interval"));
......@@ -43,10 +40,7 @@ bool CConfigurationDriverGenericOscillator::postConfigure()
m_rStimulationInterval = gtk_spin_button_get_value(l_pStimulationInterval);
}
if (!CConfigurationBuilder::postConfigure())
{
return false;
}
if (!CConfigurationBuilder::postConfigure()) { return false; }
return true;
}
......@@ -63,10 +63,7 @@ bool CDriverGenericOscillator::initialize(
if (m_rDriverContext.isConnected()) { return false; }
if (!m_oHeader.isChannelCountSet()
|| !m_oHeader.isSamplingFrequencySet())
{
return false;
}
|| !m_oHeader.isSamplingFrequencySet()) { return false; }