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 JAMMER_CONTAINER_H |
| 24 #define JAMMER_CONTAINER_H |
| 25 |
| 26 #include "ns3/jammer.h" |
| 27 #include <vector> |
| 28 #include <stdint.h> |
| 29 |
| 30 namespace ns3 { |
| 31 |
| 32 /** |
| 33 * \brief Holds a vector of ns3::Jammer pointers. |
| 34 * |
| 35 * JammerHelper returns a list of Jammer pointers installed onto nodes. Users |
| 36 * can use this list to access Jammer objects on a node easily. |
| 37 * |
| 38 * \see NetDeviceContainer |
| 39 */ |
| 40 class JammerContainer |
| 41 { |
| 42 public: |
| 43 typedef std::vector< Ptr<Jammer> >::const_iterator Iterator; |
| 44 |
| 45 public: |
| 46 /** |
| 47 * Creates an empty JammerContainer. |
| 48 */ |
| 49 JammerContainer (); |
| 50 |
| 51 /** |
| 52 * \param source Pointer to an Jammer. |
| 53 * |
| 54 * Creates an JammerContainer with exactly one Jammer previously instantiated. |
| 55 */ |
| 56 JammerContainer (Ptr<Jammer> jammer); |
| 57 |
| 58 /** |
| 59 * \param jammerName Name of Jammer. |
| 60 * |
| 61 * Creates an JammerContainer with exactly one Jammer previously instantiated |
| 62 * and assigned a name using the Object name service. This Jammer is specified |
| 63 * by its assigned name. |
| 64 */ |
| 65 JammerContainer (std::string jammerName); |
| 66 |
| 67 /** |
| 68 * \param a A JammerContainer. |
| 69 * \param b Another JammerContainer. |
| 70 * |
| 71 * Creates an JammerContainer by concatenating JammerContainer b to |
| 72 * JammerContainer a. |
| 73 * |
| 74 * \note Can be used to concatenate 2 Ptr<Jammer> directly. C++ will be |
| 75 * calling JammerContainer constructor with Ptr<Jammer> first. |
| 76 */ |
| 77 JammerContainer (const JammerContainer &a, const JammerContainer &b); |
| 78 |
| 79 /** |
| 80 * \brief Get an iterator which refers to the first Jammer pointer in |
| 81 * the container. |
| 82 * |
| 83 * \returns An iterator which refers to the first Jammer in container. |
| 84 * |
| 85 * Jammer can be retrieved from the container in two ways. First, directly by |
| 86 * an index into the container, and second, using an iterator. This method is |
| 87 * used in the iterator method and is typically used in a for-loop to run |
| 88 * through the Jammer. |
| 89 * |
| 90 * \code |
| 91 * JammerContainer::Iterator i; |
| 92 * for (i = container.Begin (); i != container.End (); ++i) |
| 93 * { |
| 94 * (*i)->method (); // some Jammer method |
| 95 * } |
| 96 * \endcode |
| 97 */ |
| 98 Iterator Begin (void) const; |
| 99 |
| 100 /** |
| 101 * \brief Get an iterator which refers to the last Jammer pointer in the |
| 102 * container. |
| 103 * |
| 104 * \returns An iterator which refers to the last Jammer in container. |
| 105 * |
| 106 * Jammer can be retrieved from the container in two ways. First, directly by |
| 107 * an index into the container, and second, using an iterator. This method is |
| 108 * used in the iterator method and is typically used in a for-loop to run |
| 109 * through the Jammer. |
| 110 * |
| 111 * \code |
| 112 * JammerContainer::Iterator i; |
| 113 * for (i = container.Begin (); i != container.End (); ++i) |
| 114 * { |
| 115 * (*i)->method (); // some Jammer method |
| 116 * } |
| 117 * \endcode |
| 118 */ |
| 119 Iterator End (void) const; |
| 120 |
| 121 /** |
| 122 * \brief Get the number of Ptr<Jammer> stored in this container. |
| 123 * |
| 124 * \returns The number of Ptr<Jammer> stored in this container. |
| 125 */ |
| 126 uint32_t GetN (void) const; |
| 127 |
| 128 /** |
| 129 * \brief Get the i-th Ptr<Jammer> stored in this container. |
| 130 * |
| 131 * \param i Index of the requested Ptr<Jammer>. |
| 132 * \returns The requested Ptr<Jammer>. |
| 133 */ |
| 134 Ptr<Jammer> Get (uint32_t i) const; |
| 135 |
| 136 /** |
| 137 * \param container Another JammerContainer to append. |
| 138 * |
| 139 * Appends the contents of another JammerContainer to the end of this |
| 140 * JammerContainer. |
| 141 */ |
| 142 void Add (JammerContainer container); |
| 143 |
| 144 /** |
| 145 * \brief Append a single Ptr<Jammer> to the end of this container. |
| 146 * |
| 147 * \param source Pointer to an Jammer. |
| 148 */ |
| 149 void Add (Ptr<Jammer> jammer); |
| 150 |
| 151 /** |
| 152 * \brief Append a single Ptr<Jammer> referred to by its object name to |
| 153 * the end of this container. |
| 154 * |
| 155 * \param jammerName Name of Jammer object. |
| 156 */ |
| 157 void Add (std::string jammerName); |
| 158 |
| 159 |
| 160 private: |
| 161 std::vector< Ptr<Jammer> > m_jammers; |
| 162 |
| 163 }; |
| 164 |
| 165 } // namespace ns3 |
| 166 |
| 167 #endif /* JAMMER_CONTAINER_H */ |
LEFT | RIGHT |