Commit c525f713 authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Added Uncrustify support

Use config based on https://gist.github.com/mkroman/1372117
parent da656a16
/*=========================================================================
Library: iMSTK
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
=========================================================================*/
#include "imstkModule.h"
#include <iostream>
namespace imstk {
void Module::exec()
{
m_status = ModuleStatus::RUNNING;
this->initModule();
while( m_status != ModuleStatus::TERMINATING )
while (m_status != ModuleStatus::TERMINATING)
{
if( m_status == ModuleStatus::RUNNING )
{
this->runModule();
}
if (m_status == ModuleStatus::RUNNING)
{
this->runModule();
}
}
this->cleanUpModule();
m_status = ModuleStatus::INACTIVE;
......@@ -42,56 +42,62 @@ void Module::exec()
void Module::run()
{
switch(m_status)
switch (m_status)
{
case ModuleStatus::PAUSED :
case ModuleStatus::PAUSED:
m_status = ModuleStatus::RUNNING;
break;
case ModuleStatus::RUNNING :
std::cerr << "Can not run " << m_name <<std::endl
<< "Module already running." <<std::endl;
case ModuleStatus::RUNNING:
std::cerr << "Can not run " << m_name << std::endl
<< "Module already running." << std::endl;
break;
default :
std::cerr << "Can not run " << m_name <<std::endl
default:
std::cerr << "Can not run " << m_name << std::endl
<< "Module terminating or not active."
<< "Run `module::exec()` to launch your module." <<std::endl;
<< "Run `module::exec()` to launch your module." << std::endl;
break;
}
}
void Module::pause()
{
switch(m_status)
switch (m_status)
{
case ModuleStatus::RUNNING :
case ModuleStatus::RUNNING:
m_status = ModuleStatus::PAUSED;
break;
case ModuleStatus::PAUSED :
std::cerr << "Can not pause " << m_name <<std::endl
<< "Module already running." <<std::endl;
case ModuleStatus::PAUSED:
std::cerr << "Can not pause " << m_name << std::endl
<< "Module already running." << std::endl;
break;
default :
std::cerr << "Can not pause " << m_name <<std::endl
default:
std::cerr << "Can not pause " << m_name << std::endl
<< "Module terminating or not active."
<< "Run `module::exec()` to launch your module." <<std::endl;
<< "Run `module::exec()` to launch your module." << std::endl;
break;
}
}
void Module::terminate()
{
switch(m_status)
switch (m_status)
{
case ModuleStatus::TERMINATING :
std::cerr << "Can not terminate " << m_name <<std::endl
<< "Module already terminating." <<std::endl;
case ModuleStatus::TERMINATING:
std::cerr << "Can not terminate " << m_name << std::endl
<< "Module already terminating." << std::endl;
break;
case ModuleStatus::INACTIVE :
std::cerr << "Can not terminate " << m_name <<std::endl
case ModuleStatus::INACTIVE:
std::cerr << "Can not terminate " << m_name << std::endl
<< "Module not active."
<< "Run `module::exec()` to launch your module." <<std::endl;
<< "Run `module::exec()` to launch your module." << std::endl;
break;
default :
default:
m_status = ModuleStatus::TERMINATING;
break;
}
......@@ -106,5 +112,4 @@ const std::string& Module::getName() const
{
return m_name;
}
}
/*=========================================================================
Library: iMSTK
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
=========================================================================*/
#ifndef imstkModule_h
#define imstkModule_h
......@@ -25,7 +25,6 @@
#include <iostream>
namespace imstk {
enum class ModuleStatus
{
INACTIVE,
......@@ -37,27 +36,28 @@ enum class ModuleStatus
class Module
{
public:
~Module() = default;
void exec();
void run();
void pause();
void terminate();
void exec();
void run();
void pause();
void terminate();
const ModuleStatus& getStatus() const;
const std::string& getName() const;
const std::string & getName() const;
protected:
Module(std::string name) : m_name(name) {}
virtual void initModule() = 0;
virtual void runModule() = 0;
virtual void initModule() = 0;
virtual void runModule() = 0;
virtual void cleanUpModule() = 0;
ModuleStatus m_status = ModuleStatus::INACTIVE;
std::string m_name;
std::string m_name;
};
}
#endif
#endif // ifndef imstkModule_h
/*=========================================================================
Library: iMSTK
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
=========================================================================*/
#include "imstkScene.h"
namespace imstk {
void Scene::initModule()
{
std::cout<<std::endl<<m_name<<" : init"<<std::endl;
std::cout << std::endl << m_name << " : init" << std::endl;
}
void Scene::cleanUpModule()
{
std::cout<<std::endl<<m_name<<" : cleanUp"<<std::endl;
std::cout << std::endl << m_name << " : cleanUp" << std::endl;
}
void Scene::runModule()
{
std::cout<<"."<<std::flush;
std::cout << "." << std::flush;
}
}
/*=========================================================================
Library: iMSTK
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
=========================================================================*/
#ifndef imstkScene_h
#define imstkScene_h
......@@ -27,11 +27,12 @@
#include "imstkModule.h"
namespace imstk {
class Scene : public Module
{
public:
Scene(std::string name) : Module(name){}
Scene(std::string name) : Module(name) {}
~Scene() = default;
protected:
......@@ -39,9 +40,7 @@ protected:
void initModule() override;
void runModule() override;
void cleanUpModule() override;
};
}
#endif
#endif // ifndef imstkScene_h
/*=========================================================================
Library: iMSTK
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
=========================================================================*/
#include "imstkSimulationManager.h"
namespace imstk {
}
namespace imstk {}
/*=========================================================================
Library: iMSTK
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
=========================================================================*/
#ifndef imstkSimulationManager_h
#define imstkSimulationManager_h
......@@ -30,20 +30,20 @@
namespace imstk {
class SimulationManager
{
public:
~SimulationManager() = default;
private:
SimulationManager() = default;
std::map<std::string, std::shared_ptr<Scene>> sceneMap;
std::map<std::string, std::shared_ptr<Scene> > sceneMap;
std::size_t activeSceneID;
std::vector<std::thread> threads;
};
}
#endif
#endif // ifndef imstkSimulationManager_h
This diff is collapsed.
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