⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stats.cpp

📁 This a framework to test new ideas in transmission technology. Actual development is a LDPC-coder in
💻 CPP
字号:
/***************************************************************************        stats.cpp  -  The definition for the stats                           -------------------   begin                :  2002   authors              :  Linus Gasser   emails               :  linus.gasser@epfl.ch***************************************************************************//***************************************************************************                                 Changes                                 ------- date - name - description 02-12-19 - ineiti - begin  **************************************************************************//*************************************************************************** *                                                                         * *   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 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************//** * @short Holds the definition of a stats */#include <qapplication.h>#include <qregexp.h>#include <iostream>#include <stdlib.h>#include <unistd.h>#include <math.h>#include <qregexp.h>#include "stats.h"#include "swr_types.h"#include "parameters.h"#include "parameter_types.h"#include "global.h"// this is the standard C++-way of using cout <<using namespace std;/** * Initialises the stats, that is searches for the corresponding * parameter and adjusts the values */Stats::Stats( FifoCmd *c, int m_i, int i ) :  radio( c ), module_id( m_i ), id( i ){  update();}void Stats::update(){  QStringList s = radio->getStats( module_id );  if ( (uint)id >= s.count() ){    cout << "Not enough stats to get index " << id << endl;    return;  }  QStringList args( QStringList::split( ",", s[id] ) );  blockName = args[0];  type = args[1].toInt();  flags = args[2].toULong();  value = args[3];  if ( type == BLOCK ){    sig_type = (swr_signal_type_t)args[3].toInt();    length = args[4].toInt();  } else if ( type == IMAGE ){    sig_type = NO_SIGNAL;    width = args[3].toInt();    height = args[4].toInt();    bpp = args[5].toInt();    length = width * height * ( bpp + 7 ) / 8;  }}bool Stats::isShown(){  return VALUE_SHOW( flags );}bool Stats::isValue(){  return type > 0 && type < 4;}QByteArray Stats::getData( ){  if ( type != BLOCK && type != IMAGE ){    cout << "Hmm, Stats::getData got called and type isn't BLOCK nor IMAGE\n";    return QByteArray( 0 );  }  QByteArray data = radio->getBlock( module_id, id );  if ( data.size() == 0 ){    cout << "Block-size is zero!...\n";    return QByteArray( 0 );  }  length = data.size() / TypeSize();  return data;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -