00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2007 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 * Authors: 00019 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, 00020 */ 00021 #ifndef NODE_LIST_H 00022 #define NODE_LIST_H 00023 00024 #include <vector> 00025 #include "ns3/ptr.h" 00026 00027 namespace ns3 { 00028 00029 class Node; 00030 class CallbackBase; 00031 00032 00033 /** 00034 * \ingroup node 00035 * 00036 * \brief the list of simulation nodes. 00037 * 00038 * Every Node created is automatically added to this list. 00039 */ 00040 class NodeList 00041 { 00042 public: 00043 typedef std::vector< Ptr<Node> >::const_iterator Iterator; 00044 00045 /** 00046 * \param node node to add 00047 * \returns index of node in list. 00048 * 00049 * This method is called automatically from Node::Node so 00050 * the user has little reason to call it himself. 00051 */ 00052 static uint32_t Add (Ptr<Node> node); 00053 /** 00054 * \returns a C++ iterator located at the beginning of this 00055 * list. 00056 */ 00057 static Iterator Begin (void); 00058 /** 00059 * \returns a C++ iterator located at the end of this 00060 * list. 00061 */ 00062 static Iterator End (void); 00063 /** 00064 * \param n index of requested node. 00065 * \returns the Node associated to index n. 00066 */ 00067 static Ptr<Node> GetNode (uint32_t n); 00068 /** 00069 * \returns the number of nodes currently in the list. 00070 */ 00071 static uint32_t GetNNodes (void); 00072 }; 00073 00074 }//namespace ns3 00075 00076 00077 #endif /* NODE_LIST_H */