A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
spectrum-value.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_VALUE_H
22
#define SPECTRUM_VALUE_H
23
24
#include <ns3/ptr.h>
25
#include <ns3/simple-ref-count.h>
26
#include <ns3/spectrum-model.h>
27
#include <ostream>
28
#include <vector>
29
30
namespace
ns3 {
31
32
33
typedef
std::vector<double>
Values
;
34
57
class
SpectrumValue
:
public
SimpleRefCount
<SpectrumValue>
58
{
59
public
:
77
SpectrumValue
(
Ptr<const SpectrumModel>
sm);
78
79
80
SpectrumValue
();
81
82
90
double
&
operator[]
(
size_t
index);
91
92
93
98
SpectrumModelUid_t
GetSpectrumModelUid
()
const
;
99
100
105
Ptr<const SpectrumModel>
GetSpectrumModel
()
const
;
106
107
113
Bands::const_iterator
ConstBandsBegin
()
const
;
114
120
Bands::const_iterator
ConstBandsEnd
()
const
;
121
122
128
Values::const_iterator
ConstValuesBegin
()
const
;
129
135
Values::const_iterator
ConstValuesEnd
()
const
;
136
142
Values::iterator
ValuesBegin
();
143
149
Values::iterator
ValuesEnd
();
150
151
152
161
friend
SpectrumValue
operator+
(
const
SpectrumValue
& lhs,
const
SpectrumValue
& rhs);
162
163
172
friend
SpectrumValue
operator+
(
const
SpectrumValue
& lhs,
double
rhs);
173
182
friend
SpectrumValue
operator+
(
double
lhs,
const
SpectrumValue
& rhs);
183
184
193
friend
SpectrumValue
operator-
(
const
SpectrumValue
& lhs,
const
SpectrumValue
& rhs);
194
203
friend
SpectrumValue
operator-
(
const
SpectrumValue
& lhs,
double
rhs);
204
213
friend
SpectrumValue
operator-
(
double
lhs,
const
SpectrumValue
& rhs);
214
223
friend
SpectrumValue
operator*
(
const
SpectrumValue
& lhs,
const
SpectrumValue
& rhs);
224
233
friend
SpectrumValue
operator*
(
const
SpectrumValue
& lhs,
double
rhs);
234
243
friend
SpectrumValue
operator*
(
double
lhs,
const
SpectrumValue
& rhs);
244
253
friend
SpectrumValue
operator/
(
const
SpectrumValue
& lhs,
const
SpectrumValue
& rhs);
254
263
friend
SpectrumValue
operator/
(
const
SpectrumValue
& lhs,
double
rhs);
264
273
friend
SpectrumValue
operator/
(
double
lhs,
const
SpectrumValue
& rhs);
274
281
friend
SpectrumValue
operator+
(
const
SpectrumValue
& rhs);
282
289
friend
SpectrumValue
operator-
(
const
SpectrumValue
& rhs);
290
291
301
SpectrumValue
operator<<
(
int
n)
const
;
302
312
SpectrumValue
operator>>
(
int
n)
const
;
313
314
315
323
SpectrumValue
&
operator+=
(
const
SpectrumValue
& rhs);
324
332
SpectrumValue
&
operator-=
(
const
SpectrumValue
& rhs);
333
341
SpectrumValue
&
operator*=
(
const
SpectrumValue
& rhs);
342
350
SpectrumValue
&
operator/=
(
const
SpectrumValue
& rhs);
351
360
SpectrumValue
&
operator+=
(
double
rhs);
361
370
SpectrumValue
&
operator-=
(
double
rhs);
371
380
SpectrumValue
&
operator*=
(
double
rhs);
381
390
SpectrumValue
&
operator/=
(
double
rhs);
391
392
401
SpectrumValue
&
operator=
(
double
rhs);
402
403
404
412
friend
double
Norm
(
const
SpectrumValue
&
x
);
413
414
422
friend
double
Sum
(
const
SpectrumValue
& x);
423
424
431
friend
double
Prod
(
const
SpectrumValue
& x);
432
433
442
friend
SpectrumValue
Pow
(
const
SpectrumValue
& lhs,
double
rhs);
443
444
453
friend
SpectrumValue
Pow
(
double
lhs,
const
SpectrumValue
& rhs);
454
462
friend
SpectrumValue
Log10
(
const
SpectrumValue
& arg);
463
464
472
friend
SpectrumValue
Log2
(
const
SpectrumValue
& arg);
473
481
friend
SpectrumValue
Log
(
const
SpectrumValue
& arg);
482
490
friend
double
Integral
(
const
SpectrumValue
& arg);
491
496
Ptr<SpectrumValue>
Copy
()
const
;
497
498
499
500
private
:
501
void
Add
(
const
SpectrumValue
& x);
502
void
Add
(
double
s);
503
void
Subtract
(
const
SpectrumValue
& x);
504
void
Subtract
(
double
s);
505
void
Multiply
(
const
SpectrumValue
& x);
506
void
Multiply
(
double
s);
507
void
Divide
(
const
SpectrumValue
& x);
508
void
Divide
(
double
s);
509
void
ChangeSign
();
510
void
ShiftLeft
(
int
n);
511
void
ShiftRight
(
int
n);
512
void
Pow
(
double
exp);
513
void
Exp
(
double
base);
514
void
Log10
();
515
void
Log2
();
516
void
Log
();
517
518
Ptr<const SpectrumModel>
m_spectrumModel
;
519
520
528
Values
m_values
;
529
530
531
};
532
533
std::ostream&
operator <<
(std::ostream& os,
const
SpectrumValue
& pvf);
534
535
double
Norm
(
const
SpectrumValue
&
x
);
536
double
Sum
(
const
SpectrumValue
&
x
);
537
double
Prod
(
const
SpectrumValue
&
x
);
538
SpectrumValue
Pow
(
const
SpectrumValue
& lhs,
double
rhs);
539
SpectrumValue
Pow
(
double
lhs,
const
SpectrumValue
& rhs);
540
SpectrumValue
Log10
(
const
SpectrumValue
& arg);
541
SpectrumValue
Log2
(
const
SpectrumValue
& arg);
542
SpectrumValue
Log
(
const
SpectrumValue
& arg);
543
double
Integral
(
const
SpectrumValue
& arg);
544
545
546
}
// namespace ns3
547
548
#endif
/* SPECTRUM_VALUE_H */
src
spectrum
model
spectrum-value.h
Generated on Tue Oct 9 2012 16:45:46 for ns-3 by
1.8.1.2