LIBS += -ldl
QMAKE_CXXFLAGS += -std=c++11 -Wall
}
+win32 {
+ SOURCES += windows_defines.h
+}
INCLUDEPATH += libAGRE
# Add project root directory to work around VC11 include path scheme
integrator.h \
integrationtablemodel.h \
gui/aboutanyanka.h \
- globalinfo.h
+ globalinfo.h \
+ windows_defines.h
FORMS += \
gui/mainwindow.ui \
/* Public methods */
-const std::vector<std::string>* AGREInterface::debugAGREInfo()
+const std::vector<std::string>& AGREInterface::debugAGREInfo()
{
if (!m_inited)
- return nullptr;
+ throw std::bad_exception("Reader not initialized");
- return &m_readerIFace->debug_info_list();
+ return m_readerIFace->debug_info_list();
}
AGREInterface::ReturnCode AGREInterface::readFile(const std::string& fileName, std::shared_ptr<AGRE_MeasurementInfo>& minfo)
E_CANNOT_READ_FILE
};
- const std::vector<std::string>* debugAGREInfo();
+ const std::vector<std::string>& debugAGREInfo();
AGRE_ReturnCode lastAGREError() { AGRE_ReturnCode r = m_lastAGREError; m_lastAGREError = AGRE_ReturnCode::SUCCESS; return r; }
ReturnCode initialize();
static AGREInterface* instance();
} else {
QString errDesc = errorToString(AGREInterface::instance()->lastAGREError());
Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, "Error reading file '" + s + "'" + errDesc);
- const std::vector<std::string>* const dbgMsgs = AGREInterface::instance()->debugAGREInfo();
- if (dbgMsgs == nullptr)
- Logger::log(Logger::Level::CRITICAL, ME_SENDER_STR, "Null pointer to debug messages list. This should not happen!\n");
- else {
- for (const std::string& s : *dbgMsgs)
+ try {
+ const std::vector<std::string>& dbgMsgs = AGREInterface::instance()->debugAGREInfo();
+ for (const std::string& s : dbgMsgs)
Logger::log(Logger::Level::INFO, ME_SENDER_STR, QString("AGRE debug:") + QString(s.c_str()));
+ } catch (std::bad_exception& ) {
+ Logger::log(Logger::Level::CRITICAL, ME_SENDER_STR, "Null pointer to debug messages list. This should not happen!\n");
}
QMessageBox::warning(nullptr, "Error reading file '" + s + "'", errDesc);
return ReturnCode::E_READ_ERROR;
const char DataManager::UNIT_MILLIAU_TEXT[] = {0x6D, 0x41, 0x55, 0x00};
const char DataManager::UNIT_MILLIVOLTS_TEXT[] = {0x6D, 0x56, 0x00};
const char DataManager::UNIT_WATTS_TEXT[] = {0x57, 0x00};
-const QStringList DataManager::DATA_DIR_SUFFIX = { "*.D" };
+const QStringList DataManager::DATA_DIR_SUFFIX = QStringList() << "*.D";
DataManager::DataManager(QObject* parent) :
QObject(parent),
#include "logger.h"
#include <QApplication>
#include <QtWidgets/QMessageBox>
+#ifdef Q_OS_WIN
+#include "windows_defines.h"
+#endif
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
+#ifndef COMPILER_MSVC11
#warning Revisit the metatype shared_ptr<SignalView> registration
+#endif
qRegisterMetaType<std::shared_ptr<SignalView>>();
Logger::initializeGlobal();
#ifndef SIGNAL_H
#define SIGNAL_H
+#include <cstdint>
#include <vector>
#include <QtCore/QObject>
--- /dev/null
+#ifndef WINDOWS_DEFINES_H\r
+#define WINDOWS_DEFINES_H\r
+\r
+#define COMPILER_MSVC11\r
+\r
+#endif // WINDOWS_DEFINES_H\r