Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6 port and a bunch of compiler warning fixes #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Validate Metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Create Build Environment
run: cd contrib/ci/ && podman build -t intanrhx_validate -f ./Dockerfile-debian-testing .
Expand All @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -40,7 +40,7 @@ jobs:
./contrib/ci/auto-build-deb.sh

- name: Upload Debian package artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Debian Package
path: |
Expand All @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -66,7 +66,7 @@ jobs:
./contrib/ci/auto-build-deb.sh

- name: Upload Ubuntu package artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Ubuntu LTS Package
path: |
Expand Down
2 changes: 1 addition & 1 deletion Engine/API/Abstract/abstractrhxcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ AbstractRHXController::AbstractRHXController(ControllerType type_, AmplifierSamp
pipeReadErrorCode(0)
{
usbBufferSize = MaxNumBlocksToRead * BytesPerWord * RHXDataBlock::dataBlockSizeInWords(type, maxNumDataStreams());
cout << "RHXController: Allocating " << usbBufferSize / 1.0e6 << " MBytes for USB buffer.\n";
std::cout << "RHXController: Allocating " << usbBufferSize / 1.0e6 << " MBytes for USB buffer." << std::endl;
usbBuffer = nullptr;
usbBuffer = new uint8_t [usbBufferSize];
numDataStreams = 0;
Expand Down
4 changes: 2 additions & 2 deletions Engine/API/Hardware/rhxcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ bool RHXController::uploadFPGABitfile(const string& filename)
boardId = dev->GetWireOutValue(WireOutBoardId);
boardVersion = dev->GetWireOutValue(WireOutBoardVersion);

cout << "Rhythm configuration file successfully loaded. Rhythm version number: " <<
boardVersion << "\n\n";
std::cout << "Rhythm configuration file successfully loaded. Rhythm version number: " <<
boardVersion << "\n" << std::endl;

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/API/Synthetic/synthdatablockgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ SynthDataBlockGenerator::SynthDataBlockGenerator(ControllerType type_, double sa
{
int bufferSizeInWords = MaxNumBlocksToRead *
RHXDataBlock::dataBlockSizeInWords(type, AbstractRHXController::maxNumDataStreams(type));
cout << "SynthDataBlockGenerator: Allocating " << BytesPerWord * bufferSizeInWords / 1.0e6 << " MBytes for synthetic USB data generator.\n";
std::cout << "SynthDataBlockGenerator: Allocating " << BytesPerWord * bufferSizeInWords / 1.0e6 << " MBytes for synthetic USB data generator." << std::endl;
usbWords = nullptr;
usbWords = new uint16_t [bufferSizeInWords];
dataBlockPeriodInNsec = 1.0e9 * ((double)RHXDataBlock::samplesPerDataBlock(type)) / sampleRate;
Expand Down
3 changes: 2 additions & 1 deletion Engine/Processing/DataFileReaders/fileperchannelmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <QFileInfo>
#include <iostream>
#include <thread>
#include "rhxglobals.h"
#include "datafilereader.h"
#include "fileperchannelmanager.h"
Expand Down Expand Up @@ -511,7 +512,7 @@ void FilePerChannelManager::updateEndOfData()
// TODO - polish up to get the actual end of all data, not just assume from end of shortest amp file
int tempTotalNumSamples = 0;
for (int stream = 0; stream < info->numDataStreams; ++stream) {
for (int channel = 0; channel < amplifierFiles[stream].size(); ++channel) {
for (uint channel = 0; channel < amplifierFiles[stream].size(); ++channel) {
if (amplifierWasSaved[stream][channel]) {
int64_t numAmpSamples = amplifierFiles[stream][channel]->fileSize() / 2;
if (numAmpSamples < tempTotalNumSamples || tempTotalNumSamples == 0) {
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/DataFileReaders/fileperchannelmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FilePerChannelManager : public DataFileManager
DataFileReader* parent);
~FilePerChannelManager();

long readDataBlocksRaw(int numBlocks, uint8_t* buffer);
long readDataBlocksRaw(int numBlocks, uint8_t* buffer) override;
int64_t getLastTimeStamp() override;
int64_t jumpToTimeStamp(int64_t target) override;
void loadDataFrame() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ int64_t TraditionalIntanFileManager::blocksPresent()
{
// Should remain accurate even if data file continues growing
int dataSizeBytes = 0;
for (int i = 0; i < consecutiveFiles.size(); i++) {
for (uint i = 0; i < consecutiveFiles.size(); i++) {
dataSizeBytes += QFileInfo(consecutiveFiles[i].fileName).size() - info->headerSizeInBytes;
}
return dataSizeBytes / info->bytesPerDataBlock;
Expand Down
6 changes: 5 additions & 1 deletion Engine/Processing/XPUInterfaces/gpuinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,12 @@ bool GPUInterface::createKernel(int devIndex)
state->writeToLog("Completed clCreateContext()");

state->writeToLog("About to call clCreateCommandQueue");
cl_queue_properties properties[] = {
CL_QUEUE_PROPERTIES,
0 // Terminates the list
};
// Create command queue.
commandQueue = clCreateCommandQueue(context, id, 0, &ret);
commandQueue = clCreateCommandQueueWithProperties(context, id, properties, &ret);
if (ret != CL_SUCCESS) {
state->writeToLog("Failure creating OpenCL commandqueue. Ret: " + QString::number(ret));
gpuErrorMessage("Error creating OpenCL commandqueue. Returned error code: " + QString::number(ret));
Expand Down
10 changes: 7 additions & 3 deletions Engine/Processing/XPUInterfaces/xpucontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

XPUController::XPUController(SystemState *state_, bool useOpenCL_, QObject *parent) :
QObject(parent),
useOpenCL(useOpenCL_),
state(state_),
usedXPUIndex(-1),
useOpenCL(useOpenCL_)
usedXPUIndex(-1)
{
state->writeToLog("Entered XPUController ctor");
connect(state, SIGNAL(stateChanged()), this, SLOT(updateFromState()));
Expand Down Expand Up @@ -126,7 +126,11 @@ void XPUController::updateFromState()
if (state->usedXPUIndex() != usedXPUIndex) {
activeInterface->cleanupMemory();
usedXPUIndex = state->usedXPUIndex();
activeInterface = (usedXPUIndex == 0) ? activeInterface = cpuInterface : activeInterface = gpuInterface;
if (usedXPUIndex == 0) {
activeInterface = cpuInterface;
} else {
activeInterface = gpuInterface;
}
activeInterface->setupMemory();
}
activeInterface->updateFromState();
Expand Down
8 changes: 7 additions & 1 deletion Engine/Processing/commandparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

CommandParser::CommandParser(SystemState* state_, ControllerInterface *controllerInterface_, QObject *parent) :
QObject(parent),
controllerInterface(controllerInterface_),
controlWindow(nullptr),
controllerInterface(controllerInterface_),
state(state_)
{
// These connections allow for interactions with communicators that may live in another thread
Expand Down Expand Up @@ -871,6 +871,8 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const
if (stimParams->pulseTrainPeriod->getValue() < stimDuration)
return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)";

break;

case BoardDacSignal:
// PulseTrainPeriod cannot be less than stimDuration (which depends on Shape)
// Biphasic: stimDuration = FirstPhaseDuration + SecondPhaseDuration
Expand All @@ -888,11 +890,15 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const
if (stimParams->pulseTrainPeriod->getValue() < stimDuration)
return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)";

break;

case BoardDigitalOutSignal:
// PulseTrainPeriod cannot be less than FirstPhaseDuration
if (stimParams->pulseTrainPeriod->getValue() < stimParams->firstPhaseDuration->getValue())
return "PulseTrainPeriodMicroseconds cannot be less than pulse duration (FirstPhaseDurationMicroseconds)";

break;

default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/controllerinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int ControllerInterface::scanPorts(vector<ChipType> &chipType, vector<int> &port
state->previousDelaySelectedPort->getValue(),
state->lastDetectedChip->getValue());

for (int i = 0; i < chipType.size(); i++) {
for (uint i = 0; i < chipType.size(); i++) {
if (chipType[i] != NoChip) {
state->lastDetectedChip->setValue((int) chipType[i]);
break;
Expand Down
6 changes: 3 additions & 3 deletions Engine/Processing/datastreamfifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ DataStreamFifo::DataStreamFifo(int bufferSize_, int maxReadLength_) :
{
int bufferSizeWithExtra = bufferSize + maxReadLength;
memoryNeededGB = sizeof(uint16_t) * bufferSizeWithExtra / (1024.0 * 1024.0 * 1024.0);
cout << "DataStreamFifo: Allocating " << 2 * bufferSizeWithExtra / 1.0e6 << " MBytes for FIFO buffer." << '\n';
std::cout << "DataStreamFifo: Allocating " << 2 * bufferSizeWithExtra / 1.0e6 << " MBytes for FIFO buffer." << std::endl;
buffer = nullptr;

memoryAllocated = true;
try {
buffer = new uint16_t [bufferSizeWithExtra];
} catch (std::bad_alloc&) {
memoryAllocated = false;
cerr << "Error: DataStreamFifo constructor could not allocate " << memoryNeededGB << " GB of memory." << '\n';
std::cerr << "Error: DataStreamFifo constructor could not allocate " << memoryNeededGB << " GB of memory." << std::endl;
}

if (!buffer) {
cerr << "Error: DataStreamFifo constructor could not allocate " << 2 * bufferSizeWithExtra << " bytes of memory." << '\n';
std::cerr << "Error: DataStreamFifo constructor could not allocate " << 2 * bufferSizeWithExtra << " bytes of memory." << std::endl;
}
resetBuffer();
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/softwarereferenceprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void SoftwareReferenceProcessor::readReferenceSamples(vector<StreamChannelPair>
{
const uint16_t* pRead;

for (int i = 0; i < addresses.size(); ++i) {
for (uint i = 0; i < addresses.size(); ++i) {
pRead = start;
pRead += 6; // Skip header and timestamp.
pRead += misoWordSize * (numDataStreams * 3); // Skip auxiliary channels.
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/stateitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class StateFilenameItem : public StateItem
bool isValid() const { return !path.isEmpty() && !baseFilename.isEmpty(); }
QString getFullFilename() const { return isValid() ? path + "/" + baseFilename : ""; }

QString getValidValues() const { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; }
QString getValidValues() const override { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; }

private:
QString path;
Expand Down
6 changes: 3 additions & 3 deletions Engine/Processing/waveformfifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include "waveformfifo.h"

WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBlocks_, int memorySizeInDataBlocks_, int maxWriteSizeInDataBlocks_, SystemState* state_) :
state(state_),
signalSources(signalSources_),
bufferSizeInDataBlocks(bufferSizeInDataBlocks_),
memorySizeInDataBlocks(memorySizeInDataBlocks_),
maxWriteSizeInDataBlocks(maxWriteSizeInDataBlocks_),
numReaders(NumberOfReaders),
state(state_)
numReaders(NumberOfReaders)
{
if (numReaders < 1) {
cerr << "WaveformFifo constructor: numReaders must be one or greater." << '\n';
Expand All @@ -64,7 +64,7 @@ WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBl
bufferAllocateSize = bufferSize + maxWriteSizeInSamples;
bufferAllocateSizeInBlocks = bufferSizeInDataBlocks + maxWriteSizeInDataBlocks;

usedWordsNewData = new Semaphore [numReaders];
usedWordsNewData = new Semaphore[numReaders];
bufferReadIndex.resize(numReaders);
bufferMemoryIndex.resize(numReaders);
numWordsToBeRead.resize(numReaders);
Expand Down
3 changes: 1 addition & 2 deletions Engine/Processing/waveformfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <map>
#include <vector>
#include <mutex>
#include "rhxglobals.h"
#include "semaphore.h"
#include "minmax.h"
#include "signalsources.h"
Expand Down Expand Up @@ -76,7 +75,7 @@ const uint8_t SpikeIdLikelyArtifact = 0x80u;
class WaveformFifo
{
public:
enum Reader {
enum Reader : uint {
ReaderDisplay = 0,
ReaderDisk,
ReaderAudio,
Expand Down
24 changes: 12 additions & 12 deletions Engine/Processing/xmlinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString
while (!stream.atEnd()) {

// Make sure we enter at least the first SignalGroup element. If we've gone past all the SignalGroups and are at the end of the document, just return
while (stream.name() != "SignalGroup") {
while (stream.name() != QStringLiteral("SignalGroup")) {
QXmlStreamReader::TokenType token = stream.readNext();

// Handle if no signal groups at all are present by giving a warning and returning
Expand Down Expand Up @@ -504,7 +504,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString
while (!stream.atEnd()) {

// Make sure we enter at least the first Channel element. If we've gone past all the Channels and are at the end of the document, just return.
while (stream.name() != "Channel") {
while (stream.name() != QStringLiteral("Channel")) {
QXmlStreamReader::TokenType token = stream.readNext();
if (token == QXmlStreamReader::EndDocument) {

Expand All @@ -517,7 +517,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString
errorMessage.append("\n");
}
errorMessage.append("Warning: The following channels are currently detected by the Intan controller but are not included in the settings file:");
for (int i = 0; i < uninitializedChannels.size(); ++i) {
for (uint i = 0; i < uninitializedChannels.size(); ++i) {
errorMessage.append("\n" + QString::fromStdString(uninitializedChannels[i]));
}
}
Expand Down Expand Up @@ -576,7 +576,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString
vector<string> XMLInterface::findUninitializedChannels(vector<string> allChannels, vector<bool> channelsInitializedFromXML) const
{
vector<string> uninitializedChannels;
for (int i = 0; i < allChannels.size(); ++i) {
for (uint i = 0; i < allChannels.size(); ++i) {
if (!channelsInitializedFromXML[i]) {
uninitializedChannels.push_back(allChannels[i]);
}
Expand All @@ -594,7 +594,7 @@ bool XMLInterface::parseGeneralConfig(const QByteArray &byteArray, QString &erro
if (!validDocumentStart) return false;

// Parse GeneralConfig
while (stream.name() != "GeneralConfig") {
while (stream.name() != QStringLiteral("GeneralConfig")) {
stream.readNextStartElement();
if (stream.atEnd()) return true;
}
Expand Down Expand Up @@ -697,7 +697,7 @@ bool XMLInterface::parseSignalGroups(const QByteArray &byteArray, QString &error
while (!stream.atEnd()) {

// Make sure we enter at least the first SignalGroup element. If we've gone past all the SignalGroups and are at the end of the document, just return.
while (stream.name() != "SignalGroup") {
while (stream.name() != QStringLiteral("SignalGroup")) {
QXmlStreamReader::TokenType token = stream.readNext();
if (token == QXmlStreamReader::EndDocument) {
return true;
Expand Down Expand Up @@ -797,7 +797,7 @@ bool XMLInterface::parseSignalGroups(const QByteArray &byteArray, QString &error
while (!stream.atEnd()) {

// Make sure we enter at least the first Channel element. If we've gone past all the Channels and are at the end of the document, just return.
while (stream.name() != "Channel") {
while (stream.name() != QStringLiteral("Channel")) {
QXmlStreamReader::TokenType token = stream.readNext();
if (token == QXmlStreamReader::EndDocument) {
return true;
Expand Down Expand Up @@ -889,7 +889,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err
if (!validDocumentStart) return false;

// Parse StimParameters.
while (stream.name() != "StimParameters") {
while (stream.name() != QStringLiteral("StimParameters")) {
stream.readNextStartElement();
if (stream.atEnd()) return true;
}
Expand All @@ -898,7 +898,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err
while (!stream.atEnd()) {

// Make sure we enter at least the first StimChannel element. If we've gone past all the StimChannels and are at the end of the document, just return.
while (stream.name() != "StimChannel") {
while (stream.name() != QStringLiteral("StimChannel")) {
QXmlStreamReader::TokenType token = stream.readNext();
if (token == QXmlStreamReader::EndDocument) {
return true;
Expand All @@ -911,7 +911,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err
// Try to find the StimChannel's name.
QString nativeChannelName("");
for (auto attribute : attributes) {
if (attribute.name().toString().toLower() == "nativechannelname") {
if (attribute.name().toString().toLower() == QStringLiteral("nativechannelname")) {
nativeChannelName = attribute.value().toString();
break;
}
Expand Down Expand Up @@ -962,7 +962,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err
bool XMLInterface::parseStimLegacy(const QByteArray &byteArray, QString &errorMessage) const
{
QXmlStreamReader stream(byteArray);
if (!stream.readNextStartElement() || stream.name() != "xstim" || stream.attributes().value("", "version").toString() != "1.0") {
if (!stream.readNextStartElement() || stream.name() != QStringLiteral("xstim") || stream.attributes().value("", "version").toString() != "1.0") {
errorMessage.append("Error: invalid xstim element and version attribute");
return false;
}
Expand All @@ -971,7 +971,7 @@ bool XMLInterface::parseStimLegacy(const QByteArray &byteArray, QString &errorMe

state->holdUpdate();

while (stream.readNextStartElement() && stream.name() == "channel") {
while (stream.readNextStartElement() && stream.name() == QStringLiteral("channel")) {

QString channelName = stream.attributes().value("", "name").toString();
channel = state->signalSources->channelByName(channelName);
Expand Down
Loading