A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
zigbee-stack-container.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 Tokushima University, Japan
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author:
7
* Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
8
*/
9
10
#ifndef ZIGBEE_STACK_CONTAINER_H
11
#define ZIGBEE_STACK_CONTAINER_H
12
13
#include "ns3/zigbee-stack.h"
14
15
#include <stdint.h>
16
#include <vector>
17
18
namespace
ns3
19
{
20
namespace
zigbee
21
{
22
23
/**
24
* Holds a vector of ns3::ZigbeeStack pointers
25
*
26
* Typically ZigbeeStacks are installed on top of a pre-existing NetDevice
27
* (an LrWpanNetDevice) which on itself has already being aggregated to a node.
28
* A ZigbeeHelper Install method takes a LrWpanNetDeviceContainer.
29
* For each of the LrWpanNetDevice in the LrWpanNetDeviceContainer
30
* the helper will instantiate a ZigbeeStack, connect the necessary hooks between
31
* the MAC (LrWpanMac) and the NWK (ZigbeeNwk) and install it to the node.
32
* For each of these ZigbeeStacks, the helper also adds the ZigbeeStack into a Container
33
* for later use by the caller. This is that container used to hold the Ptr<ZigbeeStack> which are
34
* instantiated by the ZigbeeHelper.
35
*/
36
class
ZigbeeStackContainer
37
{
38
public
:
39
typedef
std::vector<Ptr<ZigbeeStack>>::const_iterator
40
Iterator
;
//!< The iterator used in this Container
41
42
/**
43
* The default constructor, create an empty ZigbeeStackContainer
44
*/
45
ZigbeeStackContainer
();
46
/**
47
* Create a ZigbeeStackContainer with exactly one ZigbeeStack that has previously
48
* been instantiated
49
*
50
* @param stack A ZigbeeStack to add to the container
51
*/
52
ZigbeeStackContainer
(
Ptr<ZigbeeStack>
stack);
53
/**
54
* Create a ZigbeeStackContainer with exactly one device which has been
55
* previously instantiated and assigned a name using the Object name
56
* service. This ZigbeeStack is specified by its assigned name.
57
*
58
* @param stackName The name of the ZigbeeStack to add to the container
59
*
60
* Create a ZigbeeStackContainer with exactly one device
61
*/
62
ZigbeeStackContainer
(std::string stackName);
63
/**
64
* Get and iterator which refers to the first ZigbeeStack in the container.
65
* @return An iterator referring to the first ZigbeeStack in the container.
66
*/
67
Iterator
Begin
()
const
;
68
/**
69
* Get an iterator which indicates past the last ZigbeeStack in the container.
70
* @return An iterator referring to the past the last ZigbeeStack in the container.
71
*/
72
Iterator
End
()
const
;
73
/**
74
* Get the number of stacks present in the stack container.
75
* @return The number of stacks in the container.
76
*/
77
uint32_t
GetN
()
const
;
78
/**
79
* Get a stack element from the container.
80
* @param i The element number in the container
81
* @return The zigbee stack element matching the i index in the container.
82
*/
83
Ptr<ZigbeeStack>
Get
(
uint32_t
i)
const
;
84
/**
85
* Append the contents of another ZigbeeStackContainer to the end of
86
* this container.
87
*
88
* @param other The ZigbeeStackContainer to append.
89
*/
90
void
Add
(
ZigbeeStackContainer
other);
91
/**
92
* Append a single Ptr<ZigbeeStack> to this container.
93
*
94
* @param stack The Ptr<ZigbeeStack> to append.
95
*/
96
void
Add
(
Ptr<ZigbeeStack>
stack);
97
/**
98
* Append to this container the single Ptr<ZigbeeStack> referred to
99
* via its object name service registered name.
100
*
101
* @param stackName The name of the ZigbeeStack object to add to the container.
102
*/
103
void
Add
(std::string stackName);
104
105
private
:
106
std::vector<Ptr<ZigbeeStack>>
m_stacks
;
//!< ZigbeeStack smart pointers
107
};
108
109
}
// namespace zigbee
110
}
// namespace ns3
111
112
#endif
/* ZIGBEE_STACK_CONTAINER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::zigbee::ZigbeeStackContainer
Holds a vector of ns3::ZigbeeStack pointers.
Definition
zigbee-stack-container.h:37
ns3::zigbee::ZigbeeStackContainer::m_stacks
std::vector< Ptr< ZigbeeStack > > m_stacks
ZigbeeStack smart pointers.
Definition
zigbee-stack-container.h:106
ns3::zigbee::ZigbeeStackContainer::GetN
uint32_t GetN() const
Get the number of stacks present in the stack container.
Definition
zigbee-stack-container.cc:47
ns3::zigbee::ZigbeeStackContainer::End
Iterator End() const
Get an iterator which indicates past the last ZigbeeStack in the container.
Definition
zigbee-stack-container.cc:41
ns3::zigbee::ZigbeeStackContainer::Begin
Iterator Begin() const
Get and iterator which refers to the first ZigbeeStack in the container.
Definition
zigbee-stack-container.cc:35
ns3::zigbee::ZigbeeStackContainer::Get
Ptr< ZigbeeStack > Get(uint32_t i) const
Get a stack element from the container.
Definition
zigbee-stack-container.cc:53
ns3::zigbee::ZigbeeStackContainer::Add
void Add(ZigbeeStackContainer other)
Append the contents of another ZigbeeStackContainer to the end of this container.
Definition
zigbee-stack-container.cc:59
ns3::zigbee::ZigbeeStackContainer::Iterator
std::vector< Ptr< ZigbeeStack > >::const_iterator Iterator
The iterator used in this Container.
Definition
zigbee-stack-container.h:40
ns3::zigbee::ZigbeeStackContainer::ZigbeeStackContainer
ZigbeeStackContainer()
The default constructor, create an empty ZigbeeStackContainer.
Definition
zigbee-stack-container.cc:19
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
zigbee
helper
zigbee-stack-container.h
Generated on Tue Feb 18 2025 18:20:56 for ns-3 by
1.11.0