blob: 9acce949aa1a56affcbf51b6d30d7a29912ed571 [file] [log] [blame]
kurtis.heimerl8aea56e2011-11-26 03:18:30 +00001/*
2 * Written by Thomas Tsou <ttsou@vt.edu>
3 * Based on code by Harvind S Samra <hssamra@kestrelsp.com>
4 *
5 * Copyright 2011 Free Software Foundation, Inc.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * See the COPYING file in the main directory for details.
20 */
21
22#ifndef RADIOVECTOR_H
23#define RADIOVECTOR_H
24
25#include "sigProcLib.h"
26#include "GSMCommon.h"
Alexander Chemerisd734e2d2013-06-16 14:30:58 +040027#include "Interthread.h"
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000028
Thomas Tsoua2fe91a2013-11-13 22:48:11 -050029class radioVector {
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000030public:
Thomas Tsoua2fe91a2013-11-13 22:48:11 -050031 radioVector(GSM::Time& wTime, size_t size = 0,
32 size_t start = 0, size_t chans = 1);
33
34 radioVector(GSM::Time& wTime, signalVector *vector);
35 ~radioVector();
36
kurtis.heimerl06286132011-11-26 03:18:43 +000037 GSM::Time getTime() const;
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000038 void setTime(const GSM::Time& wTime);
39 bool operator>(const radioVector& other) const;
40
Thomas Tsoua2fe91a2013-11-13 22:48:11 -050041 signalVector *getVector(size_t chan = 0);
42 bool setVector(signalVector *vector, size_t chan = 0);
43 size_t chans() const { return vectors.size(); }
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000044private:
Thomas Tsoua2fe91a2013-11-13 22:48:11 -050045 std::vector<signalVector *> vectors;
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000046 GSM::Time mTime;
47};
48
Thomas Tsoufa3a7872013-10-17 21:23:34 -040049class noiseVector : std::vector<float> {
50public:
51 noiseVector(size_t len = 0);
52 bool insert(float val);
53 float avg();
54
55private:
56 std::vector<float>::iterator it;
57};
58
Thomas Tsou204a9f12013-10-29 18:34:16 -040059class VectorFIFO : public InterthreadQueue<radioVector> { };
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000060
61class VectorQueue : public InterthreadPriorityQueue<radioVector> {
62public:
63 GSM::Time nextTime() const;
64 radioVector* getStaleBurst(const GSM::Time& targTime);
65 radioVector* getCurrentBurst(const GSM::Time& targTime);
66};
67
68#endif /* RADIOVECTOR_H */