A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-chunk-processor.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009, 2010 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 * Modified by : Marco Miozzo <mmiozzo@cttc.es>
19 * (move from CQI to Ctrl and Data SINR Chunk processors)
20 * Modified by : Piotr Gawlowicz <gawlowicz.p@gmail.com>
21 * (removed all Lte***ChunkProcessor implementations
22 * and created generic LteChunkProcessor)
23 */
24
25#ifndef LTE_CHUNK_PROCESSOR_H
26#define LTE_CHUNK_PROCESSOR_H
27
28#include <ns3/nstime.h>
29#include <ns3/object.h>
30#include <ns3/ptr.h>
31
32namespace ns3
33{
34
35class SpectrumValue;
36
37/// Chunk processor callback typedef
39
40/**
41 * This abstract class is used to process the time-vs-frequency
42 * SINR/interference/power chunk of a received LTE signal
43 * which was calculated by the LteInterference object.
44 */
45class LteChunkProcessor : public SimpleRefCount<LteChunkProcessor>
46{
47 public:
49 virtual ~LteChunkProcessor();
50
51 /**
52 * \brief Add callback to list
53 *
54 * This function adds callback c to list. Each callback pass
55 * calculated value to its object and is called in
56 * LteChunkProcessor::End().
57 *
58 * \param c callback function
59 */
61
62 /**
63 * \brief Clear internal variables
64 *
65 * This function clears internal variables in the beginning of
66 * calculation
67 */
68 virtual void Start();
69
70 /**
71 * \brief Collect SpectrumValue and duration of signal
72 *
73 * Passed values are collected in m_sumValues and m_totDuration variables.
74 *
75 * \param sinr the SINR
76 * \param duration the duration
77 */
78 virtual void EvaluateChunk(const SpectrumValue& sinr, Time duration);
79
80 /**
81 * \brief Finish calculation and inform interested objects about calculated value
82 *
83 * During this function all callbacks from list are executed
84 * to inform interested object about calculated value. This
85 * function is called at the end of calculation.
86 */
87 virtual void End();
88
89 private:
91 Time m_totDuration; ///< total duration
92
93 std::vector<LteChunkProcessorCallback>
94 m_lteChunkProcessorCallbacks; ///< chunk processor callback
95};
96
97/**
98 * A sink to be plugged to the callback of LteChunkProcessor allowing
99 * to save and later retrieve the latest reported value
100 *
101 */
103{
104 public:
105 /**
106 * function to be plugged to LteChunkProcessor::AddCallback ()
107 *
108 * \param value
109 */
110 void ReportValue(const SpectrumValue& value);
111
112 /**
113 *
114 *
115 * \return the latest value reported by the LteChunkProcessor
116 */
118
119 private:
120 Ptr<SpectrumValue> m_value; ///< spectrum value
121};
122
123} // namespace ns3
124
125#endif /* LTE_CHUNK_PROCESSOR_H */
Callback template class.
Definition: callback.h:438
This abstract class is used to process the time-vs-frequency SINR/interference/power chunk of a recei...
virtual void Start()
Clear internal variables.
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)
Collect SpectrumValue and duration of signal.
Ptr< SpectrumValue > m_sumValues
sum values
Time m_totDuration
total duration
std::vector< LteChunkProcessorCallback > m_lteChunkProcessorCallbacks
chunk processor callback
virtual void End()
Finish calculation and inform interested objects about calculated value.
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
Ptr< SpectrumValue > m_value
spectrum value
Ptr< SpectrumValue > GetValue()
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
A template-based reference counting class.
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< void, const SpectrumValue & > LteChunkProcessorCallback
Chunk processor callback typedef.