This file is indexed.

/usr/include/ns3.27/ns3/spectrum-value.h is in libns3-dev 3.27+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2009 CTTC
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Nicola Baldo <nbaldo@cttc.es>
 */

#ifndef SPECTRUM_VALUE_H
#define SPECTRUM_VALUE_H

#include <ns3/ptr.h>
#include <ns3/simple-ref-count.h>
#include <ns3/spectrum-model.h>
#include <ostream>
#include <vector>

namespace ns3 {


/// Container for element values
typedef std::vector<double> Values;

/**
 * \ingroup spectrum
 *
 * \brief Set of values corresponding to a given SpectrumModel
 *
 * This class implements a Function Space which can represent any
 * function \f$ g: F \in {\sf
 * R\hspace*{-0.9ex}\rule{0.15ex}{1.5ex}\hspace*{0.9ex}}^N \rightarrow {\sf R\hspace*{-0.9ex}\rule{0.15ex}{1.5ex}\hspace*{0.9ex}}  \f$
 *
 * Every instance of this class represent a particular function \f$ g(F) \f$.
 * The domain of the function space, i.e., \f$ F \f$, is implemented by Bands.
 * The codomain of the function space is implemented by Values.
 *
 * To every possible value of \f$ F\f$ corresponds a different Function
 * Space.
 * Mathematical operations are defined in this Function Space; these
 * operations are implemented by means of operator overloading.
 *
 * The intended use of this class is to represent frequency-dependent
 * things, such as power spectral densities, frequency-dependent
 * propagation losses, spectral masks, etc.
 */
class SpectrumValue : public SimpleRefCount<SpectrumValue>
{
public:
  /**
   * @brief SpectrumValue constructor
   *
   * @param sm pointer to the SpectrumModel which implements the set of frequencies to which the values
   * will be referring.
   *
   * @warning the intended use if that sm points to a static object
   * which will be there for the whole simulation. This is reasonable
   * since the set of frequencies which are to be used in the
   * simulation is normally known before the simulation starts. Make
   * sure that the SpectrumModel instance which sm points to has already been
   * initialized by the time this method is invoked. The main reason is
   * that if you initialize the SpectrumModel instance afterwards, and
   * the memory for the underlying std::vector gets reallocated, then
   * sm will not be a valid reference anymore. Another reason is that
   * m_values could end up having the wrong size.
   */
  SpectrumValue (Ptr<const SpectrumModel> sm);


  SpectrumValue ();


  /**
   * Access value at given frequency index
   *
   * @param index the given frequency index
   *
   * @return reference to the value
   */
  double& operator[] (size_t index);

  /**
   * Access value at given frequency index
   *
   * @param index the given frequency index
   *
   * @return const reference to the value
   */
  const double& operator[] (size_t index) const;


  /**
   *
   * @return the uid of the embedded SpectrumModel
   */
  SpectrumModelUid_t GetSpectrumModelUid () const;


  /**
   *
   * @return the  embedded SpectrumModel
   */
  Ptr<const SpectrumModel> GetSpectrumModel () const;


  /**
   *
   *
   * @return a const iterator pointing to the beginning of the embedded Bands
   */
  Bands::const_iterator ConstBandsBegin () const;

  /**
   *
   *
   * @return a const iterator pointing to the end of the embedded Bands
   */
  Bands::const_iterator ConstBandsEnd () const;


  /**
   *
   *
   * @return a const iterator pointing to the beginning of the embedded Values
   */
  Values::const_iterator ConstValuesBegin () const;

  /**
   *
   *
   * @return a const iterator pointing to the end of the embedded Values
   */
  Values::const_iterator ConstValuesEnd () const;

  /**
   *
   *
   * @return an iterator pointing to the beginning of the embedded Values
   */
  Values::iterator ValuesBegin ();

  /**
   *
   *
   * @return an iterator pointing to the end of the embedded Values
   */
  Values::iterator ValuesEnd ();



  /**
   *  addition operator
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs + rhs
   */
  friend SpectrumValue operator+ (const SpectrumValue& lhs, const SpectrumValue& rhs);


  /**
   *  addition operator
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs + rhs
   */
  friend SpectrumValue operator+ (const SpectrumValue& lhs, double rhs);

  /**
   *  addition operator
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs + rhs
   */
  friend SpectrumValue operator+ (double lhs, const SpectrumValue& rhs);


  /**
   *  subtraction operator
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs - rhs
   */
  friend SpectrumValue operator- (const SpectrumValue& lhs, const SpectrumValue& rhs);

  /**
   *  subtraction operator
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs - rhs
   */
  friend SpectrumValue operator- (const SpectrumValue& lhs, double rhs);

