A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
channel.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 */
4
5#ifndef NS3_CHANNEL_H
6#define NS3_CHANNEL_H
7
8#include "ns3/object.h"
9#include "ns3/ptr.h"
10
11#include <stdint.h>
12#include <string>
13
14namespace ns3
15{
16
17class NetDevice;
18
19/**
20 * \ingroup network
21 * \defgroup channel Channel
22 */
23/**
24 * \ingroup channel
25 * \brief Abstract Channel Base Class.
26 *
27 * A channel is a logical path over which information flows. The path can
28 * be as simple as a short piece of wire, or as complicated as space-time.
29 *
30 * Subclasses must use Simulator::ScheduleWithContext to correctly update
31 * event contexts when scheduling an event from one node to another one.
32 */
33class Channel : public Object
34{
35 public:
36 /**
37 * \brief Get the type ID.
38 * \return the object TypeId
39 */
40 static TypeId GetTypeId();
41
42 Channel();
43 ~Channel() override;
44
45 /**
46 * \returns the unique id of this channel
47 *
48 * This unique id happens to be also the index of the Channel into
49 * the ChannelList.
50 */
51 uint32_t GetId() const;
52
53 /**
54 * \returns the number of NetDevices connected to this Channel.
55 *
56 * This method must be implemented by subclasses.
57 */
58 virtual std::size_t GetNDevices() const = 0;
59 /**
60 * \param i index of NetDevice to retrieve
61 * \returns one of the NetDevices connected to this channel.
62 *
63 * This method must be implemented by subclasses.
64 */
65 virtual Ptr<NetDevice> GetDevice(std::size_t i) const = 0;
66
67 private:
68 uint32_t m_id; //!< Channel id for this channel
69};
70
71} // namespace ns3
72
73#endif /* NS3_CHANNEL_H */
Abstract Channel Base Class.
Definition channel.h:34
uint32_t m_id
Channel id for this channel.
Definition channel.h:68
virtual Ptr< NetDevice > GetDevice(std::size_t i) const =0
uint32_t GetId() const
Definition channel.cc:50
virtual std::size_t GetNDevices() const =0
static TypeId GetTypeId()
Get the type ID.
Definition channel.cc:23
~Channel() override
Definition channel.cc:44
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.