/*------------------------------------------------------------------------------ -- This file is a part of the SocExplorer Software -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------------*/ /*-- Author : Alexis Jeandet -- Mail : alexis.jeandet@lpp.polytechnique.fr ----------------------------------------------------------------------------*/ #include "memcheckplugin.h" memcheckplugin::memcheckplugin(QWidget *parent):socexplorerplugin(parent,true) { this->UI = new memcheckplugin_ui(); this->setWidget(this->UI); this->checker = new memchecker(this); QObject::connect(this->UI,SIGNAL(checkdatabits(uint,uint)),this,SLOT(checkdatabits(uint,uint))); QObject::connect(this->UI,SIGNAL(checkmemory(uint,uint)),this,SLOT(checkmemory(uint,uint))); QObject::connect(this->UI,SIGNAL(checkmemorySize(uint,uint)),this,SLOT(checkmemorySize(uint,uint))); } memcheckplugin::~memcheckplugin() {} void memcheckplugin::checkmemory(unsigned int address, unsigned int size) { bool success; QString repport=this->checker->checkmemory(address,size,&success); this->UI->setResult(success,repport); } void memcheckplugin::checkmemorySize(unsigned int address, unsigned int size) { bool success=true; unsigned int _size = this->checker->measureMemSize(address,size); int prefix=0; QStringList list; list <<"B" << "KB" << "MB" << "GB"; while (_size>=(unsigned int)1024) { _size/=1024; prefix++; } QString repport=QString::number(_size)+list.at(prefix); this->UI->setResult(success,repport); } void memcheckplugin::checkdatabits(unsigned int address, unsigned int size) { bool success; QString repport=this->checker->checkdatabits(address,size,&success); this->UI->setResult(success,repport); }