LEFT | RIGHT |
(no file at all) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2008 INRIA |
| 4 * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle. |
| 5 * |
| 6 * This program is free software; you can redistribute it and/or modify |
| 7 * it under the terms of the GNU General Public License version 2 as |
| 8 * published by the Free Software Foundation; |
| 9 * |
| 10 * This program is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 * GNU General Public License for more details. |
| 14 * |
| 15 * You should have received a copy of the GNU General Public License |
| 16 * along with this program; if not, write to the Free Software |
| 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 * |
| 19 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 20 * Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu> |
| 21 */ |
| 22 |
| 23 #ifndef WIRELESS_MODULE_UTILITY_CONTAINER_H |
| 24 #define WIRELESS_MODULE_UTILITY_CONTAINER_H |
| 25 |
| 26 #include "ns3/wireless-module-utility.h" |
| 27 #include <vector> |
| 28 #include <stdint.h> |
| 29 |
| 30 namespace ns3 { |
| 31 |
| 32 /** |
| 33 * \brief Holds a vector of ns3::WirelessModuleUtility pointers. |
| 34 * |
| 35 * JammerHelper returns a list of WirelessModuleUtility pointers installed onto |
| 36 * nodes. Users can use this list to access WirelessModuleUtility objects on a |
| 37 * node easily. |
| 38 * |
| 39 * \see NetDeviceContainer |
| 40 */ |
| 41 class WirelessModuleUtilityContainer |
| 42 { |
| 43 public: |
| 44 typedef std::vector< Ptr<WirelessModuleUtility> >::const_iterator Iterator; |
| 45 |
| 46 public: |
| 47 /** |
| 48 * Creates an empty WirelessModuleUtilityContainer. |
| 49 */ |
| 50 WirelessModuleUtilityContainer (); |
| 51 |
| 52 /** |
| 53 * \param source Pointer to an WirelessModuleUtility. |
| 54 * |
| 55 * Creates an WirelessModuleUtilityContainer with exactly one WirelessModuleUt
ility |
| 56 * object previously instantiated. |
| 57 */ |
| 58 WirelessModuleUtilityContainer (Ptr<WirelessModuleUtility> utility); |
| 59 |
| 60 /** |
| 61 * \param utilityName Name of WirelessModuleUtility. |
| 62 * |
| 63 * Creates an WirelessModuleUtilityContainer with exactly one WirelessModuleUt
ility |
| 64 * object previously instantiated and assigned a name using the Object name |
| 65 * service. This WirelessModuleUtility is specified by its assigned name. |
| 66 */ |
| 67 WirelessModuleUtilityContainer (std::string utilityName); |
| 68 |
| 69 /** |
| 70 * \param a A WirelessModuleUtilityContainer. |
| 71 * \param b Another WirelessModuleUtilityContainer. |
| 72 * |
| 73 * Creates an WirelessModuleUtilityContainer by concatenating container b to a
. |
| 74 * |
| 75 * \note Can be used to concatenate 2 Ptr<WirelessModuleUtility> directly. C++ |
| 76 * will be calling WirelessModuleUtilityContainer constructor with |
| 77 * Ptr<WirelessModuleUtility> first. |
| 78 */ |
| 79 WirelessModuleUtilityContainer (const WirelessModuleUtilityContainer &a, |
| 80 const WirelessModuleUtilityContainer &b); |
| 81 |
| 82 /** |
| 83 * \brief Get an iterator which refers to the first WirelessModuleUtility |
| 84 * pointer in the container. |
| 85 * |
| 86 * \returns An iterator which refers to the first WirelessModuleUtility in |
| 87 * container. |
| 88 * |
| 89 * WirelessModuleUtility Objects can be retrieved from the container in two |
| 90 * ways. First, directly by an index into the container, and second, using an |
| 91 * iterator. This method is used in the iterator method and is typically used |
| 92 * in a for-loop to run through the WirelessModuleUtility Objects. |
| 93 * |
| 94 * \code |
| 95 * WirelessModuleUtilityContainer::Iterator i; |
| 96 * for (i = container.Begin (); i != container.End (); ++i) |
| 97 * { |
| 98 * (*i)->method (); // some WirelessModuleUtility method |
| 99 * } |
| 100 * \endcode |
| 101 */ |
| 102 Iterator Begin (void) const; |
| 103 |
| 104 /** |
| 105 * \brief Get an iterator which refers to the last WirelessModuleUtility |
| 106 * pointer in the container. |
| 107 * |
| 108 * \returns An iterator which refers to the last WirelessModuleUtility in |
| 109 * container. |
| 110 * |
| 111 * WirelessModuleUtility Objects can be retrieved from the container in two |
| 112 * ways. First, directly by an index into the container, and second, using an |
| 113 * iterator. This method is used in the iterator method and is typically used |
| 114 * in a for-loop to run through the WirelessModuleUtility Objects. |
| 115 * |
| 116 * \code |
| 117 * WirelessModuleUtilityContainer::Iterator i; |
| 118 * for (i = container.Begin (); i != container.End (); ++i) |
| 119 * { |
| 120 * (*i)->method (); // some WirelessModuleUtility method |
| 121 * } |
| 122 * \endcode |
| 123 */ |
| 124 Iterator End (void) const; |
| 125 |
| 126 /** |
| 127 * \brief Get the number of Ptr<WirelessModuleUtility> stored in this |
| 128 * container. |
| 129 * |
| 130 * \returns The number of Ptr<WirelessModuleUtility> stored in this container. |
| 131 */ |
| 132 uint32_t GetN (void) const; |
| 133 |
| 134 /** |
| 135 * \brief Get the i-th Ptr<WirelessModuleUtility> stored in this container. |
| 136 * |
| 137 * \param i Index of the requested Ptr<WirelessModuleUtility>. |
| 138 * \returns The requested Ptr<WirelessModuleUtility>. |
| 139 */ |
| 140 Ptr<WirelessModuleUtility> Get (uint32_t i) const; |
| 141 |
| 142 /** |
| 143 * \param container Another WirelessModuleUtilityContainer to append. |
| 144 * |
| 145 * Appends the contents of another WirelessModuleUtilityContainer to the end |
| 146 * of this WirelessModuleUtilityContainer. |
| 147 */ |
| 148 void Add (WirelessModuleUtilityContainer container); |
| 149 |
| 150 /** |
| 151 * \brief Append a single Ptr<WirelessModuleUtility> to the end of this |
| 152 * container. |
| 153 * |
| 154 * \param source Pointer to an WirelessModuleUtility. |
| 155 */ |
| 156 void Add (Ptr<WirelessModuleUtility> utility); |
| 157 |
| 158 /** |
| 159 * \brief Append a single Ptr<WirelessModuleUtility> referred to by its object |
| 160 * name to the end of this container. |
| 161 * |
| 162 * \param utilityName Name of WirelessModuleUtility object. |
| 163 */ |
| 164 void Add (std::string utilityName); |
| 165 |
| 166 |
| 167 private: |
| 168 std::vector< Ptr<WirelessModuleUtility> > m_utilities; |
| 169 |
| 170 }; |
| 171 |
| 172 } // namespace ns3 |
| 173 |
| 174 #endif /* WIRELESS_MODULE_UTILITY_CONTAINER_H */ |
LEFT | RIGHT |