src/node/node-list.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 17 Apr 2008 13:42:25 -0700
changeset 2965 4b28e9740e3b
parent 2943 cdbcd43a019c
child 2989 b7eb3929096c
permissions -rw-r--r--
get rid of Attribute class. Use AttributeValue subclasses directly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * GNU General Public License for more details.
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 * Authors: 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 *  Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
 */
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    22
#include "ns3/simulator.h"
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    23
#include "ns3/object-vector.h"
2532
86a40c7cbfe9 register and unregister the NodeList as a config root namespace
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2480
diff changeset
    24
#include "ns3/config.h"
2898
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    25
#include "ns3/log.h"
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
#include "node-list.h"
729
b5e744285e92 rename i-node to node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 728
diff changeset
    27
#include "node.h"
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
namespace ns3 {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
2898
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    31
NS_LOG_COMPONENT_DEFINE ("NodeList");
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    32
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    33
/**
2943
cdbcd43a019c add a few missing ns3:: prefixes in TypeId names.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2933
diff changeset
    34
 * \brief private implementation detail of the NodeList API.
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    35
 */
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    36
class NodeListPriv : public Object
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    37
{
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    38
public:
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    39
  static TypeId GetTypeId (void);
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    40
  NodeListPriv ();
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    41
  ~NodeListPriv ();
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    42
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    43
  uint32_t Add (Ptr<Node> node);
1383
12f30b7defb4 constify
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1368
diff changeset
    44
  NodeList::Iterator Begin (void) const;
12f30b7defb4 constify
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1368
diff changeset
    45
  NodeList::Iterator End (void) const;
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    46
  Ptr<Node> GetNode (uint32_t n);
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    47
  uint32_t GetNNodes (void);
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    48
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    49
  static Ptr<NodeListPriv> Get (void);
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    50
  
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    51
private:
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    52
  static Ptr<NodeListPriv> *DoGet (void);
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    53
  static void Delete (void);
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    54
  std::vector<Ptr<Node> > m_nodes;
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    55
};
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    56
2943
cdbcd43a019c add a few missing ns3:: prefixes in TypeId names.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2933
diff changeset
    57
NS_OBJECT_ENSURE_REGISTERED (NodeListPriv);
cdbcd43a019c add a few missing ns3:: prefixes in TypeId names.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2933
diff changeset
    58
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    59
TypeId 
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    60
NodeListPriv::GetTypeId (void)
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    61
{
2943
cdbcd43a019c add a few missing ns3:: prefixes in TypeId names.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2933
diff changeset
    62
  static TypeId tid = TypeId ("ns3::NodeListPriv")
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    63
    .SetParent<Object> ()
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    64
    .AddAttribute ("NodeList", "The list of all nodes created during the simulation.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2943
diff changeset
    65
                   ObjectVectorValue (),
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    66
                   MakeObjectVectorAccessor (&NodeListPriv::m_nodes),
2933
c7983cfa2cb3 add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2898
diff changeset
    67
                   MakeObjectVectorChecker<Node> ())
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    68
    ;
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    69
  return tid;
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    70
}
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    71
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    72
Ptr<NodeListPriv> 
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    73
NodeListPriv::Get (void)
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    74
{
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    75
  return *DoGet ();
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    76
}  
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    77
Ptr<NodeListPriv> *
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    78
NodeListPriv::DoGet (void)
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    79
{
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    80
  static Ptr<NodeListPriv> ptr = 0;
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    81
  if (ptr == 0)
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    82
    {
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    83
      ptr = CreateObject<NodeListPriv> ();
2532
86a40c7cbfe9 register and unregister the NodeList as a config root namespace
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2480
diff changeset
    84
      Config::RegisterRootNamespaceObject (ptr);
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    85
      Simulator::ScheduleDestroy (&NodeListPriv::Delete);
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    86
    }
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    87
  return &ptr;
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    88
}
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    89
void 
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    90
NodeListPriv::Delete (void)
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    91
{
2898
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    92
  NS_LOG_FUNCTION;
2532
86a40c7cbfe9 register and unregister the NodeList as a config root namespace
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2480
diff changeset
    93
  Config::UnregisterRootNamespaceObject (Get ());
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    94
  (*DoGet ()) = 0;
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    95
}
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    96
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
    97
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
    98
NodeListPriv::NodeListPriv ()
2898
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    99
{
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   100
  NS_LOG_FUNCTION;
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   101
}
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   102
NodeListPriv::~NodeListPriv ()
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   103
{
2898
6993ee3fa5a3 add some debugging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   104
  NS_LOG_FUNCTION;
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   105
  for (std::vector<Ptr<Node> >::iterator i = m_nodes.begin ();
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   106
       i != m_nodes.end (); i++)
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   107
    {
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   108
      Ptr<Node> node = *i;
485
152927527647 rename NodeList::GetNode to NodeList::PeekNode to avoid memory leaks. Call Dispose from NodeListPriv::~NodeListPriv
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 484
diff changeset
   109
      node->Dispose ();
551
12ed30c77cab revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 546
diff changeset
   110
      *i = 0;
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   111
    }
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   112
  m_nodes.erase (m_nodes.begin (), m_nodes.end ());
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   113
}
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   114
359
91b7ad7fa784 OnOffApplication functioning; some Node class cleanup
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
   115
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   116
uint32_t
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   117
NodeListPriv::Add (Ptr<Node> node)
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   118
{
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   119
  uint32_t index = m_nodes.size ();
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   120
  m_nodes.push_back (node);
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   121
  return index;
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   122
  
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   123
}
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   124
NodeList::Iterator 
1383
12f30b7defb4 constify
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1368
diff changeset
   125
NodeListPriv::Begin (void) const
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   126
{
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   127
  return m_nodes.begin ();
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   128
}
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   129
NodeList::Iterator 
1383
12f30b7defb4 constify
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1368
diff changeset
   130
NodeListPriv::End (void) const
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   131
{
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   132
  return m_nodes.end ();
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   133
}
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   134
uint32_t 
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   135
NodeListPriv::GetNNodes (void)
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   136
{
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   137
  return m_nodes.size ();
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   138
}
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   139
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   140
Ptr<Node>
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   141
NodeListPriv::GetNode (uint32_t n)
564
4da6cc2af83f make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 562
diff changeset
   142
{
4da6cc2af83f make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 562
diff changeset
   143
  return m_nodes[n];
4da6cc2af83f make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 562
diff changeset
   144
}
4da6cc2af83f make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 562
diff changeset
   145
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   146
}
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   147
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   148
/**
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   149
 * The implementation of the public static-based API
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   150
 * which calls into the private implementation through
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   151
 * the simulation singleton.
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   152
 */
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   153
namespace ns3 {
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   154
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 425
diff changeset
   155
uint32_t
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   156
NodeList::Add (Ptr<Node> node)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   157
{
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
   158
  return NodeListPriv::Get ()->Add (node);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   159
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   160
NodeList::Iterator 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   161
NodeList::Begin (void)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   162
{
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
   163
  return NodeListPriv::Get ()->Begin ();
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   164
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   165
NodeList::Iterator 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   166
NodeList::End (void)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   167
{
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
   168
  return NodeListPriv::Get ()->End ();
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   169
}
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   170
Ptr<Node>
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
   171
NodeList::GetNode (uint32_t n)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   172
{
2480
2538b244b3c7 convert NodeList to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1420
diff changeset
   173
  return NodeListPriv::Get ()->GetNode (n);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   174
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   175
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   176
}//namespace ns3