aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/radioVector.cpp
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2013-11-14 15:52:04 -0500
committerThomas Tsou <tom@tsou.cc>2013-11-15 23:35:07 -0500
commita0179e37f8007ebad32aa3aa5288bc16112eae12 (patch)
treebc43a0db3f1c2a7537ebcf5ff1a980d029221b5b /Transceiver52M/radioVector.cpp
parentef25dba4e7c0564053f949ae22af2dd055bd2439 (diff)
Transceiver52M: Use independent noise vectors for each channel
Each ARFCN channel may be independently configureted and possibly on separate hardware, so don't share a single vector for noise estimate calculations. Allow a non-pointer based iterator so we can get away with using the default copy constructor. Signed-off-by: Thomas Tsou <tom@tsou.cc>
Diffstat (limited to 'Transceiver52M/radioVector.cpp')
-rw-r--r--Transceiver52M/radioVector.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Transceiver52M/radioVector.cpp b/Transceiver52M/radioVector.cpp
index ead4481..d6fb742 100644
--- a/Transceiver52M/radioVector.cpp
+++ b/Transceiver52M/radioVector.cpp
@@ -74,10 +74,9 @@ bool radioVector::setVector(signalVector *vector, size_t chan)
return true;
}
-noiseVector::noiseVector(size_t n)
+noiseVector::noiseVector(size_t size)
+ : std::vector<float>(size), itr(0)
{
- this->resize(n);
- it = this->begin();
}
float noiseVector::avg()
@@ -95,10 +94,10 @@ bool noiseVector::insert(float val)
if (!size())
return false;
- if (it == this->end())
- it = this->begin();
+ if (itr >= this->size())
+ itr = 0;
- *it++ = val;
+ (*this)[itr++] = val;
return true;
}