  /**
   *  subtraction operator
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs - rhs
   */
  friend SpectrumValue operator- (double lhs, const SpectrumValue& rhs);

  /**
   *  multiplication component-by-component (Schur product)
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs * rhs
   */
  friend SpectrumValue operator* (const SpectrumValue& lhs, const SpectrumValue& rhs);

  /**
   *  multiplication by a scalar
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs * rhs
   */
  friend SpectrumValue operator* (const SpectrumValue& lhs, double rhs);

  /**
   *  multiplication of a scalar
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs * rhs
   */
  friend SpectrumValue operator* (double lhs, const SpectrumValue& rhs);

  /**
   *  division component-by-component
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of lhs / rhs
   */
  friend SpectrumValue operator/ (const SpectrumValue& lhs, const SpectrumValue& rhs);

  /**
   * division by a scalar
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of *this / rhs
   */
  friend SpectrumValue operator/ (const SpectrumValue& lhs, double rhs);

  /**
   * division of a scalar
   *
   * @param lhs Left Hand Side of the operator
   * @param rhs Right Hand Side of the operator
   *
   * @return the value of *this / rhs
   */
  friend SpectrumValue operator/ (double lhs, const SpectrumValue& rhs);

  /**
   * unary plus operator
   *
   * @param rhs Right Hand Side of the operator
   * @return the value of *this
   */
  friend SpectrumValue operator+ (const SpectrumValue& rhs);

  /**
   * unary minus operator
   *
   * @param rhs Right Hand Side of the operator
   * @return the value of - *this
   */
  friend SpectrumValue operator- (const SpectrumValue& rhs);


  /**
   * left shift operator
   *
   * @param n position to shift
   *
   * @return the value of *this left shifted by n positions. In other
   * words, the function of the set of frequencies represented by
   * *this is left-shifted in frequency by n positions.
   */
  SpectrumValue operator<< (int n) const;

  /**
    * right shift operator
    *
    * @param n position to shift
    *
    * @return the value of *this right shifted by n positions. In other
    * words, the function of the set of frequencies represented by
    * *this is left-shifted in frequency by n positions.
    */
  SpectrumValue operator>> (int n) const;



  /**
   * Add the Right Hand Side of the operator to *this, component by component
   *
   * @param rhs the Right Hand Side
   *
   * @return a reference to *this
   */
  SpectrumValue& operator+= (const SpectrumValue& rhs);

  /**
   * Subtract the Right Hand Side of the operator from *this, component by component
   *
   * @param rhs the Right Hand Side
   *
   * @return a reference to *this
   */
  SpectrumValue& operator-= (const SpectrumValue& rhs);

  /**
   * Multiply *this by the Right Hand Side of the operator, component by component
   *
   * @param rhs the Right Hand Side
   *
   * @return  a reference to *this
   */
  SpectrumValue& operator*= (const SpectrumValue& rhs);

  /**
   * Divide *this by the Right Hand Side of the operator, component by component
   *
   * @param rhs the Right Hand Side
   *
   * @return  a reference to *this
   */
  SpectrumValue& operator/= (const SpectrumValue& rhs);

  /**
   * Add the value of the Right Hand Side of the operator to all
   * components of *this
   *
   * @param rhs the Right Hand Side
   *
   * @return a reference to *this
   */
  SpectrumValue& operator+= (double rhs);

  /**
   * Subtract the value of the Right Hand Side of the operator from all
   * components of *this
   *
   * @param rhs the Right Hand Side
   *
   * @return a reference to *this
   */
  SpectrumValue& operator-= (double rhs);

  /**
   * Multiply every component of *this by the value of the Right Hand
   * Side of the operator
   *
   * @param rhs the Right Hand Side
   *
   * @return  a reference to *this
   */
  SpectrumValue& operator*= (double rhs);

  /**
   * Divide every component of *this by the value of the Right Hand
   * Side of the operator
   *
   * @param rhs the Right Hand Side
   *
   * @return  a reference to *this
   */
  SpectrumValue& operator/= (double rhs);


  /**
   * Assign each component of *this to the value of the Right Hand
   * Side of the operator
   *
   * @param rhs
   *
   * @return
   */
  SpectrumValue& operator= (double rhs);



  /**
   *
   * @param x the operand
   *
   * @return the euclidean norm, i.e., the sum of the squares of all
   * the values in x
   */
  friend double Norm (const SpectrumValue& x);


  /**
   *
   * @param x the operand
   *
   * @return the sum of all
   * the values in x
   */
  friend double Sum (const SpectrumValue& x);


