A Discrete-Event Network Simulator
API
spectrum-model.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef SPECTRUM_MODEL_H
22 #define SPECTRUM_MODEL_H
23 
24 #include <ns3/simple-ref-count.h>
25 #include <vector>
26 
27 namespace ns3 {
28 
45 struct BandInfo
46 {
47  double fl;
48  double fc;
49  double fh;
50 };
51 
52 
54 typedef std::vector<BandInfo> Bands;
55 
57 typedef uint32_t SpectrumModelUid_t;
58 
66 class SpectrumModel : public SimpleRefCount<SpectrumModel>
67 {
68 public:
75  friend bool operator== (const SpectrumModel& lhs, const SpectrumModel& rhs);
76 
86  SpectrumModel (const std::vector<double>& centerFreqs);
87 
88 
95  SpectrumModel (const Bands& bands);
96 
104  SpectrumModel (Bands&& bands);
105 
110  size_t GetNumBands () const;
111 
112 
117  SpectrumModelUid_t GetUid () const;
118 
124  Bands::const_iterator Begin () const;
130  Bands::const_iterator End () const;
131 
138  bool IsOrthogonal (const SpectrumModel &other) const;
139 
140 private:
144 };
145 
146 
147 } // namespace ns3
148 
149 #endif /* SPECTRUM_MODEL_H */
size_t GetNumBands() const
uint32_t SpectrumModelUid_t
Uid for SpectrumModels.
SpectrumModelUid_t m_uid
unique id for a given set of frequencies
friend bool operator==(const SpectrumModel &lhs, const SpectrumModel &rhs)
Comparison operator.
bool IsOrthogonal(const SpectrumModel &other) const
Check if another SpectrumModels has bands orthogonal to our bands.
Set of frequency values implementing the domain of the functions in the Function Space defined by Spe...
std::vector< BandInfo > Bands
Container of BandInfo.
SpectrumModelUid_t GetUid() const
double fc
center frequency
static SpectrumModelUid_t m_uidCount
counter to assign m_uids
Bands::const_iterator Begin() const
Const Iterator to the model Bands container start.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double fl
lower limit of subband
Bands m_bands
Actual definition of frequency bands within this SpectrumModel.
SpectrumModel(const std::vector< double > &centerFreqs)
This constructs a SpectrumModel based on a given set of frequencies, which is assumed to be sorted by...
double fh
upper limit of subband
The building block of a SpectrumModel.
A template-based reference counting class.
Bands::const_iterator End() const
Const Iterator to the model Bands container end.