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 #include "application-container.h" 00021 00022 namespace ns3 { 00023 00024 ApplicationContainer::ApplicationContainer () 00025 {} 00026 00027 ApplicationContainer::ApplicationContainer (Ptr<Application> app) 00028 { 00029 m_applications.push_back (app); 00030 } 00031 00032 ApplicationContainer::Iterator 00033 ApplicationContainer::Begin (void) const 00034 { 00035 return m_applications.begin (); 00036 } 00037 ApplicationContainer::Iterator 00038 ApplicationContainer::End (void) const 00039 { 00040 return m_applications.end (); 00041 } 00042 00043 uint32_t 00044 ApplicationContainer::GetN (void) const 00045 { 00046 return m_applications.size (); 00047 } 00048 Ptr<Application> 00049 ApplicationContainer::Get (uint32_t i) const 00050 { 00051 return m_applications[i]; 00052 } 00053 void 00054 ApplicationContainer::Add (ApplicationContainer other) 00055 { 00056 for (Iterator i = other.Begin (); i != other.End (); i++) 00057 { 00058 m_applications.push_back (*i); 00059 } 00060 } 00061 void 00062 ApplicationContainer::Add (Ptr<Application> application) 00063 { 00064 m_applications.push_back (application); 00065 } 00066 00067 void 00068 ApplicationContainer::Start (Time start) 00069 { 00070 for (Iterator i = Begin (); i != End (); ++i) 00071 { 00072 Ptr<Application> app = *i; 00073 app->Start (start); 00074 } 00075 } 00076 void 00077 ApplicationContainer::Stop (Time stop) 00078 { 00079 for (Iterator i = Begin (); i != End (); ++i) 00080 { 00081 Ptr<Application> app = *i; 00082 app->Stop (stop); 00083 } 00084 } 00085 00086 00087 } // namespace ns3