  /**
   * @param x the operand
   *
   * @return the product of all
   * the values in x
   */
  friend double Prod (const SpectrumValue& x);


  /**
   *
   *
   * @param lhs the base
   * @param rhs the exponent
   *
   * @return each value in base raised to the exponent
   */
  friend SpectrumValue Pow (const SpectrumValue& lhs, double rhs);


  /**
   *
   * @param lhs the base
   * @param rhs the exponent
   *
   * @return the value in base raised to each value in the exponent
   */
  friend SpectrumValue Pow (double lhs, const SpectrumValue& rhs);

  /**
   *
   *
   * @param arg the argument
   *
   * @return the logarithm in base 10 of all values in the argument
   */
  friend SpectrumValue Log10 (const SpectrumValue&  arg);


  /**
   *
   *
   * @param arg the argument
   *
   * @return the logarithm in base 2 of all values in the argument
   */
  friend SpectrumValue Log2 (const SpectrumValue&  arg);

  /**
   *
   *
   * @param arg the argument
   *
   * @return the logarithm in base e of all values in the argument
   */
  friend SpectrumValue Log (const SpectrumValue&  arg);

  /**
   *
   *
   * @param arg the argument
   *
   * @return the value of the integral \f$\int_F g(f) df  \f$
   */
  friend double Integral (const SpectrumValue&  arg);

  /**
   *
   * @return a Ptr to a copy of this instance
   */
  Ptr<SpectrumValue> Copy () const;

  /**
   *  TracedCallback signature for SpectrumValue.
   *
   * \param [in] value Value of the traced variable.
   * \deprecated The non-const \c Ptr<SpectrumPhy> argument
   * is deprecated and will be changed to \c Ptr<const SpectrumPhy>
   * in a future release.
   */
  typedef void (* TracedCallback)(Ptr<SpectrumValue> value);


private:
  /**
   * Add a SpectrumValue (element to element addition)
   * \param x SpectrumValue
   */
  void Add (const SpectrumValue& x);
  /**
   * Add a flat value to all the current elements
   * \param s flat value
   */
  void Add (double s);
  /**
   * Subtracts a SpectrumValue (element by element subtraction)
   * \param x SpectrumValue
   */
  void Subtract (const SpectrumValue& x);
  /**
   * Subtracts a flat value to all the current elements
   * \param s flat value
   */
  void Subtract (double s);
  /**
   * Multiplies for a SpectrumValue (element to element multiplication)
   * \param x SpectrumValue
   */
  void Multiply (const SpectrumValue& x);
  /**
   * Multiplies for a flat value to all the current elements
   * \param s flat value
   */
  void Multiply (double s);
  /**
   * Divides by a SpectrumValue (element to element division)
   * \param x SpectrumValue
   */
  void Divide (const SpectrumValue& x);
  /**
   * Divides by a flat value to all the current elements
   * \param s flat value
   */
  void Divide (double s);
  /**
   * Change the values sign
   */
  void ChangeSign ();
  /**
   * Shift the values to the left
   */
  void ShiftLeft (int n);
  /**
   * Shift the values to the right
   */
  void ShiftRight (int n);
  /**
   * Modifies each element so that it each element is raised to the exponent
   *
   * \param exp the exponent
   */
  void Pow (double exp);
  /**
   * Modifies each element so that it is
   * the base raised to each element value
   *
   * \param base the base
   */
  void Exp (double base);
  /**
   * Applies a Log10 to each the elements
   */
  void Log10 ();
  /**
   * Applies a Log2 to each the elements
   */
  void Log2 ();
  /**
   * Applies a Log to each the elements
   */
  void Log ();

  Ptr<const SpectrumModel> m_spectrumModel; //!< The spectrum model


  /**
   * Set of values which implement the codomain of the functions in
   * the Function Space defined by SpectrumValue. There is no restriction
   * on what these values represent (a transmission power density, a
   * propagation loss, etc.).
   *
   */
  Values m_values;


};

std::ostream& operator << (std::ostream& os, const SpectrumValue& pvf);

double Norm (const SpectrumValue& x);
double Sum (const SpectrumValue& x);
double Prod (const SpectrumValue& x);
SpectrumValue Pow (const SpectrumValue& lhs, double rhs);
SpectrumValue Pow (double lhs, const SpectrumValue& rhs);
SpectrumValue Log10 (const SpectrumValue& arg);
SpectrumValue Log2 (const SpectrumValue& arg);
SpectrumValue Log (const SpectrumValue& arg);
double Integral (const SpectrumValue& arg);


} // namespace ns3

#endif /* SPECTRUM_VALUE_H */