Skip to content
Snippets Groups Projects
Commit 08ac7d8c authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

REFAC: rename the modules status to lower cases to be consistent with the rest of the code

parent 583888e2
No related branches found
No related tags found
No related merge requests found
Showing
with 53 additions and 53 deletions
......@@ -469,7 +469,7 @@ main()
}
// Run
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -142,7 +142,7 @@ main()
// Run the simulation
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -101,7 +101,7 @@ main()
// Run
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::RUNNING);
simManager->start(SimulationStatus::running);
return 0;
}
......@@ -65,7 +65,7 @@ main()
// Run
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -85,7 +85,7 @@ main()
// Run
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -256,7 +256,7 @@ main()
}
// Run
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -138,7 +138,7 @@ main()
// Start
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -323,7 +323,7 @@ main()
cam->setFocalPoint(Vec3d(0, 0, 0));
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -166,7 +166,7 @@ main()
scene->addLight(light);
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -236,7 +236,7 @@ main()
apiutils::printUPS(simManager->getSceneManager(scene));
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -107,7 +107,7 @@ main()
simManager->setActiveScene(scene);
simManager->getViewer()->setBackgroundColors(Vec3d(0.3285, 0.3285, 0.6525), Vec3d(0.13836, 0.13836, 0.2748), true);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -105,7 +105,7 @@ main()
//viewer->enableFullscreen();
#endif
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -200,7 +200,7 @@ main()
// Run
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -131,7 +131,7 @@ main(int argc, char* argv[])
scene->addLight(whiteLight);
simManager->setActiveScene(scene);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -68,7 +68,7 @@ main()
simManager->end();
// Quit
while (simManager->getStatus() != SimulationStatus::INACTIVE) {}
while (simManager->getStatus() != SimulationStatus::inactive) {}
return 0;
}
......@@ -102,7 +102,7 @@ main()
// Run
simManager->setActiveScene(sceneTest);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -63,7 +63,7 @@ main()
// Run
simManager->setActiveScene(sceneTest);
simManager->start(SimulationStatus::PAUSED);
simManager->start(SimulationStatus::paused);
return 0;
}
......@@ -118,47 +118,47 @@ TEST_F(imstkModuleTest, GetFrequency)
}
TEST_F(imstkModuleTest, ControlModule)
{
ASSERT_EQ(m_module.getStatus(), ModuleStatus::INACTIVE);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::inactive);
m_module.run();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::INACTIVE);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::inactive);
ASSERT_FALSE(m_module.m_init);
ASSERT_FALSE(m_module.m_run);
ASSERT_FALSE(m_module.m_cleanup);
m_module.pause();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::INACTIVE);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::inactive);
ASSERT_FALSE(m_module.m_init);
ASSERT_FALSE(m_module.m_run);
ASSERT_FALSE(m_module.m_cleanup);
m_module.end();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::INACTIVE);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::inactive);
ASSERT_FALSE(m_module.m_init);
ASSERT_FALSE(m_module.m_run);
ASSERT_TRUE(m_module.m_cleanup);
auto t = std::thread([this] { m_module.start(); });
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_EQ(m_module.getStatus(), ModuleStatus::RUNNING);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::running);
ASSERT_TRUE(m_module.m_init);
ASSERT_TRUE(m_module.m_run);
m_module.pause();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::PAUSED);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::paused);
m_module.m_run = false;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_TRUE(m_module.m_init);
ASSERT_FALSE(m_module.m_run);
m_module.run();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::RUNNING);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::running);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_TRUE(m_module.m_init);
ASSERT_TRUE(m_module.m_run);
m_module.end();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::INACTIVE);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::inactive);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_TRUE(m_module.m_init);
ASSERT_TRUE(m_module.m_run);
......@@ -169,13 +169,13 @@ TEST_F(imstkModuleTest, ControlModule)
t = std::thread([this] { m_module.start(); });
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_EQ(m_module.getStatus(), ModuleStatus::RUNNING);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::running);
ASSERT_TRUE(m_module.m_init);
ASSERT_TRUE(m_module.m_run);
ASSERT_FALSE(m_module.m_cleanup);
m_module.pause();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::PAUSED);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::paused);
m_module.m_run = false;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_TRUE(m_module.m_init);
......@@ -183,7 +183,7 @@ TEST_F(imstkModuleTest, ControlModule)
ASSERT_FALSE(m_module.m_cleanup);
m_module.end();
ASSERT_EQ(m_module.getStatus(), ModuleStatus::INACTIVE);
ASSERT_EQ(m_module.getStatus(), ModuleStatus::inactive);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_TRUE(m_module.m_init);
ASSERT_FALSE(m_module.m_run);
......
......@@ -27,7 +27,7 @@ namespace imstk
void
Module::start()
{
if (m_status != ModuleStatus::INACTIVE)
if (m_status != ModuleStatus::inactive)
{
LOG(WARNING) << "Can not start '" << m_name << "'.\n"
<< "Module already/still active.";
......@@ -35,7 +35,7 @@ Module::start()
}
// Init
m_status = ModuleStatus::STARTING;
m_status = ModuleStatus::starting;
if (m_preInitCallback)
{
m_preInitCallback(this);
......@@ -48,19 +48,19 @@ Module::start()
m_postInitCallback(this);
}
m_status = ModuleStatus::RUNNING;
m_status = ModuleStatus::running;
// Keep active, wait for terminating call
std::chrono::steady_clock::time_point previous_t = std::chrono::steady_clock::now() - std::chrono::minutes(1);
std::chrono::steady_clock::time_point current_t;
long long elapsed;
while (m_status != ModuleStatus::TERMINATING)
while (m_status != ModuleStatus::terminating)
{
if (m_status == ModuleStatus::PAUSING)
if (m_status == ModuleStatus::pausing)
{
m_status = ModuleStatus::PAUSED;
m_status = ModuleStatus::paused;
}
else if (m_status == ModuleStatus::RUNNING)
else if (m_status == ModuleStatus::running)
{
// Short path to run module if loop delay = 0
// (updating as fast as possible)
......@@ -121,28 +121,28 @@ Module::start()
}
}
m_status = ModuleStatus::INACTIVE;
m_status = ModuleStatus::inactive;
}
void
Module::run()
{
if (m_status != ModuleStatus::PAUSED)
if (m_status != ModuleStatus::paused)
{
return;
}
m_status = ModuleStatus::RUNNING;
m_status = ModuleStatus::running;
}
void
Module::pause()
{
if (m_status == ModuleStatus::RUNNING)
if (m_status == ModuleStatus::running)
{
m_status = ModuleStatus::PAUSING;
m_status = ModuleStatus::pausing;
while (m_status != ModuleStatus::PAUSED) {}
while (m_status != ModuleStatus::paused) {}
}
}
......@@ -162,17 +162,17 @@ Module::end()
m_postCleanUpCallback(this);
}
if ((m_status == ModuleStatus::INACTIVE)
|| (m_status == ModuleStatus::TERMINATING))
if ((m_status == ModuleStatus::inactive)
|| (m_status == ModuleStatus::terminating))
{
LOG(WARNING) << "Can not end '" << m_name << "'.\n"
<< "Module already inactive or terminating.";
return;
}
m_status = ModuleStatus::TERMINATING;
m_status = ModuleStatus::terminating;
while (m_status != ModuleStatus::INACTIVE) {}
while (m_status != ModuleStatus::inactive) {}
}
ModuleStatus
......@@ -236,7 +236,7 @@ Module::setFrequency(const double f)
unsigned int
Module::getUPS()
{
if (m_status != ModuleStatus::RUNNING)
if (m_status != ModuleStatus::running)
{
return 0;
}
......
......@@ -34,12 +34,12 @@ namespace imstk
///
enum class ModuleStatus
{
STARTING,
RUNNING,
PAUSING,
PAUSED,
TERMINATING,
INACTIVE
starting,
running,
pausing,
paused,
terminating,
inactive
};
///
......@@ -151,7 +151,7 @@ protected:
CallbackFunction m_preCleanUpCallback; ///> function callback preceding module cleanup
CallbackFunction m_postCleanUpCallback; ///> function callback following module cleanup
std::atomic<ModuleStatus> m_status { ModuleStatus::INACTIVE }; ///> Module status
std::atomic<ModuleStatus> m_status { ModuleStatus::inactive }; ///> Module status
bool m_trackFPS = false;
std::shared_ptr<UPSCounter> m_frameCounter = std::make_shared<UPSCounter>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment