View | Details | Raw Unified | Return to bug 251
Collapse All | Expand All

(-)a/src/helper/mobility-helper.cc (+36 lines)
 Lines 23-28    Link Here 
23
#include "ns3/hierarchical-mobility-model.h"
23
#include "ns3/hierarchical-mobility-model.h"
24
#include "ns3/log.h"
24
#include "ns3/log.h"
25
#include "ns3/pointer.h"
25
#include "ns3/pointer.h"
26
#include "ns3/config.h"
27
#include "ns3/simulator.h"
26
28
27
namespace ns3 {
29
namespace ns3 {
28
30
 Lines 153-156   MobilityHelper::InstallAll (void) Link Here 
153
  Install (NodeContainer::GetGlobal ());
155
  Install (NodeContainer::GetGlobal ());
154
}
156
}
155
157
158
void
159
MobilityHelper::CourseChanged (std::ostream *os, Ptr<const MobilityModel> mobility)
160
{
161
  Ptr<Node> node = mobility->GetObject<Node> ();
162
  *os << "now=" << Simulator::Now ()
163
      << " node=" << node->GetId () 
164
      << " pos=" << mobility->GetPosition () 
165
      << " vel=" << mobility->GetVelocity ()
166
      << std::endl;
167
}
168
169
void 
170
MobilityHelper::EnableAscii (std::ostream &os, uint32_t nodeid)
171
{
172
  std::ostringstream oss;
173
  oss << "/NodeList/" << nodeid << "/$ns3::MobilityModel/CourseChange";
174
  Config::ConnectWithoutContext (oss.str (), 
175
                                 MakeBoundCallback (&MobilityHelper::CourseChanged, &os));
176
}
177
void 
178
MobilityHelper::EnableAscii (std::ostream &os, NodeContainer n)
179
{
180
  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
181
    {
182
      EnableAscii (os, (*i)->GetId ());
183
    }
184
}
185
void 
186
MobilityHelper::EnableAsciiAll (std::ostream &os)
187
{
188
  EnableAscii (os, NodeContainer::GetGlobal ());
189
}
190
191
156
} // namespace ns3
192
} // namespace ns3
(-)a/src/helper/mobility-helper.h (-1 / +29 lines)
 Lines 163-170   public: Link Here 
163
   * exist in the simulation.
163
   * exist in the simulation.
164
   */
164
   */
165
  void InstallAll (void);
165
  void InstallAll (void);
166
167
  /**
168
   * \param os output stream
169
   * \param nodeid the id of the node to generate ascii output for.
170
   *
171
   * Enable ascii output on the mobility model associated to the
172
   * specified nodeid and dump that to the specified stdc++ output 
173
   * stream.
174
   */
175
  static void EnableAscii (std::ostream &os, uint32_t nodeid);
176
  /**
177
   * \param os output stream
178
   * \param n node container
179
   *
180
   * Enable ascii output on the mobility model associated each of
181
   * the nodes in the input container and dump that to the 
182
   * specified stdc++ output stream.
183
   */
184
  static void EnableAscii (std::ostream &os, NodeContainer n);
185
  /**
186
   * \param os output stream
187
   *
188
   * Enable ascii output on the mobility model associated
189
   * every node in the system and dump that to the specified 
190
   * stdc++ output stream.
191
   */
192
  static void EnableAsciiAll (std::ostream &os);
193
166
private:
194
private:
167
195
  static void CourseChanged (std::ostream *os, Ptr<const MobilityModel> mobility);
168
  std::vector<Ptr<MobilityModel> > m_mobilityStack;
196
  std::vector<Ptr<MobilityModel> > m_mobilityStack;
169
  ObjectFactory m_mobility;
197
  ObjectFactory m_mobility;
170
  Ptr<PositionAllocator> m_position;
198
  Ptr<PositionAllocator> m_position;

Return to bug 251