From 9e51406aa14469c8931d67ba8f850c5ec11ab271 Mon Sep 17 00:00:00 2001 From: jsiegle <jsiegle@mit.edu> Date: Thu, 5 Apr 2012 12:12:00 -0400 Subject: [PATCH] Removed obsolete Configuration class --- Source/Processors/GenericProcessor.h | 1 - Source/UI/Configuration.cpp | 65 -------- Source/UI/Configuration.h | 235 --------------------------- 3 files changed, 301 deletions(-) delete mode 100644 Source/UI/Configuration.cpp delete mode 100644 Source/UI/Configuration.h diff --git a/Source/Processors/GenericProcessor.h b/Source/Processors/GenericProcessor.h index f7f312903..d32ed3f96 100644 --- a/Source/Processors/GenericProcessor.h +++ b/Source/Processors/GenericProcessor.h @@ -27,7 +27,6 @@ #include "../../JuceLibraryCode/JuceHeader.h" #include "Editors/GenericEditor.h" -#include "../UI/Configuration.h" #include "../AccessClass.h" #include <time.h> #include <stdio.h> diff --git a/Source/UI/Configuration.cpp b/Source/UI/Configuration.cpp deleted file mode 100644 index 33bfd6ab6..000000000 --- a/Source/UI/Configuration.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - ------------------------------------------------------------------ - - This file is part of the Open Ephys GUI - Copyright (C) 2012 Open Ephys - - ------------------------------------------------------------------ - - 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, see <http://www.gnu.org/licenses/>. - -*/ - -#include "Configuration.h" - - -DataSource::DataSource(GenericProcessor* p, Configuration* c) -{ - - processor = p; - - name = p->getName(); - id = p->getNodeId(); - - firstChan = 0; - - for (int n = 0; n < c->numDataSources(); n++) - { - firstChan += c->getSource(n)->getNumChans(); - } - - numChans = p->getNumOutputs(); - - nextAvailableChan = firstChan; - - channelMapping.ensureStorageAllocated(numChans); - - totalElectrodes = 0; - -} - - -void Configuration::removeDataSource(GenericProcessor* p) -{ - std::cout << "Removing data source from configuration!" << std::endl; - - for (int n = 0; n < numDataSources(); n++) - { - GenericProcessor* gp = (GenericProcessor*) getSource(n)->getProcessor(); - - if (gp == p) - dataSources.remove(n); - } - -} \ No newline at end of file diff --git a/Source/UI/Configuration.h b/Source/UI/Configuration.h deleted file mode 100644 index 9a24edea1..000000000 --- a/Source/UI/Configuration.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - ------------------------------------------------------------------ - - This file is part of the Open Ephys GUI - Copyright (C) 2012 Open Ephys - - ------------------------------------------------------------------ - - 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, see <http://www.gnu.org/licenses/>. - -*/ - -#ifndef __CONFIGURATION_H_9DEA9372__ -#define __CONFIGURATION_H_9DEA9372__ - -#include "../../JuceLibraryCode/JuceHeader.h" -#include "../Processors/GenericProcessor.h" - -/** - - Holds configuration information for the signal chain. - - The Configuration can be accessed by all processors in order to - update channel names, electrode groupings, and acquisition parameters. - - @see UIComponent, GenericProcessor - -*/ - -class GenericProcessor; -class Configuration; - -class Trode -{ -public: - Trode(int nchans, int startChan, String name_) - { - name = name_; - - for (int n = 0; n < nchans; n++) - { - channelMapping.add(startChan++); - inputRange.add(10000.0); - threshold.add(5000.0); - isActive.add(true); - } - } - - ~Trode() {} - - int numChannels() {return channelMapping.size();} - - void setChannel(int wire, int chan) - { - if (checkWire(wire)) - channelMapping.set(wire,chan); - } - - void setThreshold(int wire, float thresh) - { - if (checkWire(wire)) - threshold.set(wire,thresh); - } - - void setInputRange(int wire, float inRange) - { - if (checkWire(wire)) - inputRange.set(wire,inRange); - } - - void setState(int wire, bool state) - { - if (checkWire(wire)) - isActive.set(wire,state); - } - - int getChannel(int wire) - { - if (checkWire(wire)) - return channelMapping[wire]; - else - return -1; - } - - float getThreshold(int wire) - { - if (checkWire(wire)) - return threshold[wire]; - else - return -1; - } - - float getInputRange(int wire) - { - if (checkWire(wire)) - return inputRange[wire]; - else - return -1; - } - - bool getState(int wire) - { - if (checkWire(wire)) - return isActive[wire]; - else - return false; - } - - int* getRawDataPointer() - { - return channelMapping.getRawDataPointer(); - } - - String getName() {return name;} - -private: - Array<int, CriticalSection> channelMapping; - Array<float, CriticalSection> threshold; - Array<float, CriticalSection> inputRange; - Array<bool, CriticalSection> isActive; - - String name; - - bool checkWire(int wire) - { - if (wire < channelMapping.size() && wire > -1) - return true; - else - return false; - } - -}; - -class DataSource -{ -public: - DataSource(GenericProcessor* p, Configuration* c); - - ~DataSource() {} - - GenericProcessor* getProcessor() {return processor;} - - int numTetrodes() {return tetrodes.size();} - int numStereotrodes() {return stereotrodes.size();} - int numSingleWires() {return singleWires.size();} - int getElectrodeNumberForChannel(int chan) - { - return channelMapping[chan]; - } - - Trode* getTetrode(int n) {return tetrodes[n];} - Trode* getStereotrode(int n) {return stereotrodes[n];} - Trode* getSingleWire(int n) {return singleWires[n];} - - void addTrode(int numChannels, String name_) - { - Trode* t = new Trode(numChannels, nextAvailableChan, name_); - - for (int n = 0; n < numChannels; n++) - { - channelMapping.set(nextAvailableChan++, totalElectrodes); - } - - totalElectrodes++; - - if (t->numChannels() == 1) - singleWires.add(t); - else if (t->numChannels() == 2) - stereotrodes.add(t); - else if (t->numChannels() == 4) - tetrodes.add(t); - } - - String getName() {return name;} - - int getNumChans() {return numChans;} - int getFirstChan() {return firstChan;} - - int id; - -private: - - String name; - - OwnedArray<Trode, CriticalSection> tetrodes; - OwnedArray<Trode, CriticalSection> stereotrodes; - OwnedArray<Trode, CriticalSection> singleWires; - Array<int, CriticalSection> channelMapping; - - int totalElectrodes; - int firstChan; - int numChans; - int nextAvailableChan; - - GenericProcessor* processor; - -}; - -class Configuration -{ -public: - Configuration() {}; - ~Configuration() {}; - - void removeDataSource(GenericProcessor*); - - int numDataSources() {return dataSources.size();} - DataSource* getSource(int sourceNum) {return dataSources[sourceNum];} - - void addDataSource(DataSource* d) - { - std::cout << "New data source added." << std::endl; - dataSources.add(d); - } - -private: - - OwnedArray<DataSource, CriticalSection> dataSources; -}; - - - - -#endif // __CONFIGURATION_H_9DEA9372__ -- GitLab