A Discrete-Event Network Simulator
API
spectrum-error-model.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 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  */
19 
20 #ifndef SPECTRUM_ERROR_MODEL_H
21 #define SPECTRUM_ERROR_MODEL_H
22 
23 #include "spectrum-value.h"
24 
25 #include <ns3/nstime.h>
26 #include <ns3/object.h>
27 #include <ns3/packet.h>
28 #include <ns3/ptr.h>
29 
30 namespace ns3
31 {
32 
37 class SpectrumErrorModel : public Object
38 {
39  public:
44  static TypeId GetTypeId();
45  ~SpectrumErrorModel() override;
46 
51  virtual void StartRx(Ptr<const Packet> p) = 0;
52 
58  virtual void EvaluateChunk(const SpectrumValue& sinr, Time duration) = 0;
59 
64  virtual bool IsRxCorrect() = 0;
65 };
66 
76 {
77  protected:
78  void DoDispose() override;
79 
80  public:
85  static TypeId GetTypeId();
86  // inherited from SpectrumErrorModel
87  void StartRx(Ptr<const Packet> p) override;
88  void EvaluateChunk(const SpectrumValue& sinr, Time duration) override;
89  bool IsRxCorrect() override;
90 
91  private:
92  uint32_t m_bytes;
93  uint32_t m_deliverableBytes;
94 };
95 
96 } // namespace ns3
97 
98 #endif /* SPECTRUM_ERROR_MODEL_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
This class implements the error model described in this paper: N.
void StartRx(Ptr< const Packet > p) override
Start a packet reception.
uint32_t m_bytes
Length of the packet being received.
void EvaluateChunk(const SpectrumValue &sinr, Time duration) override
Evaluates a chunk.
bool IsRxCorrect() override
Checks if the packet being received is correct.
uint32_t m_deliverableBytes
Bytes that can be received according to the Shnanon's formula.
static TypeId GetTypeId()
Register this type.
void DoDispose() override
Destructor implementation.
virtual void StartRx(Ptr< const Packet > p)=0
Start a packet reception.
static TypeId GetTypeId()
Register this type.
virtual bool IsRxCorrect()=0
Checks if the packet being received is correct.
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)=0
Evaluates a chunk.
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.