Mentions légales du service

Skip to content
Snippets Groups Projects

Resolve "Bug: Clang Compiler pair error"

Merged MONSEIGNE Thibaut requested to merge 140-bug-clang-compiler-pair-error into development
4 files
+ 49
87
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -36,22 +36,18 @@ bool CBoxAlgorithmLSLExportGipsa::processInput(const size_t /*index*/)
bool CBoxAlgorithmLSLExportGipsa::process()
{
if (!m_inputChannel1.isWorking())
{
if (!m_inputChannel1.isWorking()) {
m_inputChannel1.waitForSignalHeader();
if (m_inputChannel1.isWorking())
{
try
{
if (m_inputChannel1.isWorking()) {
try {
//if it fails here then most likely you are using the wrong dll - e.x debug instead of release or vice-versa
lsl::stream_info info(m_streamName.toASCIIString(), m_streamType.toASCIIString(), int(m_inputChannel1.getNChannels()) + 1,
double(m_inputChannel1.getSamplingRate()), lsl::cf_float32);
lsl::xml_element channels = info.desc().append_child("channels");
for (size_t i = 0; i < m_inputChannel1.getNChannels(); ++i)
{
for (size_t i = 0; i < m_inputChannel1.getNChannels(); ++i) {
channels.append_child("channel")
.append_child_value("label", m_inputChannel1.getChannelName(i))
.append_child_value("type", "EEG")
@@ -66,42 +62,34 @@ bool CBoxAlgorithmLSLExportGipsa::process()
m_outlet = new lsl::stream_outlet(info); //here the length of the buffered signal can be specified
}
catch (std::exception& e)
{
catch (std::exception& e) {
this->getLogManager() << Kernel::LogLevel_Error << "Could not initialize LSL library: " << e.what() << "\n";
return false;
}
}
}
else
{
else {
//stimulations
for (size_t i = 0; i < m_inputChannel1.getNStimulationBuffers(); ++i)
{
for (size_t i = 0; i < m_inputChannel1.getNStimulationBuffers(); ++i) {
uint64_t tStart, tEnd;
CStimulationSet* set = m_inputChannel1.getStimulation(tStart, tEnd, i);
const CStimulationSet* set = m_inputChannel1.getStimulation(tStart, tEnd, i);
for (size_t j = 0; j < set->size(); ++j)
{
for (size_t j = 0; j < set->size(); ++j) {
uint64_t time = m_inputChannel1.getStartTimestamp() + set->getDate(j);
const uint64_t identifier = set->getId(j);
if (m_stims.empty())
{
m_stims.push_back(std::pair<float, uint64_t>(float(identifier), time));
if (m_stims.empty()) {
m_stims.push_back(std::pair<uint64_t, uint64_t>(identifier, time));
//std::cout<< "added: " << m_stims[m_stims.size()-1].first << " " << m_stims[m_stims.size()-1].second<< "\n";
}
else
{
const auto last = m_stims[m_stims.size() - 1];
if (last.first != identifier && last.second != time)
{
m_stims.push_back(std::pair<float, uint64_t>(float(identifier), time));
else {
const auto& last = m_stims[m_stims.size() - 1];
if (last.first != identifier && last.second != time) {
m_stims.push_back(std::pair<uint64_t, uint64_t>(identifier, time));
//std::cout<< "added: " << m_stims[m_stims.size()-1].first << " " << m_stims[m_stims.size()-1].second<< "\n";
}
else
{
else {
//std::cout<< "duplicate: " << m_stims[m_stims.size()-1].first << " " << m_stims[m_stims.size()-1].second<< "\n";
}
}
@@ -109,13 +97,11 @@ bool CBoxAlgorithmLSLExportGipsa::process()
}
//signal
for (size_t i = 0; i < m_inputChannel1.getNSignalBuffers(); ++i)
{
for (size_t i = 0; i < m_inputChannel1.getNSignalBuffers(); ++i) {
uint64_t tStart, tEnd;
double* inputBuffer = m_inputChannel1.getSignal(tStart, tEnd, i);
if (inputBuffer)
{
if (inputBuffer) {
const size_t samplesPerChannelInput = m_inputChannel1.getNSamples();
std::vector<std::vector<float>> mychunk(samplesPerChannelInput);
@@ -123,10 +109,8 @@ bool CBoxAlgorithmLSLExportGipsa::process()
//Fill a matrix - OpenVibe provides the data ch1 (all values from all samples), ch2(all values from all samples) ... chN,
//In the generated chunk every row is a single sample (containing the data from all channels) and every column number is the number of the channel
for (size_t k = 0; k < m_inputChannel1.getNChannels(); ++k)
{
for (size_t j = 0; j < samplesPerChannelInput; ++j)
{
for (size_t k = 0; k < m_inputChannel1.getNChannels(); ++k) {
for (size_t j = 0; j < samplesPerChannelInput; ++j) {
const size_t index = (k * samplesPerChannelInput) + j;
mychunk[j][k] = float(inputBuffer[index]); // @note 64bit->32bit conversion
}
@@ -136,12 +120,10 @@ bool CBoxAlgorithmLSLExportGipsa::process()
std::vector<float> stimChan = std::vector<float>(samplesPerChannelInput);
auto it = m_stims.begin();
while (it != m_stims.end())
{
auto current = *it;
while (it != m_stims.end()) {
const auto& current = *it;
if (!(current.second >= tStart && current.second <= tEnd))
{
if (!(current.second >= tStart && current.second <= tEnd)) {
// not in current time range, do not send now.
++it;
continue;
@@ -154,8 +136,7 @@ bool CBoxAlgorithmLSLExportGipsa::process()
if (pos < 0) { pos = 0; } //fix position
if (pos == int(stimChan.size())) { pos = int(stimChan.size() - 1); } //fix position
if (pos >= 0 && pos < int(stimChan.size()))
{
if (pos >= 0 && pos < int(stimChan.size())) {
stimChan[pos] = float(current.first);
//std::cout<< "pos relative: " << pos << " value: " << stim_chan[pos] << " time:" << CTime(current.second).toSeconds()<< "\n";
}
Loading