Commit 5af6fc5c authored by Mathieu Faverge's avatar Mathieu Faverge

feat(mv): Changethe plugin to be a singleton

parent 917b1be0
......@@ -12,7 +12,7 @@ namespace Helper
va_list ap;
va_start(ap, format);
Matrix_visualizer::Get()->log(status, format, ap);
Matrix_visualizer::get_instance()->log(status, format, ap);
va_end(ap);
}
......@@ -22,7 +22,7 @@ namespace Helper
va_list ap;
va_start(ap, format);
Matrix_visualizer::Get()->set_infos(format, ap);
Matrix_visualizer::get_instance()->set_infos(format, ap);
va_end(ap);
}
......
......@@ -37,9 +37,6 @@ print_get_units( double flops )
return units[unit];
}
#define MEMORY_WRITE(mem) printflopsv( mem )
#define MEMORY_UNIT_WRITE(mem) printflopsu( mem )
namespace Helper
{
void log(LogStatus status, const char* format, ...);
......
......@@ -3,38 +3,33 @@
#include "Configuration.hpp"
#include <QFileDialog>
Plugin *create() { return Matrix_visualizer::Get(); }
Matrix_visualizer* Matrix_visualizer::s_plugin = nullptr;
SymbolParser Matrix_visualizer::s_symbol_parser;
Matrix_window* Matrix_visualizer::s_matrix_window = nullptr;
// Functions to initialize the plugin in ViTE
Plugin *create() { return Matrix_visualizer::get_instance(); }
Matrix_visualizer* Matrix_visualizer::get_instance()
{
if (NULL == s_plugin)
{
s_plugin = new Matrix_visualizer();
}
return s_plugin;
}
// Plugin implementation itself
Matrix_visualizer::Matrix_visualizer() {
setupUi(this);
s_plugin = this;
this->connect_widgets();
// For windows dev (pc: orange)
this->line_edit_symbol->setText("/home/mathieu/svn/pastix/pastix/build/symbol_rank");
}
Matrix_visualizer* Matrix_visualizer::Get()
{
static Matrix_visualizer* instance = nullptr;
if (instance == nullptr)
instance = new Matrix_visualizer();
return instance;
}
void Matrix_visualizer::connect_widgets()
{
// Automatically done with ui file !
}
Matrix_visualizer::~Matrix_visualizer(){
}
......
......@@ -12,8 +12,7 @@
class Matrix_visualizer : public Plugin, public Ui::Matrix_visualizer_plugin_ui {
Q_OBJECT
public:
static Matrix_visualizer* Get();
~Matrix_visualizer();
static Matrix_visualizer* get_instance();
void init();
void clear();
......@@ -26,6 +25,7 @@ public:
private:
Matrix_visualizer();
~Matrix_visualizer();
void connect_widgets();
......
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