Commit 5340af58 authored by MONSEIGNE Thibaut's avatar MONSEIGNE Thibaut

Fix: Coding Rules Fat Roughing Modernize

parent c888b219
......@@ -13,7 +13,7 @@ namespace OpenViBESSVEP
CCommandShipControl(CShooterApplication* poApplication);
~CCommandShipControl() {};
void execute(int iButton, int iState);
void execute(int iButton, int iState) override;
};
}
......
......@@ -14,8 +14,8 @@ namespace OpenViBESSVEP
CCommandTargetControl(CShooterApplication* poApplication);
~CCommandTargetControl() {};
void execute(int iButton, int iState);
void processFrame();
void execute(int iButton, int iState) override;
void processFrame() override;
private:
CVRPNServer* m_poVRPNServer;
......
......@@ -9,7 +9,7 @@
using namespace Ogre;
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace Kernel;
using namespace OpenViBESSVEP;
#if !((CEGUI_VERSION_MAJOR > 0) || (CEGUI_VERSION_MINOR >= 8))
......@@ -22,7 +22,7 @@ namespace CEGUI
CShooterApplication::CShooterApplication()
: CApplication(),
m_bTargetRequest(false),
m_poShip(NULL) {}
m_poShip(nullptr) {}
CShooterApplication::~CShooterApplication()
{
......@@ -30,7 +30,7 @@ CShooterApplication::~CShooterApplication()
delete m_poShip;
}
bool CShooterApplication::setup(OpenViBE::Kernel::IKernelContext* poKernelContext)
bool CShooterApplication::setup(IKernelContext* poKernelContext)
{
if (!CApplication::setup(poKernelContext))
{
......@@ -105,7 +105,7 @@ void CShooterApplication::processFrame(uint32_t ui32CurrentFrame)
void CShooterApplication::addTarget(uint32_t ui32TargetPosition)
{
m_oTargets.push_back(CShooterTarget::createTarget(Ogre::Radian(Math::PI * 2 / 360 * 45 * ui32TargetPosition)));
m_oTargets.push_back(CShooterTarget::createTarget(Radian(Math::PI * 2 / 360 * 45 * ui32TargetPosition)));
}
void CShooterApplication::startExperiment()
......
......@@ -19,14 +19,14 @@ namespace OpenViBESSVEP
CShooterApplication();
~CShooterApplication();
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext);
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
CStarShip* getShip()
{
return m_poShip;
}
void startExperiment();
void startExperiment() override;
void addTarget(uint32_t ui32TargetPosition);
......@@ -35,7 +35,7 @@ namespace OpenViBESSVEP
private:
bool m_bActive;
void processFrame(uint32_t ui32CurrentFrame);
void processFrame(uint32_t ui32CurrentFrame) override;
CEGUI::Window* m_poInstructionsReady;
......
......@@ -15,10 +15,10 @@ void CShooterTarget::initialize(CBasicPainter* poPainter, Ogre::SceneNode* poPar
CShooterTarget* CShooterTarget::createTarget(Ogre::Radian rAngle)
{
if (m_poPainter == NULL)
if (m_poPainter == nullptr)
{
std::cerr << "The CShooterTarget was not initialized" << std::endl;
return NULL;
return nullptr;
}
return new CShooterTarget(rAngle);
......
......@@ -11,7 +11,7 @@
using namespace OpenViBESSVEP;
using namespace Ogre;
CStarShip::CStarShip(CApplication* poApplication, Ogre::SceneNode* poParentNode, Ogre::Real rRadius, std::vector<std::pair<uint32_t, uint32_t>>* pFrequencies) :
CStarShip::CStarShip(CApplication* poApplication, SceneNode* poParentNode, Real rRadius, std::vector<std::pair<uint32_t, uint32_t>>* pFrequencies) :
m_rCurrentAngle(0),
m_iCurrentRotationCount(0),
m_bIsShooting(false)
......@@ -19,7 +19,7 @@ CStarShip::CStarShip(CApplication* poApplication, Ogre::SceneNode* poParentNode,
// get configuration and controlling objects
OpenViBE::Kernel::IConfigurationManager* l_poConfigurationManager = poApplication->getConfigurationManager();
CBasicPainter* l_poPainter = poApplication->getPainter();
m_rAngularSpeed = (Ogre::Real)l_poConfigurationManager->expandAsFloat("${SSVEP_ShipAngularSpeed}", Math::PI / 60.0f);
m_rAngularSpeed = (Real)l_poConfigurationManager->expandAsFloat("${SSVEP_ShipAngularSpeed}", Math::PI / 60.0f);
poApplication->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "Ship Angluar Speed : " << m_rAngularSpeed << "\n";
ColourValue l_oLightColour = ColourValue(
......@@ -46,7 +46,7 @@ CStarShip::CStarShip(CApplication* poApplication, Ogre::SceneNode* poParentNode,
SceneNode* l_poDrawnObjectNode;
MovableObject* l_poDrawnObject;
// Ogre::RealRect l_oWingRectangle = { - rRadius * 0.4f, rRadius * 0.4f, rRadius * 0.4f, -rRadius * 0.4f };
Ogre::RealRect l_oWingRectangle(-rRadius * 0.4f, rRadius * 0.4f, rRadius * 0.4f, -rRadius * 0.4f);
RealRect l_oWingRectangle(-rRadius * 0.4f, rRadius * 0.4f, rRadius * 0.4f, -rRadius * 0.4f);
// paint the cannon
......@@ -135,9 +135,9 @@ void CStarShip::processFrame(uint32_t ui32CurrentFrame)
if (m_iCurrentRotationCount != 0)
{
m_poShipNode->roll(Ogre::Radian(m_rAngularSpeed * SIGN( m_iCurrentRotationCount )));
m_poShipNode->roll(Radian(m_rAngularSpeed * SIGN( m_iCurrentRotationCount )));
m_rCurrentAngle += Ogre::Radian(m_rAngularSpeed * SIGN( m_iCurrentRotationCount ));
m_rCurrentAngle += Radian(m_rAngularSpeed * SIGN( m_iCurrentRotationCount ));
m_iCurrentRotationCount -= SIGN( m_iCurrentRotationCount );
}
......@@ -174,9 +174,9 @@ void CStarShip::shoot()
m_poShotNode->setVisible(true);
}
std::pair<Ogre::Real, Ogre::Real> CStarShip::getShotCoordinates()
std::pair<Real, Real> CStarShip::getShotCoordinates()
{
return std::make_pair(-Ogre::Math::Sin(m_rCurrentAngle) * m_rShotDistance, Ogre::Math::Cos(m_rCurrentAngle) * m_rShotDistance);
return std::make_pair(-Math::Sin(m_rCurrentAngle) * m_rShotDistance, Math::Cos(m_rCurrentAngle) * m_rShotDistance);
}
#endif
......@@ -13,7 +13,7 @@ namespace OpenViBESSVEP
CCommandReceiveTarget(CApplication* poApplication);
~CCommandReceiveTarget() {};
void execute(int iButton, int iState);
void execute(int iButton, int iState) override;
};
}
......
......@@ -8,7 +8,7 @@
using namespace Ogre;
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace Kernel;
using namespace OpenViBESSVEP;
#if !((CEGUI_VERSION_MAJOR > 0) || (CEGUI_VERSION_MINOR >= 8))
......@@ -21,9 +21,9 @@ namespace CEGUI
CTrainerApplication::CTrainerApplication() :
CApplication(),
m_bActive(false),
m_poInstructionsReady(NULL) {}
m_poInstructionsReady(nullptr) {}
bool CTrainerApplication::setup(OpenViBE::Kernel::IKernelContext* poKernelContext)
bool CTrainerApplication::setup(IKernelContext* poKernelContext)
{
if (!CApplication::setup(poKernelContext))
{
......@@ -105,7 +105,7 @@ void CTrainerApplication::addObject(CTrainerFlickeringObject* poObject)
void CTrainerApplication::setTarget(int32_t i32Target)
{
uint32_t l_ui32CurrentTime = (int32_t)(time(NULL) - m_ttStartTime);
uint32_t l_ui32CurrentTime = (int32_t)(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Target set to " << i32Target << "\n";
for (int32_t i = 0; i < int(m_oObjects.size()); i++)
......@@ -118,7 +118,7 @@ void CTrainerApplication::startExperiment()
{
CApplication::startExperiment();
m_ttStartTime = time(NULL);
m_ttStartTime = time(nullptr);
this->stopFlickering();
m_poInstructionsReady->setVisible(false);
......@@ -126,14 +126,14 @@ void CTrainerApplication::startExperiment()
void CTrainerApplication::startFlickering()
{
uint32_t l_ui32CurrentTime = (uint32_t)(time(NULL) - m_ttStartTime);
uint32_t l_ui32CurrentTime = (uint32_t)(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Starting Visual Stimulation\n";
m_bActive = true;
}
void CTrainerApplication::stopFlickering()
{
uint32_t l_ui32CurrentTime = (uint32_t)(time(NULL) - m_ttStartTime);
uint32_t l_ui32CurrentTime = (uint32_t)(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Stopping Visual Stimulation\n";
m_bActive = false;
......
......@@ -15,17 +15,17 @@ namespace OpenViBESSVEP
CTrainerApplication();
~CTrainerApplication() {};
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext);
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
void setTarget(int32_t i32Target);
void startExperiment();
void startFlickering();
void stopFlickering();
void startExperiment() override;
void startFlickering() override;
void stopFlickering() override;
private:
bool m_bActive;
void processFrame(uint32_t ui32CurrentFrame);
void processFrame(uint32_t ui32CurrentFrame) override;
void addObject(CTrainerFlickeringObject* target);
std::vector<CTrainerFlickeringObject*> m_oObjects;
......
......@@ -40,7 +40,7 @@ CTrainerFlickeringObject* CTrainerFlickeringObject::createTrainerFlickeringObjec
{
OpenViBE::Kernel::IConfigurationManager* l_poConfigurationManager = m_poApplication->getConfigurationManager();
if (m_poPainter != NULL)
if (m_poPainter != nullptr)
{
ColourValue l_oCurrentTargetColour = (l_i32TargetId == 0) ? m_oDarkColour : m_oLightColour;
......@@ -63,23 +63,23 @@ CTrainerFlickeringObject* CTrainerFlickeringObject::createTrainerFlickeringObjec
else
{
m_poApplication->getLogManager() << OpenViBE::Kernel::LogLevel_Fatal << "TrainerTarget object was not properly initialized\n";
return NULL;
return nullptr;
}
}
CTrainerFlickeringObject::CTrainerFlickeringObject(float f32PosX, float f32PosY, Ogre::ColourValue oColour, OpenViBE::uint8 ui8LitFrames, uint8_t ui8DarkFrames) :
CSSVEPFlickeringObject(NULL, ui8LitFrames, ui8DarkFrames)
CTrainerFlickeringObject::CTrainerFlickeringObject(float f32PosX, float f32PosY, ColourValue oColour, OpenViBE::uint8 ui8LitFrames, uint8_t ui8DarkFrames) :
CSSVEPFlickeringObject(nullptr, ui8LitFrames, ui8DarkFrames)
{
Ogre::SceneNode* l_poPointerNode;
SceneNode* l_poPointerNode;
Ogre::MovableObject* l_poLitObject;
Ogre::MovableObject* l_poDarkObject;
MovableObject* l_poLitObject;
MovableObject* l_poDarkObject;
m_poElementNode = m_poParentNode->createChildSceneNode();
m_poObjectNode = m_poElementNode->createChildSceneNode();
l_poPointerNode = m_poElementNode->createChildSceneNode();
Ogre::RealRect l_oRectangle(f32PosX - m_f32TargetWidth / 2, f32PosY + m_f32TargetHeight / 2, f32PosX + m_f32TargetWidth / 2, f32PosY - m_f32TargetHeight / 2);
RealRect l_oRectangle(f32PosX - m_f32TargetWidth / 2, f32PosY + m_f32TargetHeight / 2, f32PosX + m_f32TargetWidth / 2, f32PosY - m_f32TargetHeight / 2);
l_poLitObject = m_poPainter->paintRectangle(l_oRectangle, oColour);
......
......@@ -7,21 +7,21 @@
using namespace OpenViBE;
using namespace OpenViBESSVEP;
using namespace OpenViBE::Kernel;
using namespace Kernel;
#define MIN(a,b) ( a < b ? a : b )
CApplication::CApplication()
: m_bContinueRendering(true),
m_ui32CurrentFrame(0),
m_roGUIRenderer(NULL),
m_poSceneNode(NULL),
m_poPainter(NULL),
m_poRoot(NULL) {}
m_roGUIRenderer(nullptr),
m_poSceneNode(nullptr),
m_poPainter(nullptr),
m_poRoot(nullptr) {}
CApplication::~CApplication()
{
if (m_poPainter != NULL)
if (m_poPainter != nullptr)
{
(*m_poLogManager) << LogLevel_Debug << "- m_poPainter\n";
delete m_poPainter;
......@@ -32,7 +32,7 @@ CApplication::~CApplication()
it != m_oCommands.end(); ++it)
{
(*m_poLogManager) << LogLevel_Debug << "- ICommand\n";
if (*it != NULL)
if (*it != nullptr)
{
delete *it;
*it = nullptr;
......@@ -41,14 +41,14 @@ CApplication::~CApplication()
(*m_poLogManager) << LogLevel_Debug << "- m_poRoot\n";
if (m_poRoot != NULL)
if (m_poRoot != nullptr)
{
delete m_poRoot;
m_poRoot = nullptr;
}
}
bool CApplication::setup(OpenViBE::Kernel::IKernelContext* poKernelContext)
bool CApplication::setup(IKernelContext* poKernelContext)
{
m_poKernelContext = poKernelContext;
m_poLogManager = &(m_poKernelContext->getLogManager());
......@@ -58,7 +58,7 @@ bool CApplication::setup(OpenViBE::Kernel::IKernelContext* poKernelContext)
(*m_poLogManager) << LogLevel_Debug << " * CApplication::setup()\n";
// Plugin config path setup
OpenViBE::CString l_sPluginsPath = l_poConfigurationManager->expand("${Kernel_3DVisualizationOgrePlugins}");
CString l_sPluginsPath = l_poConfigurationManager->expand("${Kernel_3DVisualizationOgrePlugins}");
// Create LogManager to stop Ogre flooding the console and creating random files
(*m_poLogManager) << LogLevel_Info << "Ogre plugins path is " << l_sPluginsPath << "\n";
......@@ -255,9 +255,9 @@ void CApplication::processFrame(uint32_t ui32CurrentFrame)
void CApplication::setupResources()
{
Ogre::ResourceGroupManager::getSingleton().createResourceGroup("SSVEP");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation((OpenViBE::Directories::getDataDir() + "/applications/ssvep-demo/resources").toASCIIString(), "FileSystem", "SSVEP");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation((OpenViBE::Directories::getDataDir() + "/applications/ssvep-demo/resources/trainer").toASCIIString(), "FileSystem", "SSVEPTrainer");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation((OpenViBE::Directories::getDataDir() + "/applications/ssvep-demo/resources/gui").toASCIIString(), "FileSystem", "CEGUI");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation((Directories::getDataDir() + "/applications/ssvep-demo/resources").toASCIIString(), "FileSystem", "SSVEP");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation((Directories::getDataDir() + "/applications/ssvep-demo/resources/trainer").toASCIIString(), "FileSystem", "SSVEPTrainer");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation((Directories::getDataDir() + "/applications/ssvep-demo/resources/gui").toASCIIString(), "FileSystem", "CEGUI");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("SSVEP");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("SSVEPTrainer");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("CEGUI");
......
......@@ -105,8 +105,8 @@ namespace OpenViBESSVEP
virtual void processFrame(uint32_t ui32CurrentFrame);
bool frameRenderingQueued(const Ogre::FrameEvent& evt);
bool frameStarted(const Ogre::FrameEvent& evt);
bool frameRenderingQueued(const Ogre::FrameEvent& evt) override;
bool frameStarted(const Ogre::FrameEvent& evt) override;
bool configure();
void setupResources();
......
......@@ -20,17 +20,17 @@ CBasicPainter::CBasicPainter(CApplication* poApplication) :
#if (OGRE_VERSION_MAJOR > 1) || ((OGRE_VERSION_MAJOR == 1) && (OGRE_VERSION_MINOR >= 9))
// on Ogre 1.9, overlay system needs to be manually created
Ogre::OverlaySystem* pOverlaySystem = OGRE_NEW Ogre::OverlaySystem();
OverlaySystem* pOverlaySystem = OGRE_NEW OverlaySystem();
m_poSceneManager->addRenderQueueListener(pOverlaySystem);
#endif
m_poOverlayManager = Ogre::OverlayManager::getSingletonPtr();
m_poOverlayManager = OverlayManager::getSingletonPtr();
(m_poApplication->getLogManager()) << LogLevel_Debug << " + Creating OverlayManager\n";
Overlay* l_poOverlay = m_poOverlayManager->create("TextOverlay");
m_poOverlayContainer = static_cast<Ogre::OverlayContainer*>(m_poOverlayManager->createOverlayElement("Panel", "TextContainer"));
m_poOverlayContainer = static_cast<OverlayContainer*>(m_poOverlayManager->createOverlayElement("Panel", "TextContainer"));
m_poOverlayContainer->setDimensions(1, 1);
m_poOverlayContainer->setPosition(0, 0);
......@@ -39,7 +39,7 @@ CBasicPainter::CBasicPainter(CApplication* poApplication) :
}
ManualObject* CBasicPainter::paintRectangle(Ogre::RealRect oRectangle, Ogre::ColourValue oColour, int iPlane)
ManualObject* CBasicPainter::paintRectangle(RealRect oRectangle, ColourValue oColour, int iPlane)
{
ManualObject* l_poObject;
......@@ -77,7 +77,7 @@ ManualObject* CBasicPainter::paintRectangle(Ogre::RealRect oRectangle, Ogre::Col
}
ManualObject* CBasicPainter::paintTriangle(Point oP1, Point oP2, Point oP3, Ogre::ColourValue oColour, int iPlane)
ManualObject* CBasicPainter::paintTriangle(Point oP1, Point oP2, Point oP3, ColourValue oColour, int iPlane)
{
ManualObject* l_poObject;
......@@ -110,7 +110,7 @@ ManualObject* CBasicPainter::paintTriangle(Point oP1, Point oP2, Point oP3, Ogre
return l_poObject;
}
Ogre::ManualObject* CBasicPainter::paintCircle(Ogre::Real rX, Ogre::Real rY, Ogre::Real rR, Ogre::ColourValue oColour, bool bFilled, int iPlane)
ManualObject* CBasicPainter::paintCircle(Real rX, Real rY, Real rR, ColourValue oColour, bool bFilled, int iPlane)
{
ManualObject* l_poObject;
......@@ -153,14 +153,14 @@ Ogre::ManualObject* CBasicPainter::paintCircle(Ogre::Real rX, Ogre::Real rY, Ogr
void CBasicPainter::paintText(
const std::string& sID,
const std::string& sText,
Ogre::Real rX, Ogre::Real rY,
Ogre::Real rWidth, Ogre::Real rHeight,
const Ogre::ColourValue& oColour)
Real rX, Real rY,
Real rWidth, Real rHeight,
const ColourValue& oColour)
{
Ogre::OverlayElement* l_pText = m_poOverlayManager->createOverlayElement("TextArea", sID);
OverlayElement* l_pText = m_poOverlayManager->createOverlayElement("TextArea", sID);
l_pText->setDimensions(rWidth, rHeight);
l_pText->setMetricsMode(Ogre::GMM_PIXELS);
l_pText->setMetricsMode(GMM_PIXELS);
l_pText->setPosition(rX, rY);
......
......@@ -14,10 +14,10 @@ namespace OpenViBESSVEP
CCommandStartStop(CApplication* poApplication);
~CCommandStartStop();
void processFrame();
void processFrame() override;
void receiveKeyPressedEvent(const OIS::KeyCode oKey);
void receiveKeyReleasedEvent(const OIS::KeyCode oKey);
void receiveKeyPressedEvent(const OIS::KeyCode oKey) override;
void receiveKeyReleasedEvent(const OIS::KeyCode oKey) override;
private:
CVRPNServer* m_poVRPNServer;
......
......@@ -11,7 +11,7 @@ namespace OpenViBESSVEP
CCommandStimulatorControl(CApplication* poApplication);
~CCommandStimulatorControl() {};
void execute(int iButton, int iState);
void execute(int iButton, int iState) override;