A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
uan-transducer.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
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: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_TRANSDUCER_H
22 #define UAN_TRANSDUCER_H
23 
24 #include "ns3/object.h"
25 #include "ns3/packet.h"
26 #include "uan-tx-mode.h"
27 #include "ns3/uan-prop-model.h"
28 
29 #include <list>
30 
31 namespace ns3 {
32 
33 class UanPhy;
34 class UanChannel;
35 
36 
43 {
44 public:
45 
46  /* default constructor so python scan works */
48  {
49  }
50 
58  UanPacketArrival (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp, Time arrTime)
59  : m_packet (packet),
60  m_rxPowerDb (rxPowerDb),
61  m_txMode (txMode),
62  m_pdp (pdp),
63  m_arrTime (arrTime)
64  {
65  }
66 
68  {
69  m_packet = 0;
70  }
71 
75  inline Ptr<Packet> GetPacket (void) const
76  {
77  return m_packet;
78  }
82  inline double GetRxPowerDb (void) const
83  {
84  return m_rxPowerDb;
85  }
89  inline const UanTxMode &GetTxMode (void) const
90  {
91  return m_txMode;
92  }
96  inline Time GetArrivalTime (void) const
97  {
98  return m_arrTime;
99  }
103  inline UanPdp GetPdp (void) const
104  {
105  return m_pdp;
106  }
107 private:
108  Ptr<Packet> m_packet;
109  double m_rxPowerDb;
110  UanTxMode m_txMode;
111  UanPdp m_pdp;
112  Time m_arrTime;
113 };
114 
123 class UanTransducer : public Object
124 {
125 public:
126  static TypeId GetTypeId (void);
127 
131  enum State {
132  TX, RX
133  };
134 
138  typedef std::list<UanPacketArrival> ArrivalList;
142  typedef std::list<Ptr<UanPhy> > UanPhyList;
143 
147  virtual State GetState (void) const = 0;
148 
152  virtual bool IsRx (void) const = 0;
156  virtual bool IsTx (void) const = 0;
160  virtual const ArrivalList &GetArrivalList (void) const = 0;
168  virtual void Receive (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) = 0;
176  virtual void Transmit (Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) = 0;
180  virtual void SetChannel (Ptr<UanChannel> chan) = 0;
184  virtual Ptr<UanChannel> GetChannel (void) const = 0;
188  virtual void AddPhy (Ptr<UanPhy> phy) = 0;
192  virtual const UanPhyList &GetPhyList (void) const = 0;
196  virtual void Clear (void) = 0;
197 
198 };
199 
200 } // namespace ns3
201 
202 #endif /* UAN_TRANSDUCER_H */
UanPdp GetPdp(void) const
keep track of time unit.
Definition: nstime.h:149
Time GetArrivalTime(void) const
virtual const UanPhyList & GetPhyList(void) const =0
virtual bool IsRx(void) const =0
std::list< Ptr< UanPhy > > UanPhyList
UanPhyList is a standard template library list of UanPhy objects.
virtual const ArrivalList & GetArrivalList(void) const =0
UanPacketArrival(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp, Time arrTime)
virtual void Receive(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp)=0
Receive Notify this object that a new packet has arrived at this nodes location.
virtual void AddPhy(Ptr< UanPhy > phy)=0
virtual State GetState(void) const =0
Ptr< Packet > GetPacket(void) const
virtual void SetChannel(Ptr< UanChannel > chan)=0
const UanTxMode & GetTxMode(void) const
virtual void Clear(void)=0
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:36
Virtual base for Transducer objects.
std::list< UanPacketArrival > ArrivalList
Arrival list is a standard template library list of UanPacketArrivals objects.
double GetRxPowerDb(void) const
virtual Ptr< UanChannel > GetChannel(void) const =0
virtual bool IsTx(void) const =0
virtual void Transmit(Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)=0
Transmit a packet from this transducer.
State
Transducer state (receiving or transmitting)
a base class which provides memory management and object aggregation
Definition: object.h:63
a unique identifier for an interface.
Definition: type-id.h:44
Class consisting of packet arrival information (Time, RxPower, mode, PDP)