A Discrete-Event Network Simulator
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
18namespace ns3
19{
20namespace 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 */
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 */
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 */
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 */
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 */
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::ZigbeeStack pointers.
std::vector< Ptr< ZigbeeStack > > m_stacks
ZigbeeStack smart pointers.
uint32_t GetN() const
Get the number of stacks present in the stack container.
Iterator End() const
Get an iterator which indicates past the last ZigbeeStack in the container.
Iterator Begin() const
Get and iterator which refers to the first ZigbeeStack in the container.
Ptr< ZigbeeStack > Get(uint32_t i) const
Get a stack element from the container.
void Add(ZigbeeStackContainer other)
Append the contents of another ZigbeeStackContainer to the end of this container.
std::vector< Ptr< ZigbeeStack > >::const_iterator Iterator
The iterator used in this Container.
ZigbeeStackContainer()
The default constructor, create an empty ZigbeeStackContainer.
Every class exported by the ns3 library is enclosed in the ns3 namespace.