00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2008 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef APPLICATION_CONTAINER_H 00021 #define APPLICATION_CONTAINER_H 00022 00023 #include <stdint.h> 00024 #include <vector> 00025 #include "ns3/application.h" 00026 00027 namespace ns3 { 00028 00029 /** 00030 * \brief holds a vector of ns3::Application pointers 00031 * 00032 */ 00033 class ApplicationContainer 00034 { 00035 public: 00036 /** 00037 * Create an empty ApplicationContainer. 00038 */ 00039 ApplicationContainer (); 00040 00041 /** 00042 * Create an ApplicationContainer with exactly one application 00043 * 00044 * \param application The application to add to the container 00045 */ 00046 ApplicationContainer (Ptr<Application> application); 00047 00048 typedef std::vector<Ptr<Application> >::const_iterator Iterator; 00049 00050 /** 00051 * \returns an iterator which points to the start of the array of pointers. 00052 */ 00053 Iterator Begin (void) const; 00054 /** 00055 * \returns an iterator which points to the end of the array of pointers. 00056 */ 00057 Iterator End (void) const; 00058 00059 /** 00060 * \returns the number of netdevice pointers stored in this container. 00061 */ 00062 uint32_t GetN (void) const; 00063 /** 00064 * \param i the index of the requested netdevice pointer. 00065 * \returns the requested netdevice pointer. 00066 */ 00067 Ptr<Application> Get (uint32_t i) const; 00068 00069 /** 00070 * \param other another netdevice container 00071 * 00072 * Append to the end of this container the other input container. 00073 */ 00074 void Add (ApplicationContainer other); 00075 /** 00076 * \param application another netdevice pointer. 00077 * 00078 * Append to the end of this container the input netdevice pointer. 00079 */ 00080 void Add (Ptr<Application> application); 00081 00082 void Start (Time start); 00083 void Stop (Time stop); 00084 00085 private: 00086 std::vector<Ptr<Application> > m_applications; 00087 }; 00088 00089 } // namespace ns3 00090 00091 #endif /* APPLICATION_CONTAINER_H */