code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "simulator.h"
#include "realtime-simulator-impl.h"
#include "wall-clock-synchronizer.h"
#include "scheduler.h"
#include "event-impl.h"
#include "synchronizer.h"
#include "ptr.h"
#include "pointer.h"
#include "assert.h"
#include "fatal-error.h"
#include "log.h"
#include "system-mutex.h"
#include "boolean.h"
#include "enum.h"
#include <math.h>
NS_LOG_COMPONENT_DEFINE ("RealtimeSimulatorImpl");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (RealtimeSimulatorImpl);
TypeId
RealtimeSimulatorImpl::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::RealtimeSimulatorImpl")
.SetParent<SimulatorImpl> ()
.AddConstructor<RealtimeSimulatorImpl> ()
.AddAttribute ("SynchronizationMode",
"What to do if the simulation cannot keep up with real time.",
EnumValue (SYNC_BEST_EFFORT),
MakeEnumAccessor (&RealtimeSimulatorImpl::SetSynchronizationMode),
MakeEnumChecker (SYNC_BEST_EFFORT, "BestEffort",
SYNC_HARD_LIMIT, "HardLimit"))
.AddAttribute ("HardLimit",
"Maximum acceptable real-time jitter (used in conjunction with SynchronizationMode=HardLimit)",
TimeValue (Seconds (0.1)),
MakeTimeAccessor (&RealtimeSimulatorImpl::m_hardLimit),
MakeTimeChecker ())
;
return tid;
}
RealtimeSimulatorImpl::RealtimeSimulatorImpl ()
{
NS_LOG_FUNCTION_NOARGS ();
m_stop = false;
m_running = false;
// uids are allocated from 4.
// uid 0 is "invalid" events
// uid 1 is "now" events
// uid 2 is "destroy" events
m_uid = 4;
// before ::Run is entered, the m_currentUid will be zero
m_currentUid = 0;
m_currentTs = 0;
m_currentContext = 0xffffffff;
m_unscheduledEvents = 0;
// Be very careful not to do anything that would cause a change or assignment
// of the underlying reference counts of m_synchronizer or you will be sorry.
m_synchronizer = CreateObject<WallClockSynchronizer> ();
}
RealtimeSimulatorImpl::~RealtimeSimulatorImpl ()
{
}
void
RealtimeSimulatorImpl::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
while (m_events->IsEmpty () == false)
{
Scheduler::Event next = m_events->RemoveNext ();
next.impl->Unref ();
}
m_events = 0;
m_synchronizer = 0;
SimulatorImpl::DoDispose ();
}
void
RealtimeSimulatorImpl::Destroy ()
{
NS_LOG_FUNCTION_NOARGS ();
//
// This function is only called with the private version "disconnected" from
// the main simulator functions. We rely on the user not calling
// Simulator::Destroy while there is a chance that a worker thread could be
// accessing the current instance of the private object. In practice this
// means shutting down the workers and doing a Join() before calling the
// Simulator::Destroy().
//
while (m_destroyEvents.empty () == false)
{
Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl ();
m_destroyEvents.pop_front ();
NS_LOG_LOGIC ("handle destroy " << ev);
if (ev->IsCancelled () == false)
{
ev->Invoke ();
}
}
}
void
RealtimeSimulatorImpl::SetScheduler (ObjectFactory schedulerFactory)
{
NS_LOG_FUNCTION_NOARGS ();
Ptr<Scheduler> scheduler = schedulerFactory.Create<Scheduler> ();
{
CriticalSection cs (m_mutex);
if (m_events != 0)
{
while (m_events->IsEmpty () == false)
{
Scheduler::Event next = m_events->RemoveNext ();
scheduler->Insert (next);
}
}
m_events = scheduler;
}
}
void
RealtimeSimulatorImpl::ProcessOneEvent (void)
{
NS_LOG_FUNCTION_NOARGS ();
//
// The idea here is to wait until the next event comes due. In the case of
// a realtime simulation, we want real time to be consumed between events.
// It is the realtime synchronizer that causes real time to be consumed by
// doing some kind of a wait.
//
// We need to be able to have external events (such as a packet reception event)
// cause us to re-evaluate our state. The way this works is that the synchronizer
// gets interrupted and returns. So, there is a possibility that things may change
// out from under us dynamically. In this case, we need to re-evaluate how long to
// wait in a for-loop until we have waited sucessfully (until a timeout) for the
// event at the head of the event list.
//
// m_synchronizer->Synchronize will return true if the wait was completed without
// interruption, otherwise it will return false indicating that something has changed
// out from under us. If we sit in the for-loop trying to synchronize until
// Synchronize() returns true, we will have successfully synchronized the execution
// time of the next event with the wall clock time of the synchronizer.
//
for (;;)
{
uint64_t tsDelay = 0;
uint64_t tsNext = 0;
//
// It is important to understand that m_currentTs is interpreted only as the
// timestamp of the last event we executed. Current time can a bit of a
// slippery concept in realtime mode. What we have here is a discrete event
// simulator, so the last event is, by defintion, executed entirely at a single
// discrete time. This is the definition of m_currentTs. It really has
// nothing to do with the current real time, except that we are trying to arrange
// that at the instant of the beginning of event execution, the current real time
// and m_currentTs coincide.
//
// We use tsNow as the indication of the current real time.
//
uint64_t tsNow;
{
CriticalSection cs (m_mutex);
//
// Since we are in realtime mode, the time to delay has got to be the
// difference between the current realtime and the timestamp of the next
// event. Since m_currentTs is actually the timestamp of the last event we
// executed, it's not particularly meaningful for us here since real time has
// certainly elapsed since it was last updated.
//
// It is possible that the current realtime has drifted past the next event
// time so we need to be careful about that and not delay in that case.
//
NS_ASSERT_MSG (m_synchronizer->Realtime (),
"RealtimeSimulatorImpl::ProcessOneEvent (): Synchronizer reports not Realtime ()");
//
// tsNow is set to the normalized current real time. When the simulation was
// started, the current real time was effectively set to zero; so tsNow is
// the current "real" simulation time.
//
// tsNext is the simulation time of the next event we want to execute.
//
tsNow = m_synchronizer->GetCurrentRealtime ();
tsNext = NextTs ();
//
// tsDelay is therefore the real time we need to delay in order to bring the
// real time in sync with the simulation time. If we wait for this amount of
// real time, we will accomplish moving the simulation time at the same rate
// as the real time. This is typically called "pacing" the simulation time.
//
// We do have to be careful if we are falling behind. If so, tsDelay must be
// zero. If we're late, don't dawdle.
//
if (tsNext <= tsNow)
{
tsDelay = 0;
}
else
{
tsDelay = tsNext - tsNow;
}
//
// We've figured out how long we need to delay in order to pace the
// simulation time with the real time. We're going to sleep, but need
// to work with the synchronizer to make sure we're awakened if something
// external happens (like a packet is received). This next line resets
// the synchronizer so that any future event will cause it to interrupt.
//
m_synchronizer->SetCondition (false);
}
//
// We have a time to delay. This time may actually not be valid anymore
// since we released the critical section immediately above, and a real-time
// ScheduleReal or ScheduleRealNow may have snuck in, well, between the
// closing brace above and this comment so to speak. If this is the case,
// that schedule operation will have done a synchronizer Signal() that
// will set the condition variable to true and cause the Synchronize call
// below to return immediately.
//
// It's easiest to understand if you just consider a short tsDelay that only
// requires a SpinWait down in the synchronizer. What will happen is that
// whan Synchronize calls SpinWait, SpinWait will look directly at its
// condition variable. Note that we set this condition variable to false
// inside the critical section above.
//
// SpinWait will go into a forever loop until either the time has expired or
// until the condition variable becomes true. A true condition indicates that
// the wait should stop. The condition is set to true by one of the Schedule
// methods of the simulator; so if we are in a wait down in Synchronize, and
// a Simulator::ScheduleReal is done, the wait down in Synchronize will exit and
// Synchronize will return false. This means we have not actually synchronized
// to the event expiration time. If no real-time schedule operation is done
// while down in Synchronize, the wait will time out and Synchronize will return
// true. This indicates that we have synchronized to the event time.
//
// So we need to stay in this for loop, looking for the next event timestamp and
// attempting to sleep until its due. If we've slept until the timestamp is due,
// Synchronize returns true and we break out of the sync loop. If an external
// event happens that requires a re-schedule, Synchronize returns false and
// we re-evaluate our timing by continuing in the loop.
//
// It is expected that tsDelay become shorter as external events interrupt our
// waits.
//
if (m_synchronizer->Synchronize (tsNow, tsDelay))
{
NS_LOG_LOGIC ("Interrupted ...");
break;
}
//
// If we get to this point, we have been interrupted during a wait by a real-time
// schedule operation. This means all bets are off regarding tsDelay and we need
// to re-evaluate what it is we want to do. We'll loop back around in the
// for-loop and start again from scratch.
//
}
//
// If we break out of the for-loop above, we have waited until the time specified
// by the event that was at the head of the event list when we started the process.
// Since there is a bunch of code that was executed outside a critical section (the
// Synchronize call) we cannot be sure that the event at the head of the event list
// is the one we think it is. What we can be sure of is that it is time to execute
// whatever event is at the head of this list if the list is in time order.
//
Scheduler::Event next;
{
CriticalSection cs (m_mutex);
//
// We do know we're waiting for an event, so there had better be an event on the
// event queue. Let's pull it off. When we release the critical section, the
// event we're working on won't be on the list and so subsequent operations won't
// mess with us.
//
NS_ASSERT_MSG (m_events->IsEmpty () == false,
"RealtimeSimulatorImpl::ProcessOneEvent(): event queue is empty");
next = m_events->RemoveNext ();
m_unscheduledEvents--;
//
// We cannot make any assumption that "next" is the same event we originally waited
// for. We can only assume that only that it must be due and cannot cause time
// to move backward.
//
NS_ASSERT_MSG (next.key.m_ts >= m_currentTs,
"RealtimeSimulatorImpl::ProcessOneEvent(): "
"next.GetTs() earlier than m_currentTs (list order error)");
NS_LOG_LOGIC ("handle " << next.key.m_ts);
//
// Update the current simulation time to be the timestamp of the event we're
// executing. From the rest of the simulation's point of view, simulation time
// is frozen until the next event is executed.
//
m_currentTs = next.key.m_ts;
m_currentContext = next.key.m_context;
m_currentUid = next.key.m_uid;
//
// We're about to run the event and we've done our best to synchronize this
// event execution time to real time. Now, if we're in SYNC_HARD_LIMIT mode
// we have to decide if we've done a good enough job and if we haven't, we've
// been asked to commit ritual suicide.
//
// We check the simulation time against the current real time to make this
// judgement.
//
if (m_synchronizationMode == SYNC_HARD_LIMIT)
{
uint64_t tsFinal = m_synchronizer->GetCurrentRealtime ();
uint64_t tsJitter;
if (tsFinal >= m_currentTs)
{
tsJitter = tsFinal - m_currentTs;
}
else
{
tsJitter = m_currentTs - tsFinal;
}
if (tsJitter > static_cast<uint64_t>(m_hardLimit.GetTimeStep ()))
{
NS_FATAL_ERROR ("RealtimeSimulatorImpl::ProcessOneEvent (): "
"Hard real-time limit exceeded (jitter = " << tsJitter << ")");
}
}
}
//
// We have got the event we're about to execute completely disentangled from the
// event list so we can execute it outside a critical section without fear of someone
// changing things out from under us.
EventImpl *event = next.impl;
m_synchronizer->EventStart ();
event->Invoke ();
m_synchronizer->EventEnd ();
event->Unref ();
}
bool
RealtimeSimulatorImpl::IsFinished (void) const
{
NS_LOG_FUNCTION_NOARGS ();
bool rc;
{
CriticalSection cs (m_mutex);
rc = m_events->IsEmpty () || m_stop;
}
return rc;
}
//
// Peeks into event list. Should be called with critical section locked.
//
uint64_t
RealtimeSimulatorImpl::NextTs (void) const
{
NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT_MSG (m_events->IsEmpty () == false,
"RealtimeSimulatorImpl::NextTs(): event queue is empty");
Scheduler::Event ev = m_events->PeekNext ();
return ev.key.m_ts;
}
//
// Calls NextTs(). Should be called with critical section locked.
//
Time
RealtimeSimulatorImpl::Next (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return TimeStep (NextTs ());
}
void
RealtimeSimulatorImpl::Run (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT_MSG (m_running == false,
"RealtimeSimulatorImpl::Run(): Simulator already running");
m_stop = false;
m_running = true;
m_synchronizer->SetOrigin (m_currentTs);
for (;;)
{
bool done = false;
{
CriticalSection cs (m_mutex);
//
// In all cases we stop when the event list is empty. If you are doing a
// realtime simulation and you want it to extend out for some time, you must
// call StopAt. In the realtime case, this will stick a placeholder event out
// at the end of time.
//
if (m_stop || m_events->IsEmpty ())
{
done = true;
}
}
if (done)
{
break;
}
ProcessOneEvent ();
}
//
// If the simulator stopped naturally by lack of events, make a
// consistency test to check that we didn't lose any events along the way.
//
{
CriticalSection cs (m_mutex);
NS_ASSERT_MSG (m_events->IsEmpty () == false || m_unscheduledEvents == 0,
"RealtimeSimulatorImpl::Run(): Empty queue and unprocessed events");
}
m_running = false;
}
bool
RealtimeSimulatorImpl::Running (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_running;
}
bool
RealtimeSimulatorImpl::Realtime (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_synchronizer->Realtime ();
}
//
// This will run the first event on the queue without considering any realtime
// synchronization. It's mainly implemented to allow simulations requiring
// the multithreaded ScheduleRealtimeNow() functions the possibility of driving
// the simulation from their own event loop.
//
// It is expected that if there are any realtime requirements, the responsibility
// for synchronizing with real time in an external event loop will be picked up
// by that loop. For example, they may call Simulator::Next() to find the
// execution time of the next event and wait for that time somehow -- then call
// RunOneEvent to fire the event.
//
void
RealtimeSimulatorImpl::RunOneEvent (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT_MSG (m_running == false,
"RealtimeSimulatorImpl::RunOneEvent(): An internal simulator event loop is running");
EventImpl *event = 0;
//
// Run this in a critical section in case there's another thread around that
// may be inserting things onto the event list.
//
{
CriticalSection cs (m_mutex);
Scheduler::Event next = m_events->RemoveNext ();
NS_ASSERT (next.key.m_ts >= m_currentTs);
m_unscheduledEvents--;
NS_LOG_LOGIC ("handle " << next.key.m_ts);
m_currentTs = next.key.m_ts;
m_currentContext = next.key.m_context;
m_currentUid = next.key.m_uid;
event = next.impl;
}
event->Invoke ();
event->Unref ();
}
void
RealtimeSimulatorImpl::Stop (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_stop = true;
}
void
RealtimeSimulatorImpl::Stop (Time const &time)
{
Simulator::Schedule (time, &Simulator::Stop);
}
//
// Schedule an event for a _relative_ time in the future.
//
EventId
RealtimeSimulatorImpl::Schedule (Time const &time, EventImpl *impl)
{
NS_LOG_FUNCTION (time << impl);
Scheduler::Event ev;
{
CriticalSection cs (m_mutex);
//
// This is the reason we had to bring the absolute time calcualtion in from the
// simulator.h into the implementation. Since the implementations may be
// multi-threaded, we need this calculation to be atomic. You can see it is
// here since we are running in a CriticalSection.
//
Time tAbsolute = Simulator::Now () + time;
NS_ASSERT_MSG (tAbsolute.IsPositive (), "RealtimeSimulatorImpl::Schedule(): Negative time");
NS_ASSERT_MSG (tAbsolute >= TimeStep (m_currentTs), "RealtimeSimulatorImpl::Schedule(): time < m_currentTs");
ev.impl = impl;
ev.key.m_ts = (uint64_t) tAbsolute.GetTimeStep ();
ev.key.m_context = GetContext ();
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
m_synchronizer->Signal ();
}
return EventId (impl, ev.key.m_ts, ev.key.m_context, ev.key.m_uid);
}
void
RealtimeSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *impl)
{
NS_LOG_FUNCTION (time << impl);
{
CriticalSection cs (m_mutex);
uint64_t ts;
ts = m_currentTs + time.GetTimeStep ();
NS_ASSERT_MSG (ts >= m_currentTs, "RealtimeSimulatorImpl::ScheduleRealtime(): schedule for time < m_currentTs");
Scheduler::Event ev;
ev.impl = impl;
ev.key.m_ts = ts;
ev.key.m_context = context;
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
m_synchronizer->Signal ();
}
}
EventId
RealtimeSimulatorImpl::ScheduleNow (EventImpl *impl)
{
NS_LOG_FUNCTION_NOARGS ();
Scheduler::Event ev;
{
CriticalSection cs (m_mutex);
ev.impl = impl;
ev.key.m_ts = m_currentTs;
ev.key.m_context = GetContext ();
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
m_synchronizer->Signal ();
}
return EventId (impl, ev.key.m_ts, ev.key.m_context, ev.key.m_uid);
}
Time
RealtimeSimulatorImpl::Now (void) const
{
return TimeStep (m_currentTs);
}
//
// Schedule an event for a _relative_ time in the future.
//
void
RealtimeSimulatorImpl::ScheduleRealtimeWithContext (uint32_t context, Time const &time, EventImpl *impl)
{
NS_LOG_FUNCTION (context << time << impl);
{
CriticalSection cs (m_mutex);
uint64_t ts = m_synchronizer->GetCurrentRealtime () + time.GetTimeStep ();
NS_ASSERT_MSG (ts >= m_currentTs, "RealtimeSimulatorImpl::ScheduleRealtime(): schedule for time < m_currentTs");
Scheduler::Event ev;
ev.impl = impl;
ev.key.m_ts = ts;
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
m_synchronizer->Signal ();
}
}
void
RealtimeSimulatorImpl::ScheduleRealtime (Time const &time, EventImpl *impl)
{
NS_LOG_FUNCTION (time << impl);
ScheduleRealtimeWithContext (GetContext (), time, impl);
}
void
RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext (uint32_t context, EventImpl *impl)
{
NS_LOG_FUNCTION (context << impl);
{
CriticalSection cs (m_mutex);
//
// If the simulator is running, we're pacing and have a meaningful
// realtime clock. If we're not, then m_currentTs is were we stopped.
//
uint64_t ts = m_running ? m_synchronizer->GetCurrentRealtime () : m_currentTs;
NS_ASSERT_MSG (ts >= m_currentTs,
"RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(): schedule for time < m_currentTs");
Scheduler::Event ev;
ev.impl = impl;
ev.key.m_ts = ts;
ev.key.m_uid = m_uid;
ev.key.m_context = context;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
m_synchronizer->Signal ();
}
}
void
RealtimeSimulatorImpl::ScheduleRealtimeNow (EventImpl *impl)
{
NS_LOG_FUNCTION (impl);
ScheduleRealtimeNowWithContext (GetContext (), impl);
}
Time
RealtimeSimulatorImpl::RealtimeNow (void) const
{
return TimeStep (m_synchronizer->GetCurrentRealtime ());
}
EventId
RealtimeSimulatorImpl::ScheduleDestroy (EventImpl *impl)
{
NS_LOG_FUNCTION_NOARGS ();
EventId id;
{
CriticalSection cs (m_mutex);
//
// Time doesn't really matter here (especially in realtime mode). It is
// overridden by the uid of 2 which identifies this as an event to be
// executed at Simulator::Destroy time.
//
id = EventId (Ptr<EventImpl> (impl, false), m_currentTs, 0xffffffff, 2);
m_destroyEvents.push_back (id);
m_uid++;
}
return id;
}
Time
RealtimeSimulatorImpl::GetDelayLeft (const EventId &id) const
{
//
// If the event has expired, there is no delay until it runs. It is not the
// case that there is a negative time until it runs.
//
if (IsExpired (id))
{
return TimeStep (0);
}
return TimeStep (id.GetTs () - m_currentTs);
}
void
RealtimeSimulatorImpl::Remove (const EventId &id)
{
if (id.GetUid () == 2)
{
// destroy events.
for (DestroyEvents::iterator i = m_destroyEvents.begin ();
i != m_destroyEvents.end ();
i++)
{
if (*i == id)
{
m_destroyEvents.erase (i);
break;
}
}
return;
}
if (IsExpired (id))
{
return;
}
{
CriticalSection cs (m_mutex);
Scheduler::Event event;
event.impl = id.PeekEventImpl ();
event.key.m_ts = id.GetTs ();
event.key.m_context = id.GetContext ();
event.key.m_uid = id.GetUid ();
m_events->Remove (event);
m_unscheduledEvents--;
event.impl->Cancel ();
event.impl->Unref ();
}
}
void
RealtimeSimulatorImpl::Cancel (const EventId &id)
{
if (IsExpired (id) == false)
{
id.PeekEventImpl ()->Cancel ();
}
}
bool
RealtimeSimulatorImpl::IsExpired (const EventId &ev) const
{
if (ev.GetUid () == 2)
{
if (ev.PeekEventImpl () == 0 ||
ev.PeekEventImpl ()->IsCancelled ())
{
return true;
}
// destroy events.
for (DestroyEvents::const_iterator i = m_destroyEvents.begin ();
i != m_destroyEvents.end (); i++)
{
if (*i == ev)
{
return false;
}
}
return true;
}
//
// If the time of the event is less than the current timestamp of the
// simulator, the simulator has gone past the invocation time of the
// event, so the statement ev.GetTs () < m_currentTs does mean that
// the event has been fired even in realtime mode.
//
// The same is true for the next line involving the m_currentUid.
//
if (ev.PeekEventImpl () == 0 ||
ev.GetTs () < m_currentTs ||
(ev.GetTs () == m_currentTs && ev.GetUid () <= m_currentUid) ||
ev.PeekEventImpl ()->IsCancelled ())
{
return true;
}
else
{
return false;
}
}
Time
RealtimeSimulatorImpl::GetMaximumSimulationTime (void) const
{
// XXX: I am fairly certain other compilers use other non-standard
// post-fixes to indicate 64 bit constants.
return TimeStep (0x7fffffffffffffffLL);
}
// System ID for non-distributed simulation is always zero
uint32_t
RealtimeSimulatorImpl::GetSystemId (void) const
{
return 0;
}
uint32_t
RealtimeSimulatorImpl::GetContext (void) const
{
return m_currentContext;
}
void
RealtimeSimulatorImpl::SetSynchronizationMode (enum SynchronizationMode mode)
{
NS_LOG_FUNCTION (mode);
m_synchronizationMode = mode;
}
RealtimeSimulatorImpl::SynchronizationMode
RealtimeSimulatorImpl::GetSynchronizationMode (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_synchronizationMode;
}
void
RealtimeSimulatorImpl::SetHardLimit (Time limit)
{
NS_LOG_FUNCTION (limit);
m_hardLimit = limit;
}
Time
RealtimeSimulatorImpl::GetHardLimit (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_hardLimit;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/realtime-simulator-impl.cc | C++ | gpl2 | 26,533 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef EVENT_ID_H
#define EVENT_ID_H
#include <stdint.h>
#include "ptr.h"
#include "event-impl.h"
namespace ns3 {
class EventImpl;
/**
* \ingroup core
* \brief an identifier for simulation events.
*
* Each EventId identifies a unique event scheduled with one
* of the many Simulator::Schedule methods. This EventId can
* be used to Cancel or Remove events after they are scheduled
* with Simulator::Cancel or Simulator::Remove.
*
* The important thing to remember about this class is that
* every variable of this type is _always_ in a valid state,
* even when it has not been assigned an EventId coming from a Schedule
* method: calling Cancel, IsRunning, IsExpired or passing around
* instances of this object will not result in crashes or memory leaks.
*/
class EventId {
public:
EventId ();
// internal.
EventId (const Ptr<EventImpl> &impl, uint64_t ts, uint32_t context, uint32_t uid);
/**
* This method is syntactic sugar for the ns3::Simulator::cancel
* method.
*/
void Cancel (void);
/**
* This method is syntactic sugar for the ns3::Simulator::isExpired
* method.
* \returns true if the event has expired, false otherwise.
*/
bool IsExpired (void) const;
/**
* This method is syntactic sugar for the ns3::Simulator::isExpired
* method.
* \returns true if the event has not expired, false otherwise.
*/
bool IsRunning (void) const;
public:
/* The following methods are semi-private
* they are supposed to be invoked only by
* subclasses of the Scheduler base class.
*/
EventImpl *PeekEventImpl (void) const;
uint64_t GetTs (void) const;
uint32_t GetContext (void) const;
uint32_t GetUid (void) const;
private:
friend bool operator == (const EventId &a, const EventId &b);
Ptr<EventImpl> m_eventImpl;
uint64_t m_ts;
uint32_t m_context;
uint32_t m_uid;
};
bool operator == (const EventId &a, const EventId &b);
bool operator != (const EventId &a, const EventId &b);
} // namespace ns3
#endif /* EVENT_ID_H */
| zy901002-gpsr | src/core/model/event-id.h | C++ | gpl2 | 2,832 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "system-path.h"
#include "fatal-error.h"
#include "assert.h"
#include "ns3/core-config.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#if defined (HAVE_DIRENT_H) and defined (HAVE_SYS_TYPES_H)
#define HAVE_OPENDIR
#include <sys/types.h>
#include <dirent.h>
#endif
#if defined (HAVE_SYS_STAT_H) and defined (HAVE_SYS_TYPES_H)
#define HAVE_MKDIR_H
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include <sstream>
#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif /* __APPLE__ */
#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#if defined (__win32__)
#define SYSTEM_PATH_SEP "\\"
#else
#define SYSTEM_PATH_SEP "/"
#endif
namespace ns3 {
namespace SystemPath {
std::string Dirname (std::string path)
{
std::list<std::string> elements = Split (path);
std::list<std::string>::const_iterator last = elements.end();
last--;
return Join (elements.begin (), last);
}
std::string FindSelfDirectory (void)
{
/**
* This function returns the path to the running $PREFIX.
* Mac OS X: _NSGetExecutablePath() (man 3 dyld)
* Linux: readlink /proc/self/exe
* Solaris: getexecname()
* FreeBSD: sysctl CTL_KERN KERN_PROC KERN_PROC_PATHNAME -1
* BSD with procfs: readlink /proc/curproc/file
* Windows: GetModuleFileName() with hModule = NULL
*/
std::string filename;
#if defined(__linux__)
{
ssize_t size = 1024;
char *buffer = (char*)malloc (size);
memset (buffer, 0, size);
int status;
while (true)
{
status = readlink("/proc/self/exe", buffer, size);
if (status != 1 || (status == -1 && errno != ENAMETOOLONG))
{
break;
}
size *= 2;
free (buffer);
buffer = (char*)malloc (size);
memset (buffer, 0, size);
}
if (status == -1)
{
NS_FATAL_ERROR ("Oops, could not find self directory.");
}
filename = buffer;
free (buffer);
}
#elif defined (__win32__)
{
// XXX: untested. it should work if code is compiled with
// LPTSTR = char *
DWORD size = 1024;
LPTSTR lpFilename = (LPTSTR) malloc (sizeof(TCHAR) * size);
DWORD status = GetModuleFilename (0, lpFilename, size);
while (status == size)
{
size = size * 2;
free (lpFilename);
lpFilename = (LPTSTR) malloc (sizeof(TCHAR) * size);
status = GetModuleFilename (0, lpFilename, size);
}
NS_ASSERT (status != 0);
filename = lpFilename;
free (lpFilename);
}
#elif defined (__APPLE__)
{
uint32_t bufsize = 1024;
char *buffer = (char *) malloc (bufsize);
NS_ASSERT (buffer != 0);
int status = _NSGetExecutablePath (buffer, &bufsize);
if (status == -1)
{
free (buffer);
buffer = (char *) malloc (bufsize);
status = _NSGetExecutablePath (buffer, &bufsize);
}
NS_ASSERT (status == 0);
filename = buffer;
free (buffer);
}
#elif defined (__FreeBSD__)
{
int mib[4];
size_t bufSize = 1024;
char *buf = (char *) malloc(bufSize);
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
sysctl(mib, 4, buf, &bufSize, NULL, 0);
filename = buf;
}
#endif
return Dirname (filename);
}
std::string Append (std::string left, std::string right)
{
// removing trailing separators from 'left'
while (true)
{
std::string::size_type lastSep = left.rfind (SYSTEM_PATH_SEP);
if (lastSep != left.size () - 1)
{
break;
}
left = left.substr (0, left.size () - 1);
}
std::string retval = left + SYSTEM_PATH_SEP + right;
return retval;
}
std::list<std::string> Split (std::string path)
{
std::list<std::string> retval;
std::string::size_type current = 0, next = 0;
next = path.find (SYSTEM_PATH_SEP, current);
while (next != std::string::npos)
{
std::string item = path.substr (current, next - current);
retval.push_back (item);
current = next + 1;
next = path.find (SYSTEM_PATH_SEP, current);
}
std::string item = path.substr (current, next - current);
retval.push_back (item);
return retval;
}
std::string Join (std::list<std::string>::const_iterator begin,
std::list<std::string>::const_iterator end)
{
std::string retval = "";
for (std::list<std::string>::const_iterator i = begin; i != end; i++)
{
if (i == begin)
{
retval = *i;
}
else
{
retval = retval + SYSTEM_PATH_SEP + *i;
}
}
return retval;
}
std::list<std::string> ReadFiles (std::string path)
{
std::list<std::string> files;
#if defined HAVE_OPENDIR
DIR *dp = opendir (path.c_str ());
if (dp == NULL)
{
NS_FATAL_ERROR ("Could not open directory=" << path);
}
struct dirent *de = readdir (dp);
while (de != 0)
{
files.push_back (de->d_name);
de = readdir (dp);
}
closedir (dp);
#elif defined (HAVE_FIND_FIRST_FILE)
// XXX: untested
HANDLE hFind;
WIN32_FIND_DATA fileData;
hFind = FindFirstFile (path.c_str (), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
NS_FATAL_ERROR ("Could not open directory=" << path);
}
do
{
files.push_back (fileData.cFileName);
} while (FindNextFile (hFind, &fileData));
FindClose(hFind);
#else
#error "No support for reading a directory on this platform"
#endif
return files;
}
std::string
MakeTemporaryDirectoryName (void)
{
char *path = NULL;
path = getenv ("TMP");
if (path == NULL)
{
path = getenv ("TEMP");
if (path == NULL)
{
path = const_cast<char *> ("/tmp");
}
}
//
// Just in case the user wants to go back and find the output, we give
// a hint as to which dir we created by including a time hint.
//
time_t now = time (NULL);
struct tm *tm_now = localtime (&now);
//
// But we also randomize the name in case there are multiple users doing
// this at the same time
//
srand (time (0));
long int n = rand ();
//
// The final path to the directory is going to look something like
//
// /tmp/ns3-14.30.29.32767
//
// The first segment comes from one of the temporary directory env
// variables or /tmp if not found. The directory name starts with an
// identifier telling folks who is making all of the temp directories
// and then the local time (in this case 14.30.29 -- which is 2:30 and
// 29 seconds PM).
//
std::ostringstream oss;
oss << path << SYSTEM_PATH_SEP << "ns-3." << tm_now->tm_hour << "."
<< tm_now->tm_min << "." << tm_now->tm_sec << "." << n;
return oss.str ();
}
void
MakeDirectories (std::string path)
{
std::list<std::string> elements = Split (path);
for (std::list<std::string>::const_iterator i = elements.begin (); i != elements.end (); ++i)
{
std::string tmp = Join (elements.begin (), i);
#if defined(HAVE_MKDIR_H)
mkdir (tmp.c_str (), S_IRWXU);
#endif
}
#if defined(HAVE_MKDIR_H)
mkdir (path.c_str (), S_IRWXU);
#endif
}
} // namespace SystemPath
} // namespace ns3
| zy901002-gpsr | src/core/model/system-path.cc | C++ | gpl2 | 7,788 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA, Gustavo Carneiro
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Gustavo Carneiro <gjcarneiro@gmail.com>,
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "object.h"
#include "object-factory.h"
#include "assert.h"
#include "singleton.h"
#include "attribute.h"
#include "log.h"
#include "string.h"
#include <vector>
#include <sstream>
#include <stdlib.h>
#include <string.h>
NS_LOG_COMPONENT_DEFINE ("Object");
namespace ns3 {
/*********************************************************************
* The Object implementation
*********************************************************************/
NS_OBJECT_ENSURE_REGISTERED (Object);
Object::AggregateIterator::AggregateIterator ()
: m_object (0),
m_current (0)
{
}
bool
Object::AggregateIterator::HasNext (void) const
{
return m_current < m_object->m_aggregates->n;
}
Ptr<const Object>
Object::AggregateIterator::Next (void)
{
Object *object = m_object->m_aggregates->buffer[m_current];
m_current++;
return object;
}
Object::AggregateIterator::AggregateIterator (Ptr<const Object> object)
: m_object (object),
m_current (0)
{
}
TypeId
Object::GetInstanceTypeId (void) const
{
return m_tid;
}
TypeId
Object::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Object")
.SetParent<ObjectBase> ()
;
return tid;
}
Object::Object ()
: m_tid (Object::GetTypeId ()),
m_disposed (false),
m_started (false),
m_aggregates ((struct Aggregates *) malloc (sizeof (struct Aggregates))),
m_getObjectCount (0)
{
m_aggregates->n = 1;
m_aggregates->buffer[0] = this;
}
Object::~Object ()
{
// remove this object from the aggregate list
uint32_t n = m_aggregates->n;
for (uint32_t i = 0; i < n; i++)
{
Object *current = m_aggregates->buffer[i];
if (current == this)
{
memmove (&m_aggregates->buffer[i],
&m_aggregates->buffer[i+1],
sizeof (Object *)*(m_aggregates->n - (i+1)));
m_aggregates->n--;
}
}
// finally, if all objects have been removed from the list,
// delete the aggregate list
if (m_aggregates->n == 0)
{
free (m_aggregates);
}
m_aggregates = 0;
}
Object::Object (const Object &o)
: m_tid (o.m_tid),
m_disposed (false),
m_started (false),
m_aggregates ((struct Aggregates *) malloc (sizeof (struct Aggregates))),
m_getObjectCount (0)
{
m_aggregates->n = 1;
m_aggregates->buffer[0] = this;
}
void
Object::Construct (const AttributeConstructionList &attributes)
{
ConstructSelf (attributes);
}
Ptr<Object>
Object::DoGetObject (TypeId tid) const
{
NS_ASSERT (CheckLoose ());
uint32_t n = m_aggregates->n;
TypeId objectTid = Object::GetTypeId ();
for (uint32_t i = 0; i < n; i++)
{
Object *current = m_aggregates->buffer[i];
TypeId cur = current->GetInstanceTypeId ();
while (cur != tid && cur != objectTid)
{
cur = cur.GetParent ();
}
if (cur == tid)
{
// This is an attempt to 'cache' the result of this lookup.
// the idea is that if we perform a lookup for a TypeId on this object,
// we are likely to perform the same lookup later so, we make sure
// that the aggregate array is sorted by the number of accesses
// to each object.
// first, increment the access count
current->m_getObjectCount++;
// then, update the sort
UpdateSortedArray (m_aggregates, i);
// finally, return the match
return const_cast<Object *> (current);
}
}
return 0;
}
void
Object::Start (void)
{
/**
* Note: the code here is a bit tricky because we need to protect ourselves from
* modifications in the aggregate array while DoStart is called. The user's
* implementation of the DoStart method could call GetObject (which could
* reorder the array) and it could call AggregateObject which would add an
* object at the end of the array. To be safe, we restart iteration over the
* array whenever we call some user code, just in case.
*/
restart:
uint32_t n = m_aggregates->n;
for (uint32_t i = 0; i < n; i++)
{
Object *current = m_aggregates->buffer[i];
if (!current->m_started)
{
current->DoStart ();
current->m_started = true;
goto restart;
}
}
}
void
Object::Dispose (void)
{
/**
* Note: the code here is a bit tricky because we need to protect ourselves from
* modifications in the aggregate array while DoDispose is called. The user's
* DoDispose implementation could call GetObject (which could reorder the array)
* and it could call AggregateObject which would add an object at the end of the array.
* So, to be safe, we restart the iteration over the array whenever we call some
* user code.
*/
restart:
uint32_t n = m_aggregates->n;
for (uint32_t i = 0; i < n; i++)
{
Object *current = m_aggregates->buffer[i];
if (!current->m_disposed)
{
current->DoDispose ();
current->m_disposed = true;
goto restart;
}
}
}
void
Object::UpdateSortedArray (struct Aggregates *aggregates, uint32_t j) const
{
while (j > 0 &&
aggregates->buffer[j]->m_getObjectCount > aggregates->buffer[j-1]->m_getObjectCount)
{
Object *tmp = aggregates->buffer[j-1];
aggregates->buffer[j-1] = aggregates->buffer[j];
aggregates->buffer[j] = tmp;
j--;
}
}
void
Object::AggregateObject (Ptr<Object> o)
{
NS_ASSERT (!m_disposed);
NS_ASSERT (!o->m_disposed);
NS_ASSERT (CheckLoose ());
NS_ASSERT (o->CheckLoose ());
if (DoGetObject (o->GetInstanceTypeId ()))
{
NS_FATAL_ERROR ("Object::AggregateObject(): "
"Multiple aggregation of objects of type " <<
o->GetInstanceTypeId ().GetName ());
}
Object *other = PeekPointer (o);
// first create the new aggregate buffer.
uint32_t total = m_aggregates->n + other->m_aggregates->n;
struct Aggregates *aggregates =
(struct Aggregates *)malloc (sizeof(struct Aggregates)+(total-1)*sizeof(Object*));
aggregates->n = total;
// copy our buffer to the new buffer
memcpy (&aggregates->buffer[0],
&m_aggregates->buffer[0],
m_aggregates->n*sizeof(Object*));
// append the other buffer into the new buffer too
for (uint32_t i = 0; i < other->m_aggregates->n; i++)
{
aggregates->buffer[m_aggregates->n+i] = other->m_aggregates->buffer[i];
UpdateSortedArray (aggregates, m_aggregates->n + i);
}
// keep track of the old aggregate buffers for the iteration
// of NotifyNewAggregates
struct Aggregates *a = m_aggregates;
struct Aggregates *b = other->m_aggregates;
// Then, assign the new aggregation buffer to every object
uint32_t n = aggregates->n;
for (uint32_t i = 0; i < n; i++)
{
Object *current = aggregates->buffer[i];
current->m_aggregates = aggregates;
}
// Finally, call NotifyNewAggregate on all the objects aggregates together.
// We purposedly use the old aggregate buffers to iterate over the objects
// because this allows us to assume that they will not change from under
// our feet, even if our users call AggregateObject from within their
// NotifyNewAggregate method.
for (uint32_t i = 0; i < a->n; i++)
{
Object *current = a->buffer[i];
current->NotifyNewAggregate ();
}
for (uint32_t i = 0; i < b->n; i++)
{
Object *current = b->buffer[i];
current->NotifyNewAggregate ();
}
// Now that we are done with them, we can free our old aggregate buffers
free (a);
free (b);
}
/**
* This function must be implemented in the stack that needs to notify
* other stacks connected to the node of their presence in the node.
*/
void
Object::NotifyNewAggregate ()
{
}
Object::AggregateIterator
Object::GetAggregateIterator (void) const
{
return AggregateIterator (this);
}
void
Object::SetTypeId (TypeId tid)
{
NS_ASSERT (Check ());
m_tid = tid;
}
void
Object::DoDispose (void)
{
NS_ASSERT (!m_disposed);
}
void
Object::DoStart (void)
{
NS_ASSERT (!m_started);
}
bool
Object::Check (void) const
{
return (GetReferenceCount () > 0);
}
/* In some cases, when an event is scheduled against a subclass of
* Object, and if no one owns a reference directly to this object, the
* object is alive, has a refcount of zero and the method ran when the
* event expires runs against the raw pointer which means that we are
* manipulating an object with a refcount of zero. So, instead we
* check the aggregate reference count.
*/
bool
Object::CheckLoose (void) const
{
uint32_t refcount = 0;
uint32_t n = m_aggregates->n;
for (uint32_t i = 0; i < n; i++)
{
Object *current = m_aggregates->buffer[i];
refcount += current->GetReferenceCount ();
}
return (refcount > 0);
}
void
Object::DoDelete (void)
{
// check if we really need to die
for (uint32_t i = 0; i < m_aggregates->n; i++)
{
Object *current = m_aggregates->buffer[i];
if (current->GetReferenceCount () > 0)
{
return;
}
}
// Now, we know that we are alone to use this aggregate so,
// we can dispose and delete everything safely.
uint32_t n = m_aggregates->n;
// Ensure we are disposed.
for (uint32_t i = 0; i < n; i++)
{
Object *current = m_aggregates->buffer[i];
if (!current->m_disposed)
{
current->DoDispose ();
}
}
// Now, actually delete all objects
struct Aggregates *aggregates = m_aggregates;
for (uint32_t i = 0; i < n; i++)
{
// There is a trick here: each time we call delete below,
// the deleted object is removed from the aggregate buffer
// in the destructor so, the index of the next element to
// lookup is always zero
Object *current = aggregates->buffer[0];
delete current;
}
}
} // namespace ns3
| zy901002-gpsr | src/core/model/object.cc | C++ | gpl2 | 10,748 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "log.h"
#include <list>
#include <utility>
#include <iostream>
#include <string.h>
#include "assert.h"
#include "ns3/core-config.h"
#include "fatal-error.h"
#ifdef HAVE_GETENV
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
namespace ns3 {
LogTimePrinter g_logTimePrinter = 0;
LogNodePrinter g_logNodePrinter = 0;
typedef std::list<std::pair <std::string, LogComponent *> > ComponentList;
typedef std::list<std::pair <std::string, LogComponent *> >::iterator ComponentListI;
static class PrintList
{
public:
PrintList ();
} g_printList;
static
ComponentList *GetComponentList (void)
{
static ComponentList components;
return &components;
}
PrintList::PrintList ()
{
#ifdef HAVE_GETENV
char *envVar = getenv ("NS_LOG");
if (envVar == 0)
{
return;
}
std::string env = envVar;
std::string::size_type cur = 0;
std::string::size_type next = 0;
while (next != std::string::npos)
{
next = env.find_first_of (":", cur);
std::string tmp = std::string (env, cur, next-cur);
if (tmp == "print-list")
{
LogComponentPrintList ();
exit (0);
break;
}
cur = next + 1;
}
#endif
}
LogComponent::LogComponent (char const * name)
: m_levels (0), m_name (name)
{
EnvVarCheck (name);
ComponentList *components = GetComponentList ();
for (ComponentListI i = components->begin ();
i != components->end ();
i++)
{
if (i->first == name)
{
NS_FATAL_ERROR ("Log component \""<<name<<"\" has already been registered once.");
}
}
components->push_back (std::make_pair (name, this));
}
void
LogComponent::EnvVarCheck (char const * name)
{
#ifdef HAVE_GETENV
char *envVar = getenv ("NS_LOG");
if (envVar == 0)
{
return;
}
std::string env = envVar;
std::string myName = name;
std::string::size_type cur = 0;
std::string::size_type next = 0;
while (next != std::string::npos)
{
next = env.find_first_of (":", cur);
std::string tmp = std::string (env, cur, next-cur);
std::string::size_type equal = tmp.find ("=");
std::string component;
if (equal == std::string::npos)
{
component = tmp;
if (component == myName || component == "*")
{
int level = LOG_ALL | LOG_PREFIX_TIME | LOG_PREFIX_FUNC | LOG_PREFIX_NODE;
Enable ((enum LogLevel)level);
return;
}
}
else
{
component = tmp.substr (0, equal);
if (component == myName || component == "*")
{
int level = 0;
std::string::size_type cur_lev;
std::string::size_type next_lev = equal;
do
{
cur_lev = next_lev + 1;
next_lev = tmp.find ("|", cur_lev);
std::string lev = tmp.substr (cur_lev, next_lev - cur_lev);
if (lev == "error")
{
level |= LOG_ERROR;
}
else if (lev == "warn")
{
level |= LOG_WARN;
}
else if (lev == "debug")
{
level |= LOG_DEBUG;
}
else if (lev == "info")
{
level |= LOG_INFO;
}
else if (lev == "function")
{
level |= LOG_FUNCTION;
}
else if (lev == "logic")
{
level |= LOG_LOGIC;
}
else if (lev == "all")
{
level |= LOG_ALL;
}
else if (lev == "prefix_func")
{
level |= LOG_PREFIX_FUNC;
}
else if (lev == "prefix_time")
{
level |= LOG_PREFIX_TIME;
}
else if (lev == "prefix_node")
{
level |= LOG_PREFIX_NODE;
}
else if (lev == "level_error")
{
level |= LOG_LEVEL_ERROR;
}
else if (lev == "level_warn")
{
level |= LOG_LEVEL_WARN;
}
else if (lev == "level_debug")
{
level |= LOG_LEVEL_DEBUG;
}
else if (lev == "level_info")
{
level |= LOG_LEVEL_INFO;
}
else if (lev == "level_function")
{
level |= LOG_LEVEL_FUNCTION;
}
else if (lev == "level_logic")
{
level |= LOG_LEVEL_LOGIC;
}
else if (lev == "level_all")
{
level |= LOG_LEVEL_ALL;
}
} while (next_lev != std::string::npos);
Enable ((enum LogLevel)level);
}
}
cur = next + 1;
}
#endif
}
bool
LogComponent::IsEnabled (enum LogLevel level) const
{
// LogComponentEnableEnvVar ();
return (level & m_levels) ? 1 : 0;
}
bool
LogComponent::IsNoneEnabled (void) const
{
return m_levels == 0;
}
void
LogComponent::Enable (enum LogLevel level)
{
m_levels |= level;
}
void
LogComponent::Disable (enum LogLevel level)
{
m_levels &= ~level;
}
char const *
LogComponent::Name (void) const
{
return m_name;
}
void
LogComponentEnable (char const *name, enum LogLevel level)
{
ComponentList *components = GetComponentList ();
ComponentListI i;
for (i = components->begin ();
i != components->end ();
i++)
{
if (i->first.compare (name) == 0)
{
i->second->Enable (level);
return;
}
}
if (i == components->end())
{
// nothing matched
LogComponentPrintList();
NS_FATAL_ERROR ("Logging component \"" << name <<
"\" not found. See above for a list of available log components");
}
}
void
LogComponentEnableAll (enum LogLevel level)
{
ComponentList *components = GetComponentList ();
for (ComponentListI i = components->begin ();
i != components->end ();
i++)
{
i->second->Enable (level);
}
}
void
LogComponentDisable (char const *name, enum LogLevel level)
{
ComponentList *components = GetComponentList ();
for (ComponentListI i = components->begin ();
i != components->end ();
i++)
{
if (i->first.compare (name) == 0)
{
i->second->Disable (level);
break;
}
}
}
void
LogComponentDisableAll (enum LogLevel level)
{
ComponentList *components = GetComponentList ();
for (ComponentListI i = components->begin ();
i != components->end ();
i++)
{
i->second->Disable (level);
}
}
void
LogComponentPrintList (void)
{
ComponentList *components = GetComponentList ();
for (ComponentListI i = components->begin ();
i != components->end ();
i++)
{
std::cout << i->first << "=";
if (i->second->IsNoneEnabled ())
{
std::cout << "0" << std::endl;
continue;
}
if (i->second->IsEnabled (LOG_ERROR))
{
std::cout << "error";
}
if (i->second->IsEnabled (LOG_WARN))
{
std::cout << "|warn";
}
if (i->second->IsEnabled (LOG_DEBUG))
{
std::cout << "|debug";
}
if (i->second->IsEnabled (LOG_INFO))
{
std::cout << "|info";
}
if (i->second->IsEnabled (LOG_FUNCTION))
{
std::cout << "|function";
}
if (i->second->IsEnabled (LOG_LOGIC))
{
std::cout << "|logic";
}
if (i->second->IsEnabled (LOG_ALL))
{
std::cout << "|all";
}
std::cout << std::endl;
}
}
static bool ComponentExists(std::string componentName)
{
char const*name=componentName.c_str();
ComponentList *components = GetComponentList ();
ComponentListI i;
for (i = components->begin ();
i != components->end ();
i++)
{
if (i->first.compare (name) == 0)
{
return true;
}
}
NS_ASSERT (i == components->end());
// nothing matched
return false;
}
static void CheckEnvironmentVariables (void)
{
#ifdef HAVE_GETENV
char *envVar = getenv ("NS_LOG");
if (envVar == 0 || strlen(envVar) == 0)
{
return;
}
std::string env = envVar;
std::string::size_type cur = 0;
std::string::size_type next = 0;
while (next != std::string::npos)
{
next = env.find_first_of (":", cur);
std::string tmp = std::string (env, cur, next-cur);
std::string::size_type equal = tmp.find ("=");
std::string component;
if (equal == std::string::npos)
{
// ie no '=' characters found
component = tmp;
if (ComponentExists(component) || component == "*")
{
return;
}
else
{
LogComponentPrintList();
NS_FATAL_ERROR("Invalid or unregistered component name \"" << component <<
"\" in env variable NS_LOG, see above for a list of valid components");
}
}
else
{
component = tmp.substr (0, equal);
if (ComponentExists(component) || component == "*")
{
std::string::size_type cur_lev;
std::string::size_type next_lev = equal;
do
{
cur_lev = next_lev + 1;
next_lev = tmp.find ("|", cur_lev);
std::string lev = tmp.substr (cur_lev, next_lev - cur_lev);
if (lev == "error"
|| lev == "warn"
|| lev == "debug"
|| lev == "info"
|| lev == "function"
|| lev == "logic"
|| lev == "all"
|| lev == "prefix_func"
|| lev == "prefix_time"
|| lev == "prefix_node"
|| lev == "level_error"
|| lev == "level_warn"
|| lev == "level_debug"
|| lev == "level_info"
|| lev == "level_function"
|| lev == "level_logic"
|| lev == "level_all"
|| lev == "*"
)
{
continue;
}
else
{
NS_FATAL_ERROR("Invalid log level \"" << lev <<
"\" in env variable NS_LOG for component name " << component);
}
} while (next_lev != std::string::npos);
}
else
{
LogComponentPrintList();
NS_FATAL_ERROR("Invalid or unregistered component name \"" << component <<
"\" in env variable NS_LOG, see above for a list of valid components");
}
}
cur = next + 1; // parse next component
}
#endif
}
void LogSetTimePrinter (LogTimePrinter printer)
{
g_logTimePrinter = printer;
// This is the only place where we are more or less sure that all log variables
// are registered. See bug 1082 for details.
CheckEnvironmentVariables();
}
LogTimePrinter LogGetTimePrinter (void)
{
return g_logTimePrinter;
}
void LogSetNodePrinter (LogNodePrinter printer)
{
g_logNodePrinter = printer;
}
LogNodePrinter LogGetNodePrinter (void)
{
return g_logNodePrinter;
}
ParameterLogger::ParameterLogger (std::ostream &os)
: m_itemNumber (0),
m_os (os)
{
}
} // namespace ns3
| zy901002-gpsr | src/core/model/log.cc | C++ | gpl2 | 13,116 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "attribute.h"
#include "log.h"
#include "fatal-error.h"
#include "string.h"
#include <sstream>
NS_LOG_COMPONENT_DEFINE ("AttributeValue");
namespace ns3 {
AttributeValue::AttributeValue ()
{
}
AttributeValue::~AttributeValue ()
{
}
AttributeAccessor::AttributeAccessor ()
{
}
AttributeAccessor::~AttributeAccessor ()
{
}
AttributeChecker::AttributeChecker ()
{
}
AttributeChecker::~AttributeChecker ()
{
}
Ptr<AttributeValue>
AttributeChecker::CreateValidValue (const AttributeValue &value) const
{
if (Check (value))
{
return value.Copy ();
}
// attempt to convert to string.
const StringValue *str = dynamic_cast<const StringValue *> (&value);
if (str == 0)
{
return 0;
}
// attempt to convert back to value.
Ptr<AttributeValue> v = Create ();
bool ok = v->DeserializeFromString (str->Get (), this);
if (!ok)
{
return 0;
}
ok = Check (*v);
if (!ok)
{
return 0;
}
return v;
}
EmptyAttributeValue::EmptyAttributeValue ()
{
}
Ptr<AttributeValue>
EmptyAttributeValue::Copy (void) const
{
return Create<EmptyAttributeValue> ();
}
std::string
EmptyAttributeValue::SerializeToString (Ptr<const AttributeChecker> checker) const
{
return "";
}
bool
EmptyAttributeValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
{
return true;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/attribute.cc | C++ | gpl2 | 2,197 |
#include "int64x64.h"
#include <stdint.h>
#include <iostream>
#include <sstream>
#include "assert.h"
namespace ns3 {
static uint8_t MostSignificantDigit (uint64_t value)
{
uint8_t n = 0;
do
{
n++;
value /= 10;
} while (value != 0);
return n;
}
static uint64_t PowerOfTen (uint8_t n)
{
uint64_t retval = 1;
while (n > 0)
{
retval *= 10;
n--;
}
return retval;
}
std::ostream &operator << (std::ostream &os, const int64x64_t &value)
{
int64_t hi = value.GetHigh ();
os << ((hi<0) ? "-" : "+") << ((hi<0) ? -hi : hi) << ".";
uint64_t low = value.GetLow ();
uint8_t msd = MostSignificantDigit (~((uint64_t)0));
do
{
msd--;
uint64_t pow = PowerOfTen (msd);
uint8_t digit = low / pow;
NS_ASSERT (digit < 10);
os << (uint16_t) digit;
low -= digit * pow;
} while (msd > 0 && low > 0);
return os;
}
static uint64_t ReadDigits (std::string str)
{
const char *buf = str.c_str ();
uint64_t retval = 0;
while (*buf != 0)
{
retval *= 10;
retval += *buf - 0x30;
buf++;
}
return retval;
}
std::istream &operator >> (std::istream &is, int64x64_t &value)
{
std::string str;
is >> str;
bool negative;
// skip heading spaces
std::string::size_type cur;
cur = str.find_first_not_of (" ");
std::string::size_type next;
// first, remove the sign.
next = str.find ("-", cur);
if (next != std::string::npos)
{
negative = true;
next++;
}
else
{
next = str.find ("+", cur);
if (next != std::string::npos)
{
next++;
}
else
{
next = cur;
}
negative = false;
}
cur = next;
int64_t hi;
uint64_t lo;
next = str.find (".", cur);
if (next != std::string::npos)
{
hi = ReadDigits (str.substr (cur, next-cur));
lo = ReadDigits (str.substr (next+1, str.size ()-(next+1)));
}
else
{
hi = ReadDigits (str.substr (cur, str.size ()-cur));
lo = 0;
}
hi = negative ? -hi : hi;
value = int64x64_t (hi, lo);
return is;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/int64x64.cc | C++ | gpl2 | 2,128 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef ATTRIBUTE_HELPER_H
#define ATTRIBUTE_HELPER_H
#include "attribute.h"
#include "attribute-accessor-helper.h"
#include <sstream>
#include "fatal-error.h"
namespace ns3 {
template <typename T, typename BASE>
Ptr<AttributeChecker>
MakeSimpleAttributeChecker (std::string name, std::string underlying)
{
struct SimpleAttributeChecker : public BASE
{
virtual bool Check (const AttributeValue &value) const {
return dynamic_cast<const T *> (&value) != 0;
}
virtual std::string GetValueTypeName (void) const {
return m_type;
}
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetUnderlyingTypeInformation (void) const {
return m_underlying;
}
virtual Ptr<AttributeValue> Create (void) const {
return ns3::Create<T> ();
}
virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
const T *src = dynamic_cast<const T *> (&source);
T *dst = dynamic_cast<T *> (&destination);
if (src == 0 || dst == 0)
{
return false;
}
*dst = *src;
return true;
}
std::string m_type;
std::string m_underlying;
} *checker = new SimpleAttributeChecker ();
checker->m_type = name;
checker->m_underlying = underlying;
return Ptr<AttributeChecker> (checker, false);
}
}
/**
* \ingroup core
* \defgroup AttributeHelper Attribute Helper
*
* All these macros can be used to generate automatically the code
* for subclasses of AttributeValue, AttributeAccessor, and, AttributeChecker,
* which can be used to give attribute powers to a normal class. i.e.,
* the user class can then effectively be made an attribute.
*
* There are two kinds of helper macros:
* 1) The simple macros.
* 2) The more complex macros.
*
* The simple macros are implemented in terms of the complex
* macros and should generally be preferred over the complex macros:
* - \ref ATTRIBUTE_HELPER_HEADER, and,
* - \ref ATTRIBUTE_HELPER_CPP,
*/
/**
* \ingroup AttributeHelper
* \param type the name of the class
*
* This macro defines and generates the code for the implementation
* of the MakeXXXAccessor template functions. This macro is typically
* invoked in a class header to allow users of this class to view and
* use the template functions defined here. This macro is implemented
* through the helper templates functions ns3::MakeAccessorHelper<>.
*/
#define ATTRIBUTE_ACCESSOR_DEFINE(type) \
template <typename T1> \
Ptr<const AttributeAccessor> Make ## type ## Accessor (T1 a1) \
{ \
return MakeAccessorHelper<type ## Value> (a1); \
} \
template <typename T1, typename T2> \
Ptr<const AttributeAccessor> Make ## type ## Accessor (T1 a1, T2 a2) \
{ \
return MakeAccessorHelper<type ## Value> (a1, a2); \
}
#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type,name) \
class name ## Value : public AttributeValue \
{ \
public: \
name ## Value (); \
name ## Value (const type &value); \
void Set (const type &value); \
type Get (void) const; \
template <typename T> \
bool GetAccessor (T &value) const { \
value = T (m_value); \
return true; \
} \
virtual Ptr<AttributeValue> Copy (void) const; \
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const; \
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker); \
private: \
type m_value; \
};
/**
* \ingroup AttributeHelper
* \param type the name of the class.
*
* This macro defines the class XXXValue associated to class XXX.
* This macro is typically invoked in a class header.
*/
#define ATTRIBUTE_VALUE_DEFINE(type) \
ATTRIBUTE_VALUE_DEFINE_WITH_NAME (type,type)
/**
* \ingroup AttributeHelper
* \param type the name of the class
*
* This macro defines the conversion operators for class XXX to and
* from instances of type Attribute.
* Typically invoked from xxx.h.
*/
#define ATTRIBUTE_CONVERTER_DEFINE(type)
/**
* \ingroup AttributeHelper
* \param type the name of the class
*
* This macro defines the XXXChecker class and the associated
* MakeXXXChecker function.
* Typically invoked from xxx.h.
*/
#define ATTRIBUTE_CHECKER_DEFINE(type) \
class type ## Checker : public AttributeChecker {}; \
Ptr<const AttributeChecker> Make ## type ## Checker (void); \
#define ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,name) \
name ## Value::name ## Value () \
: m_value () {} \
name ## Value::name ## Value (const type &value) \
: m_value (value) {} \
void name ## Value::Set (const type &v) { \
m_value = v; \
} \
type name ## Value::Get (void) const { \
return m_value; \
} \
Ptr<AttributeValue> \
name ## Value::Copy (void) const { \
return ns3::Create<name ## Value> (*this); \
} \
std::string \
name ## Value::SerializeToString (Ptr<const AttributeChecker> checker) const { \
std::ostringstream oss; \
oss << m_value; \
return oss.str (); \
} \
bool \
name ## Value::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) { \
std::istringstream iss; \
iss.str (value); \
iss >> m_value; \
return !iss.bad () && !iss.fail (); \
}
/**
* \ingroup AttributeHelper
* \param type the name of the class.
*
* This macro implements the XXXValue class (including the
* XXXValue::SerializeToString and XXXValue::DeserializeFromString
* methods).
* Typically invoked from xxx.cc.
*/
#define ATTRIBUTE_VALUE_IMPLEMENT(type) \
ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (type,type)
/**
* \ingroup AttributeHelper
* \param type the name of the class
*
* This macro implements the MakeXXXChecker function.
* Typically invoked from xxx.cc.
*/
#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \
Ptr<const AttributeChecker> Make ## type ## Checker (void) \
{ \
return MakeSimpleAttributeChecker<type ## Value,type ## Checker> (# type "Value", # type); \
} \
#define ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME(type,name) \
Ptr<const AttributeChecker> Make ## type ## Checker (void) \
{ \
return MakeSimpleAttributeChecker<type ## Value,type ## Checker> (# type "Value", name); \
} \
/**
* \ingroup AttributeHelper
* \param type the name of the class
*
* This macro should be invoked outside of the class
* declaration in its public header.
*/
#define ATTRIBUTE_HELPER_HEADER(type) \
ATTRIBUTE_VALUE_DEFINE (type); \
ATTRIBUTE_ACCESSOR_DEFINE (type); \
ATTRIBUTE_CHECKER_DEFINE (type);
/**
* \ingroup AttributeHelper
* \param type the name of the class
*
* This macro should be invoked from the class implementation file.
*/
#define ATTRIBUTE_HELPER_CPP(type) \
ATTRIBUTE_CHECKER_IMPLEMENT (type); \
ATTRIBUTE_VALUE_IMPLEMENT (type);
#endif /* ATTRIBUTE_HELPER_H */
| zy901002-gpsr | src/core/model/attribute-helper.h | C++ | gpl2 | 10,585 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef ATTRIBUTE_H
#define ATTRIBUTE_H
#include <string>
#include <stdint.h>
#include "ptr.h"
#include "simple-ref-count.h"
namespace ns3 {
class AttributeAccessor;
class AttributeChecker;
class Attribute;
class ObjectBase;
/**
*
* \ingroup core
* \defgroup attribute Attribute
*/
/**
*
* \ingroup attribute
*
* \brief Hold a value for an Attribute.
*
* Instances of this class should always be wrapped into an Attribute object.
* Most subclasses of this base class are implemented by the
* ATTRIBUTE_HELPER_* macros.
*/
class AttributeValue : public SimpleRefCount<AttributeValue>
{
public:
AttributeValue ();
virtual ~AttributeValue ();
/**
* \returns a deep copy of this class, wrapped into an Attribute object.
*/
virtual Ptr<AttributeValue> Copy (void) const = 0;
/**
* \param checker the checker associated to the attribute
* \returns a string representation of this value.
*
* In most cases, this method will not make any use of the checker argument.
* However, in a very limited set of cases, the checker argument is needed to
* perform proper serialization. A nice example of code which needs it is
* the EnumValue::SerializeToString code.
*/
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const = 0;
/**
* \param value a string representation of the value
* \param checker a pointer to the checker associated to the attribute.
* \returns true if the input string was correctly-formatted and could be
* successfully deserialized, false otherwise.
*
* Upon return of this function, this AttributeValue instance contains
* the deserialized value.
* In most cases, this method will not make any use of the checker argument.
* However, in a very limited set of cases, the checker argument is needed to
* perform proper serialization. A nice example of code which needs it is
* the EnumValue::SerializeToString code.
*/
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) = 0;
};
/**
* \brief allow setting and getting the value of an attribute.
*
* \ingroup attribute
*
* The goal of this class is to hide from the user how an attribute
* is actually set or get to or from a class instance. Implementations
* of this base class are usually provided through the MakeAccessorHelper
* template functions, hidden behind an ATTRIBUTE_HELPER_* macro.
*/
class AttributeAccessor : public SimpleRefCount<AttributeAccessor>
{
public:
AttributeAccessor ();
virtual ~AttributeAccessor ();
/**
* \param object the object instance to set the value in
* \param value the value to set
* \returns true if the value could be set successfully, false otherwise.
*
* This method expects that the caller has checked that the input value is
* valid with AttributeChecker::Check.
*/
virtual bool Set (ObjectBase * object, const AttributeValue &value) const = 0;
/**
* \param object the object instance to get the value from
* \param attribute a pointer to where the value should be set.
* \returns true if the value could be read successfully, and
* stored in the input value, false otherwise.
*
* This method expects that the caller has checked that the input value is
* valid with AttributeChecker::Check.
*/
virtual bool Get (const ObjectBase * object, AttributeValue &attribute) const = 0;
/**
* \return true if this accessor supports the Get operation, false
* otherwise.
*/
virtual bool HasGetter (void) const = 0;
/**
* \return true if this accessor supports the Set operation, false
* otherwise.
*/
virtual bool HasSetter (void) const = 0;
};
/**
* \brief Represent the type of an attribute
*
* \ingroup attribute
*
* Each type of attribute has an associated unique AttributeChecker
* subclass. The type of the subclass can be safely used by users
* to infer the type of the associated attribute. i.e., we expect
* binding authors to use the checker associated to an attribute
* to detect the type of the associated attribute.
*
* Most subclasses of this base class are implemented by the
* ATTRIBUTE_HELPER_HEADER and ATTRIBUTE_HELPER_CPP macros.
*/
class AttributeChecker : public SimpleRefCount<AttributeChecker>
{
public:
AttributeChecker ();
virtual ~AttributeChecker ();
Ptr<AttributeValue> CreateValidValue (const AttributeValue &value) const;
/**
* \param value a pointer to the value to check
* \returns true if the input value is both of the right type
* and if its value is within the requested range. Returns
* false otherwise.
*/
virtual bool Check (const AttributeValue &value) const = 0;
/**
* \returns the c++ fully-qualified typename of the subclass
* of the ns3::AttributeValue base class which is associated
* to this checker.
*
* A typical return value here is FooValue where Foo is the name of the
* type being wrapped.
*/
virtual std::string GetValueTypeName (void) const = 0;
/**
* \returns true if this checker has information about the underlying
* C++ type, false otherwise.
*
* If this method returns false, the return value of the GetUnderlyingTypeInformation
* method cannot be relied upon.
*/
virtual bool HasUnderlyingTypeInformation (void) const = 0;
/**
* \returns a human-readable representation of information about
* the underlying C++ type.
*/
virtual std::string GetUnderlyingTypeInformation (void) const = 0;
/**
* \returns a new instance of an AttributeValue (wrapper in an Attribute
* instance) which matches the type of the underlying attribute.
*
* This method is typically used to create a temporary variable prior
* to calling Attribute::DeserializeFromString.
*/
virtual Ptr<AttributeValue> Create (void) const = 0;
virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const = 0;
};
/**
* \brief A class for an empty attribute value
*
* \ingroup attribute
*/
class EmptyAttributeValue : public AttributeValue
{
public:
EmptyAttributeValue ();
private:
virtual Ptr<AttributeValue> Copy (void) const;
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
};
} // namespace ns3
#endif /* ATTRIBUTE_H */
| zy901002-gpsr | src/core/model/attribute.h | C++ | gpl2 | 7,308 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "scheduler.h"
#include "assert.h"
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (Scheduler);
Scheduler::~Scheduler ()
{
}
TypeId
Scheduler::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Scheduler")
.SetParent<Object> ()
;
return tid;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/scheduler.cc | C++ | gpl2 | 1,099 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WALL_CLOCK_CLOCK_SYNCHRONIZER_H
#define WALL_CLOCK_CLOCK_SYNCHRONIZER_H
#include "system-condition.h"
#include "synchronizer.h"
namespace ns3 {
/**
* @brief Class used for synchronizing the simulation events to a real-time
* "wall clock" using Posix Clock functions.
*
* Enable this synchronizer using:
*
* DefaultValue::Bind ("Synchronizer", "WallClockSynchronizer");
*
* before calling any simulator functions.
*
* The simulation clock is maintained as a 64-bit integer in a unit specified
* by the user through the TimeStepPrecision::Set function. This means that
* it is not possible to specify event expiration times with anything better
* than this user-specified accuracy.
*
* There are a couple of more issues at this level. Posix clocks provide
* access to several clocks we could use as a wall clock. We don't care about
* time in the sense of 0430 CEST, we care about some piece of hardware that
* ticks at some regular period. The most accurate posix clock in this
* respect is the CLOCK_PROCESS_CPUTIME_ID clock. This is a high-resolution
* register in the CPU. For example, on Intel machines this corresponds to
* the timestamp counter (TSC) register. The resolution of this counter will
* be on the order of nanoseconds.
*
* Now, just because we can measure time in nanoseconds doesn't mean we can
* put our process to sleep to nanosecond resolution. We are eventually going
* to use the function clock_nanosleep () to sleep until a simulation Time
* specified by the caller.
*
* MORE ON JIFFIES, SLEEP, PROCESSES, etc., as required
*
* Nanosleep takes a struct timespec as an input so we have to deal with
* conversion between Time and struct timespec here. They are both
* interpreted as elapsed times.
*/
class WallClockSynchronizer : public Synchronizer
{
public:
WallClockSynchronizer ();
virtual ~WallClockSynchronizer ();
static const uint64_t US_PER_NS = (uint64_t)1000;
static const uint64_t US_PER_SEC = (uint64_t)1000000;
static const uint64_t NS_PER_SEC = (uint64_t)1000000000;
protected:
/**
* @brief Return true if this synchronizer is actually synchronizing to a
* realtime clock. The simulator sometimes needs to know this.
*
* @internal
*
* Subclasses are expected to implement this method to tell the outside world
* whether or not they are synchronizing to a realtime clock.
*
* @returns True if locked with realtime, false if not.
*/
virtual bool DoRealtime (void);
/**
* @brief Retrieve the value of the origin of the underlying normalized wall
* clock time in nanosecond units.
*
* @internal
*
* Subclasses are expected to implement this method to do the actual
* real-time-clock-specific work of getting the current time.
*
* @returns The normalized wall clock time (in nanosecond units).
* @see TimeStepPrecision::Get
* @see Synchronizer::SetOrigin
*/
virtual uint64_t DoGetCurrentRealtime (void);
/**
* @brief Establish a correspondence between a simulation time and a
* wall-clock (real) time.
*
* @internal
*
* There are three timelines involved here: the simulation time, the
* (absolute) wall-clock time and the (relative) synchronizer real time.
* Calling this method makes a correspondence between the origin of the
* synchronizer time and the current wall-clock time.
*
* This method is expected to be called at the "instant" before simulation
* begins. At this point, simulation time = 0, and synchronizer time is
* set = 0 in this method. We then associate this time with the current
* value of the real time clock that will be used to actually perform the
* synchronization.
*
* Subclasses are expected to implement this method to do the actual
* real-time-clock-specific work of making the correspondence mentioned above.
* for example, this is where the differences between Time parameters and
* parameters to clock_nanosleep would be dealt with.
*
* @param ns The simulation time we need to use as the origin (normalized to
* nanosecond units).
*/
virtual void DoSetOrigin (uint64_t ns);
/**
* @brief Declaration of method used to retrieve drift between the real time
* clock used to synchronize the simulation and the current simulation time.
*
* @internal
*
* @param ns Simulation timestep from the simulator normalized to nanosecond
* steps.
* @returns Drift in nanosecond units.
* @see TimeStepPrecision::Get
* @see Synchronizer::SetOrigin
* @see Synchronizer::GetDrift
*/
virtual int64_t DoGetDrift (uint64_t ns);
/**
* @brief Wait until the real time is in sync with the specified simulation
* time.
*
* @internal
*
* This is where the real work of synchronization is done. The Time passed
* in as a parameter is the simulation time. The job of Synchronize is to
* translate from simulation time to synchronizer time (in a perfect world
* this is the same time) and then figure out how long in real-time it needs
* to wait until that synchronizer / simulation time comes around.
*
* Subclasses are expected to implement this method to do the actual
* real-time-clock-specific work of waiting (either busy-waiting or sleeping,
* or some combination) until the requested simulation time.
*
* @param ns The simulation time we need to wait for (normalized to nanosecond
* units).
* @see TimeStepPrecision::Get
*/
virtual bool DoSynchronize (uint64_t nsCurrent, uint64_t nsDelay);
virtual void DoSignal (void);
virtual void DoSetCondition (bool cond);
virtual void DoEventStart (void);
virtual uint64_t DoEventEnd (void);
bool SpinWait (uint64_t);
bool SleepWait (uint64_t);
uint64_t DriftCorrect (uint64_t nsNow, uint64_t nsDelay);
uint64_t GetRealtime (void);
uint64_t GetNormalizedRealtime (void);
void NsToTimeval (int64_t ns, struct timeval *tv);
uint64_t TimevalToNs (struct timeval *tv);
void TimevalAdd (
struct timeval *tv1,
struct timeval *tv2,
struct timeval *result);
uint64_t m_cpuTick;
uint64_t m_realtimeTick;
uint64_t m_jiffy;
uint64_t m_nsEventStart;
SystemCondition m_condition;
};
} // namespace ns3
#endif /* WALL_CLOCK_SYNCHRONIZER_H */
| zy901002-gpsr | src/core/model/wall-clock-synchronizer.h | C++ | gpl2 | 6,912 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "trace-source-accessor.h"
namespace ns3 {
TraceSourceAccessor::TraceSourceAccessor ()
{
}
TraceSourceAccessor::~TraceSourceAccessor ()
{
}
} // namespace ns3
| zy901002-gpsr | src/core/model/trace-source-accessor.cc | C++ | gpl2 | 985 |
#include "ns3/core-config.h"
#if !defined(INT64X64_DOUBLE_H) && (defined (INT64X64_USE_DOUBLE) || defined(PYTHON_SCAN))
#define INT64X64_DOUBLE_H
#include <iostream>
#include <math.h>
namespace ns3 {
class int64x64_t
{
public:
inline int64x64_t ()
: _v (0) {}
inline int64x64_t (double v)
: _v (v) {}
inline int64x64_t (int v)
: _v (v) {}
inline int64x64_t (long int v)
: _v (v) {}
inline int64x64_t (long long int v)
: _v (v) {}
inline int64x64_t (unsigned int v)
: _v (v) {}
inline int64x64_t (unsigned long int v)
: _v (v) {}
inline int64x64_t (unsigned long long int v)
: _v (v) {}
inline int64x64_t (int64_t hi, uint64_t lo)
: _v (hi) { /* XXX */}
inline int64x64_t (const int64x64_t &o)
: _v (o._v) {}
inline int64x64_t &operator = (const int64x64_t &o)
{
_v = o._v;
return *this;
}
inline double GetDouble (void) const
{
return _v;
}
inline int64_t GetHigh (void) const
{
return (int64_t)floor (_v);
}
inline uint64_t GetLow (void) const
{
// XXX
return 0;
}
inline void MulByInvert (const int64x64_t &o)
{
_v *= o._v;
}
static inline int64x64_t Invert (uint64_t v)
{
double d = v;
return int64x64_t (1/d);
}
private:
friend bool operator == (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator != (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator <= (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator >= (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator < (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator > (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator += (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator -= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator *= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator /= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator + (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator - (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator * (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator / (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator + (const int64x64_t &lhs);
friend int64x64_t operator - (const int64x64_t &lhs);
friend int64x64_t operator ! (const int64x64_t &lhs);
double _v;
};
inline bool operator == (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v == rhs._v;
}
inline bool operator != (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v != rhs._v;
}
inline bool operator <= (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v <= rhs._v;
}
inline bool operator >= (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v >= rhs._v;
}
inline bool operator < (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v < rhs._v;
}
inline bool operator > (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v > rhs._v;
}
inline int64x64_t &operator += (int64x64_t &lhs, const int64x64_t &rhs)
{
double tmp = lhs._v;
tmp += rhs._v;
lhs = int64x64_t (tmp);
return lhs;
}
inline int64x64_t &operator -= (int64x64_t &lhs, const int64x64_t &rhs)
{
double tmp = lhs._v;
tmp -= rhs._v;
lhs = int64x64_t (tmp);
return lhs;
}
inline int64x64_t &operator *= (int64x64_t &lhs, const int64x64_t &rhs)
{
double tmp = lhs._v;
tmp *= rhs._v;
lhs = int64x64_t (tmp);
return lhs;
}
inline int64x64_t &operator /= (int64x64_t &lhs, const int64x64_t &rhs)
{
double tmp = lhs._v;
tmp /= rhs._v;
lhs = int64x64_t (tmp);
return lhs;
}
inline int64x64_t operator + (const int64x64_t &lhs)
{
return lhs;
}
inline int64x64_t operator - (const int64x64_t &lhs)
{
return int64x64_t (-lhs._v);
}
inline int64x64_t operator ! (const int64x64_t &lhs)
{
return int64x64_t (!lhs._v);
}
} // namespace ns3
#endif /* INT64X64_DOUBLE_H */
| zy901002-gpsr | src/core/model/int64x64-double.h | C++ | gpl2 | 4,046 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "config.h"
#include "singleton.h"
#include "object.h"
#include "global-value.h"
#include "object-ptr-container.h"
#include "names.h"
#include "pointer.h"
#include "log.h"
#include <sstream>
NS_LOG_COMPONENT_DEFINE ("Config");
namespace ns3 {
namespace Config {
MatchContainer::MatchContainer ()
{
}
MatchContainer::MatchContainer (const std::vector<Ptr<Object> > &objects,
const std::vector<std::string> &contexts,
std::string path)
: m_objects (objects),
m_contexts (contexts),
m_path (path)
{
}
MatchContainer::Iterator
MatchContainer::Begin (void) const
{
return m_objects.begin ();
}
MatchContainer::Iterator
MatchContainer::End (void) const
{
return m_objects.end ();
}
uint32_t
MatchContainer::GetN (void) const
{
return m_objects.size ();
}
Ptr<Object>
MatchContainer::Get (uint32_t i) const
{
return m_objects[i];
}
std::string
MatchContainer::GetMatchedPath (uint32_t i) const
{
return m_contexts[i];
}
std::string
MatchContainer::GetPath (void) const
{
return m_path;
}
void
MatchContainer::Set (std::string name, const AttributeValue &value)
{
for (Iterator tmp = Begin (); tmp != End (); ++tmp)
{
Ptr<Object> object = *tmp;
object->SetAttribute (name, value);
}
}
void
MatchContainer::Connect (std::string name, const CallbackBase &cb)
{
NS_ASSERT (m_objects.size () == m_contexts.size ());
for (uint32_t i = 0; i < m_objects.size (); ++i)
{
Ptr<Object> object = m_objects[i];
std::string ctx = m_contexts[i] + name;
object->TraceConnect (name, ctx, cb);
}
}
void
MatchContainer::ConnectWithoutContext (std::string name, const CallbackBase &cb)
{
for (Iterator tmp = Begin (); tmp != End (); ++tmp)
{
Ptr<Object> object = *tmp;
object->TraceConnectWithoutContext (name, cb);
}
}
void
MatchContainer::Disconnect (std::string name, const CallbackBase &cb)
{
NS_ASSERT (m_objects.size () == m_contexts.size ());
for (uint32_t i = 0; i < m_objects.size (); ++i)
{
Ptr<Object> object = m_objects[i];
std::string ctx = m_contexts[i] + name;
object->TraceDisconnect (name, ctx, cb);
}
}
void
MatchContainer::DisconnectWithoutContext (std::string name, const CallbackBase &cb)
{
for (Iterator tmp = Begin (); tmp != End (); ++tmp)
{
Ptr<Object> object = *tmp;
object->TraceDisconnectWithoutContext (name, cb);
}
}
} // namespace Config
class ArrayMatcher
{
public:
ArrayMatcher (std::string element);
bool Matches (uint32_t i) const;
private:
bool StringToUint32 (std::string str, uint32_t *value) const;
std::string m_element;
};
ArrayMatcher::ArrayMatcher (std::string element)
: m_element (element)
{
}
bool
ArrayMatcher::Matches (uint32_t i) const
{
if (m_element == "*")
{
NS_LOG_DEBUG ("Array "<<i<<" matches *");
return true;
}
std::string::size_type tmp;
tmp = m_element.find ("|");
if (tmp != std::string::npos)
{
std::string left = m_element.substr (0, tmp-0);
std::string right = m_element.substr (tmp+1, m_element.size () - (tmp + 1));
ArrayMatcher matcher = ArrayMatcher (left);
if (matcher.Matches (i))
{
NS_LOG_DEBUG ("Array "<<i<<" matches "<<left);
return true;
}
matcher = ArrayMatcher (right);
if (matcher.Matches (i))
{
NS_LOG_DEBUG ("Array "<<i<<" matches "<<right);
return true;
}
NS_LOG_DEBUG ("Array "<<i<<" does not match "<<m_element);
return false;
}
std::string::size_type leftBracket = m_element.find ("[");
std::string::size_type rightBracket = m_element.find ("]");
std::string::size_type dash = m_element.find ("-");
if (leftBracket == 0 && rightBracket == m_element.size () - 1 &&
dash > leftBracket && dash < rightBracket)
{
std::string lowerBound = m_element.substr (leftBracket + 1, dash - (leftBracket + 1));
std::string upperBound = m_element.substr (dash + 1, rightBracket - (dash + 1));
uint32_t min;
uint32_t max;
if (StringToUint32 (lowerBound, &min) &&
StringToUint32 (upperBound, &max) &&
i >= min && i <= max)
{
NS_LOG_DEBUG ("Array "<<i<<" matches "<<m_element);
return true;
}
else
{
NS_LOG_DEBUG ("Array "<<i<<" does not "<<m_element);
return false;
}
}
uint32_t value;
if (StringToUint32 (m_element, &value) &&
i == value)
{
NS_LOG_DEBUG ("Array "<<i<<" matches "<<m_element);
return true;
}
NS_LOG_DEBUG ("Array "<<i<<" does not match "<<m_element);
return false;
}
bool
ArrayMatcher::StringToUint32 (std::string str, uint32_t *value) const
{
std::istringstream iss;
iss.str (str);
iss >> (*value);
return !iss.bad () && !iss.fail ();
}
class Resolver
{
public:
Resolver (std::string path);
virtual ~Resolver ();
void Resolve (Ptr<Object> root);
private:
void Canonicalize (void);
void DoResolve (std::string path, Ptr<Object> root);
void DoArrayResolve (std::string path, const ObjectPtrContainerValue &vector);
void DoResolveOne (Ptr<Object> object);
std::string GetResolvedPath (void) const;
virtual void DoOne (Ptr<Object> object, std::string path) = 0;
std::vector<std::string> m_workStack;
std::string m_path;
};
Resolver::Resolver (std::string path)
: m_path (path)
{
Canonicalize ();
}
Resolver::~Resolver ()
{
}
void
Resolver::Canonicalize (void)
{
// ensure that we start and end with a '/'
std::string::size_type tmp = m_path.find ("/");
if (tmp != 0)
{
// no slash at start
m_path = "/" + m_path;
}
tmp = m_path.find_last_of ("/");
if (tmp != (m_path.size () - 1))
{
// no slash at end
m_path = m_path + "/";
}
}
void
Resolver::Resolve (Ptr<Object> root)
{
DoResolve (m_path, root);
}
std::string
Resolver::GetResolvedPath (void) const
{
std::string fullPath = "/";
for (std::vector<std::string>::const_iterator i = m_workStack.begin (); i != m_workStack.end (); i++)
{
fullPath += *i + "/";
}
return fullPath;
}
void
Resolver::DoResolveOne (Ptr<Object> object)
{
NS_LOG_DEBUG ("resolved="<<GetResolvedPath ());
DoOne (object, GetResolvedPath ());
}
void
Resolver::DoResolve (std::string path, Ptr<Object> root)
{
NS_LOG_FUNCTION (path << root);
NS_ASSERT ((path.find ("/")) == 0);
std::string::size_type next = path.find ("/", 1);
if (next == std::string::npos)
{
//
// If root is zero, we're beginning to see if we can use the object name
// service to resolve this path. It is impossible to have a object name
// associated with the root of the object name service since that root
// is not an object. This path must be referring to something in another
// namespace and it will have been found already since the name service
// is always consulted last.
//
if (root)
{
DoResolveOne (root);
}
return;
}
std::string item = path.substr (1, next-1);
std::string pathLeft = path.substr (next, path.size ()-next);
//
// If root is zero, we're beginning to see if we can use the object name
// service to resolve this path. In this case, we must see the name space
// "/Names" on the front of this path. There is no object associated with
// the root of the "/Names" namespace, so we just ignore it and move on to
// the next segment.
//
if (root == 0)
{
std::string::size_type offset = path.find ("/Names");
if (offset == 0)
{
m_workStack.push_back (item);
DoResolve (pathLeft, root);
m_workStack.pop_back ();
return;
}
}
//
// We have an item (possibly a segment of a namespace path. Check to see if
// we can determine that this segment refers to a named object. If root is
// zero, this means to look in the root of the "/Names" name space, otherwise
// it refers to a name space context (level).
//
Ptr<Object> namedObject = Names::Find<Object> (root, item);
if (namedObject)
{
NS_LOG_DEBUG ("Name system resolved item = " << item << " to " << namedObject);
m_workStack.push_back (item);
DoResolve (pathLeft, namedObject);
m_workStack.pop_back ();
return;
}
//
// We're done with the object name service hooks, so proceed down the path
// of types and attributes; but only if root is nonzero. If root is zero
// and we find ourselves here, we are trying to check in the namespace for
// a path that is not in the "/Names" namespace. We will have previously
// found any matches, so we just bail out.
//
if (root == 0)
{
return;
}
std::string::size_type dollarPos = item.find ("$");
if (dollarPos == 0)
{
// This is a call to GetObject
std::string tidString = item.substr (1, item.size () - 1);
NS_LOG_DEBUG ("GetObject="<<tidString<<" on path="<<GetResolvedPath ());
TypeId tid = TypeId::LookupByName (tidString);
Ptr<Object> object = root->GetObject<Object> (tid);
if (object == 0)
{
NS_LOG_DEBUG ("GetObject ("<<tidString<<") failed on path="<<GetResolvedPath ());
return;
}
m_workStack.push_back (item);
DoResolve (pathLeft, object);
m_workStack.pop_back ();
}
else
{
// this is a normal attribute.
TypeId tid = root->GetInstanceTypeId ();
struct TypeId::AttributeInformation info;
if (!tid.LookupAttributeByName (item, &info))
{
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist on path="<<GetResolvedPath ());
return;
}
// attempt to cast to a pointer checker.
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
if (ptr != 0)
{
NS_LOG_DEBUG ("GetAttribute(ptr)="<<item<<" on path="<<GetResolvedPath ());
PointerValue ptr;
root->GetAttribute (item, ptr);
Ptr<Object> object = ptr.Get<Object> ();
if (object == 0)
{
NS_LOG_ERROR ("Requested object name=\""<<item<<
"\" exists on path=\""<<GetResolvedPath ()<<"\""
" but is null.");
return;
}
m_workStack.push_back (item);
DoResolve (pathLeft, object);
m_workStack.pop_back ();
}
// attempt to cast to an object vector.
const ObjectPtrContainerChecker *vectorChecker = dynamic_cast<const ObjectPtrContainerChecker *> (PeekPointer (info.checker));
if (vectorChecker != 0)
{
NS_LOG_DEBUG ("GetAttribute(vector)="<<item<<" on path="<<GetResolvedPath ());
ObjectPtrContainerValue vector;
root->GetAttribute (item, vector);
m_workStack.push_back (item);
DoArrayResolve (pathLeft, vector);
m_workStack.pop_back ();
}
// this could be anything else and we don't know what to do with it.
// So, we just ignore it.
}
}
void
Resolver::DoArrayResolve (std::string path, const ObjectPtrContainerValue &vector)
{
NS_ASSERT (path != "");
NS_ASSERT ((path.find ("/")) == 0);
std::string::size_type next = path.find ("/", 1);
if (next == std::string::npos)
{
NS_FATAL_ERROR ("vector path includes no index data on path=\""<<path<<"\"");
}
std::string item = path.substr (1, next-1);
std::string pathLeft = path.substr (next, path.size ()-next);
ArrayMatcher matcher = ArrayMatcher (item);
for (uint32_t i = 0; i < vector.GetN (); i++)
{
if (matcher.Matches (i))
{
std::ostringstream oss;
oss << i;
m_workStack.push_back (oss.str ());
DoResolve (pathLeft, vector.Get (i));
m_workStack.pop_back ();
}
}
}
class ConfigImpl
{
public:
void Set (std::string path, const AttributeValue &value);
void ConnectWithoutContext (std::string path, const CallbackBase &cb);
void Connect (std::string path, const CallbackBase &cb);
void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
void Disconnect (std::string path, const CallbackBase &cb);
Config::MatchContainer LookupMatches (std::string path);
void RegisterRootNamespaceObject (Ptr<Object> obj);
void UnregisterRootNamespaceObject (Ptr<Object> obj);
uint32_t GetRootNamespaceObjectN (void) const;
Ptr<Object> GetRootNamespaceObject (uint32_t i) const;
private:
void ParsePath (std::string path, std::string *root, std::string *leaf) const;
typedef std::vector<Ptr<Object> > Roots;
Roots m_roots;
};
void
ConfigImpl::ParsePath (std::string path, std::string *root, std::string *leaf) const
{
std::string::size_type slash = path.find_last_of ("/");
NS_ASSERT (slash != std::string::npos);
*root = path.substr (0, slash);
*leaf = path.substr (slash+1, path.size ()-(slash+1));
NS_LOG_FUNCTION (path << *root << *leaf);
}
void
ConfigImpl::Set (std::string path, const AttributeValue &value)
{
std::string root, leaf;
ParsePath (path, &root, &leaf);
Config::MatchContainer container = LookupMatches (root);
container.Set (leaf, value);
}
void
ConfigImpl::ConnectWithoutContext (std::string path, const CallbackBase &cb)
{
std::string root, leaf;
ParsePath (path, &root, &leaf);
Config::MatchContainer container = LookupMatches (root);
container.ConnectWithoutContext (leaf, cb);
}
void
ConfigImpl::DisconnectWithoutContext (std::string path, const CallbackBase &cb)
{
std::string root, leaf;
ParsePath (path, &root, &leaf);
Config::MatchContainer container = LookupMatches (root);
container.DisconnectWithoutContext (leaf, cb);
}
void
ConfigImpl::Connect (std::string path, const CallbackBase &cb)
{
std::string root, leaf;
ParsePath (path, &root, &leaf);
Config::MatchContainer container = LookupMatches (root);
container.Connect (leaf, cb);
}
void
ConfigImpl::Disconnect (std::string path, const CallbackBase &cb)
{
std::string root, leaf;
ParsePath (path, &root, &leaf);
Config::MatchContainer container = LookupMatches (root);
container.Disconnect (leaf, cb);
}
Config::MatchContainer
ConfigImpl::LookupMatches (std::string path)
{
NS_LOG_FUNCTION (path);
class LookupMatchesResolver : public Resolver
{
public:
LookupMatchesResolver (std::string path)
: Resolver (path)
{}
virtual void DoOne (Ptr<Object> object, std::string path) {
m_objects.push_back (object);
m_contexts.push_back (path);
}
std::vector<Ptr<Object> > m_objects;
std::vector<std::string> m_contexts;
} resolver = LookupMatchesResolver (path);
for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++)
{
resolver.Resolve (*i);
}
//
// See if we can do something with the object name service. Starting with
// the root pointer zeroed indicates to the resolver that it should start
// looking at the root of the "/Names" namespace during this go.
//
resolver.Resolve (0);
return Config::MatchContainer (resolver.m_objects, resolver.m_contexts, path);
}
void
ConfigImpl::RegisterRootNamespaceObject (Ptr<Object> obj)
{
m_roots.push_back (obj);
}
void
ConfigImpl::UnregisterRootNamespaceObject (Ptr<Object> obj)
{
for (std::vector<Ptr<Object> >::iterator i = m_roots.begin (); i != m_roots.end (); i++)
{
if (*i == obj)
{
m_roots.erase (i);
return;
}
}
}
uint32_t
ConfigImpl::GetRootNamespaceObjectN (void) const
{
return m_roots.size ();
}
Ptr<Object>
ConfigImpl::GetRootNamespaceObject (uint32_t i) const
{
return m_roots[i];
}
namespace Config {
void Reset (void)
{
// First, let's reset the initial value of every attribute
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++)
{
TypeId tid = TypeId::GetRegistered (i);
for (uint32_t j = 0; j < tid.GetAttributeN (); j++)
{
struct TypeId::AttributeInformation info = tid.GetAttribute (j);
tid.SetAttributeInitialValue (j, info.originalInitialValue);
}
}
// now, let's reset the initial value of every global value.
for (GlobalValue::Iterator i = GlobalValue::Begin (); i != GlobalValue::End (); ++i)
{
(*i)->ResetInitialValue ();
}
}
void Set (std::string path, const AttributeValue &value)
{
Singleton<ConfigImpl>::Get ()->Set (path, value);
}
void SetDefault (std::string name, const AttributeValue &value)
{
if (!SetDefaultFailSafe(name, value))
{
NS_FATAL_ERROR ("Could not set default value for " << name);
}
}
bool SetDefaultFailSafe (std::string fullName, const AttributeValue &value)
{
std::string::size_type pos = fullName.rfind ("::");
if (pos == std::string::npos)
{
return false;
}
std::string tidName = fullName.substr (0, pos);
std::string paramName = fullName.substr (pos+2, fullName.size () - (pos+2));
TypeId tid;
bool ok = TypeId::LookupByNameFailSafe (tidName, &tid);
if (!ok)
{
return false;
}
for (uint32_t j = 0; j < tid.GetAttributeN (); j++)
{
struct TypeId::AttributeInformation tmp = tid.GetAttribute(j);
if (tmp.name == paramName)
{
Ptr<AttributeValue> v = tmp.checker->CreateValidValue (value);
if (v == 0)
{
return false;
}
tid.SetAttributeInitialValue (j, v);
return true;
}
}
return false;
}
void SetGlobal (std::string name, const AttributeValue &value)
{
GlobalValue::Bind (name, value);
}
bool SetGlobalFailSafe (std::string name, const AttributeValue &value)
{
return GlobalValue::BindFailSafe (name, value);
}
void ConnectWithoutContext (std::string path, const CallbackBase &cb)
{
Singleton<ConfigImpl>::Get ()->ConnectWithoutContext (path, cb);
}
void DisconnectWithoutContext (std::string path, const CallbackBase &cb)
{
Singleton<ConfigImpl>::Get ()->DisconnectWithoutContext (path, cb);
}
void
Connect (std::string path, const CallbackBase &cb)
{
Singleton<ConfigImpl>::Get ()->Connect (path, cb);
}
void
Disconnect (std::string path, const CallbackBase &cb)
{
Singleton<ConfigImpl>::Get ()->Disconnect (path, cb);
}
Config::MatchContainer LookupMatches (std::string path)
{
return Singleton<ConfigImpl>::Get ()->LookupMatches (path);
}
void RegisterRootNamespaceObject (Ptr<Object> obj)
{
Singleton<ConfigImpl>::Get ()->RegisterRootNamespaceObject (obj);
}
void UnregisterRootNamespaceObject (Ptr<Object> obj)
{
Singleton<ConfigImpl>::Get ()->UnregisterRootNamespaceObject (obj);
}
uint32_t GetRootNamespaceObjectN (void)
{
return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObjectN ();
}
Ptr<Object> GetRootNamespaceObject (uint32_t i)
{
return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i);
}
} // namespace Config
} // namespace ns3
| zy901002-gpsr | src/core/model/config.cc | C++ | gpl2 | 19,814 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* Copyright (c) 2007 Emmanuelle Laprise
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* TimeStep support by Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
*/
#include "nstime.h"
#include "abort.h"
#include "global-value.h"
#include "enum.h"
#include "string.h"
#include "object.h"
#include "config.h"
#include <math.h>
#include <sstream>
namespace ns3 {
Time::Time (const std::string& s)
{
std::string::size_type n = s.find_first_not_of ("+-0123456789.");
if (n != std::string::npos)
{ // Found non-numeric
std::istringstream iss;
iss.str (s.substr (0, n));
double r;
iss >> r;
std::string trailer = s.substr (n, std::string::npos);
if (trailer == std::string ("s"))
{
*this = Time::FromDouble (r, Time::S);
return;
}
if (trailer == std::string ("ms"))
{
*this = Time::FromDouble (r, Time::MS);
return;
}
if (trailer == std::string ("us"))
{
*this = Time::FromDouble (r, Time::US);
return;
}
if (trailer == std::string ("ns"))
{
*this = Time::FromDouble (r, Time::NS);
return;
}
if (trailer == std::string ("ps"))
{
*this = Time::FromDouble (r, Time::PS);
return;
}
if (trailer == std::string ("fs"))
{
*this = Time::FromDouble (r, Time::FS);
return;
}
NS_ABORT_MSG ("Can't Parse Time " << s);
}
// else
// they didn't provide units, assume seconds
std::istringstream iss;
iss.str (s);
double v;
iss >> v;
*this = Time::FromDouble (v, Time::S);
}
struct Time::Resolution
Time::GetNsResolution (void)
{
struct Resolution resolution;
SetResolution (Time::NS, &resolution);
return resolution;
}
void
Time::SetResolution (enum Unit resolution)
{
SetResolution (resolution, PeekResolution ());
}
void
Time::SetResolution (enum Unit unit, struct Resolution *resolution)
{
int8_t power [LAST] = { 15, 12, 9, 6, 3, 0};
for (int i = 0; i < Time::LAST; i++)
{
int shift = power[i] - power[(int)unit];
uint64_t factor = (uint64_t) pow (10, fabs (shift));
struct Information *info = &resolution->info[i];
info->factor = factor;
if (shift == 0)
{
info->timeFrom = int64x64_t (1);
info->timeTo = int64x64_t (1);
info->toMul = true;
info->fromMul = true;
}
else if (shift > 0)
{
info->timeFrom = int64x64_t (factor);
info->timeTo = int64x64_t::Invert (factor);
info->toMul = false;
info->fromMul = true;
}
else
{
NS_ASSERT (shift < 0);
info->timeFrom = int64x64_t::Invert (factor);
info->timeTo = int64x64_t (factor);
info->toMul = true;
info->fromMul = false;
}
}
resolution->unit = unit;
}
enum Time::Unit
Time::GetResolution (void)
{
return PeekResolution ()->unit;
}
std::ostream&
operator<< (std::ostream& os, const Time & time)
{
std::string unit;
switch (Time::GetResolution ())
{
case Time::S:
unit = "s";
break;
case Time::MS:
unit = "ms";
break;
case Time::US:
unit = "us";
break;
case Time::NS:
unit = "ns";
break;
case Time::PS:
unit = "ps";
break;
case Time::FS:
unit = "fs";
break;
case Time::LAST:
NS_ABORT_MSG ("can't be reached");
unit = "unreachable";
break;
}
int64x64_t v = time;
os << v << unit;
return os;
}
std::istream& operator>> (std::istream& is, Time & time)
{
std::string value;
is >> value;
time = Time (value);
return is;
}
ATTRIBUTE_VALUE_IMPLEMENT (Time);
ATTRIBUTE_CHECKER_IMPLEMENT (Time);
} // namespace ns3
| zy901002-gpsr | src/core/model/time.cc | C++ | gpl2 | 4,619 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef BOOLEAN_H
#define BOOLEAN_H
#include "attribute.h"
#include "attribute-helper.h"
namespace ns3 {
/**
* \ingroup attribute
*
* \brief Hold a bool native type
*
* \anchor bool
*
* This class can be used to hold bool variables
* which must go through the Attribute system.
*/
class BooleanValue : public AttributeValue
{
public:
BooleanValue ();
BooleanValue (bool value);
void Set (bool value);
bool Get (void) const;
template <typename T>
bool GetAccessor (T &v) const;
operator bool () const;
virtual Ptr<AttributeValue> Copy (void) const;
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
private:
bool m_value;
};
template <typename T>
bool BooleanValue::GetAccessor (T &v) const
{
v = T (m_value);
return true;
}
std::ostream & operator << (std::ostream &os, const BooleanValue &value);
ATTRIBUTE_CHECKER_DEFINE (Boolean);
ATTRIBUTE_ACCESSOR_DEFINE (Boolean);
} // namespace ns3
#endif /* BOOLEAN_H */
| zy901002-gpsr | src/core/model/boolean.h | C++ | gpl2 | 1,899 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Georgia Tech Research Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: George Riley <riley@ece.gatech.edu>
* Adapted from original code in object.h by:
* Authors: Gustavo Carneiro <gjcarneiro@gmail.com>,
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef REF_COUNT_BASE_H
#define REF_COUNT_BASE_H
#include "simple-ref-count.h"
namespace ns3 {
/**
* \brief A deprecated way to get reference-counting powers
*
* Users who wish to use reference counting for a class of their own should use
* instead the template \ref ns3::SimpleRefCount. This class is maintained
* purely for compatibility to avoid breaking the code of users.
*/
class RefCountBase : public SimpleRefCount<RefCountBase>
{
public:
/**
* This only thing this class does it declare a virtual destructor
*/
virtual ~RefCountBase ();
};
} // namespace ns3
#endif /* REF_COUNT_BASE_H */
| zy901002-gpsr | src/core/model/ref-count-base.h | C++ | gpl2 | 1,611 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage.inria.fr>
*/
#include "system-wall-clock-ms.h"
#include "abort.h"
#include <sys/times.h>
namespace ns3 {
class SystemWallClockMsPrivate {
public:
void Start (void);
int64_t End (void);
int64_t GetElapsedReal (void) const;
int64_t GetElapsedUser (void) const;
int64_t GetElapsedSystem (void) const;
private:
struct tms m_startTimes;
clock_t m_startTime;
int64_t m_elapsedReal;
int64_t m_elapsedUser;
int64_t m_elapsedSystem;
};
void
SystemWallClockMsPrivate::Start (void)
{
m_startTime = times (&m_startTimes);
}
int64_t
SystemWallClockMsPrivate::End (void)
{
//
// We need to return the number of milliseconds that have elapsed in some
// reasonably portable way. The underlying function that we will use returns
// a number of elapsed ticks. We can look up the number of ticks per second
// from the system configuration.
//
// Conceptually, we need to find the number of elapsed clock ticks and then
// multiply the result by the milliseconds per clock tick (or divide by clock
// ticks per millisecond). Integer dividing by clock ticks per millisecond
// is bad since this number is fractional on most machines and would result
// in divide by zero errors due to integer rounding.
//
// Multiplying by milliseconds per clock tick works up to a clock resolution
// of 1000 ticks per second. If we go past this point, we begin to get zero
// elapsed times when millisecondsPerTick becomes fractional and another
// rounding error appears.
//
// So rounding errors using integers can bite you from both direction. Since
// all of our targets have math coprocessors, why not just use doubles
// internally? Works fine, lasts a long time.
//
// If millisecondsPerTick becomes fractional, and an elapsed time greater than
// a milliscond is measured, the function will work as expected. If an elapsed
// time is measured that turns out to be less than a millisecond, we'll just
// return zero which would, I think, also will be expected.
//
static int64_t ticksPerSecond = sysconf (_SC_CLK_TCK);
static double millisecondsPerTick = 1000. / ticksPerSecond;
//
// If sysconf () fails, we have no idea how to do the required conversion to ms.
//
NS_ABORT_MSG_IF (ticksPerSecond == -1, "SystemWallClockMsPrivate(): Cannot sysconf (_SC_CLK_TCK)");
struct tms endTimes;
clock_t endTime = times (&endTimes);
double tmp;
tmp = static_cast<double> (endTime - m_startTime) * millisecondsPerTick;
m_elapsedReal = static_cast<int64_t> (tmp);
tmp = static_cast<double> (endTimes.tms_utime - m_startTimes.tms_utime) * millisecondsPerTick;
m_elapsedUser = static_cast<int64_t> (tmp);
tmp = static_cast<double> (endTimes.tms_stime - m_startTimes.tms_stime) * millisecondsPerTick;
m_elapsedSystem = static_cast<int64_t> (tmp);
return m_elapsedReal;
}
int64_t
SystemWallClockMsPrivate::GetElapsedReal (void) const
{
return m_elapsedReal;
}
int64_t
SystemWallClockMsPrivate::GetElapsedUser (void) const
{
return m_elapsedUser;
}
int64_t
SystemWallClockMsPrivate::GetElapsedSystem (void) const
{
return m_elapsedSystem;
}
SystemWallClockMs::SystemWallClockMs ()
: m_priv (new SystemWallClockMsPrivate ())
{
}
SystemWallClockMs::~SystemWallClockMs ()
{
delete m_priv;
m_priv = 0;
}
void
SystemWallClockMs::Start (void)
{
m_priv->Start ();
}
int64_t
SystemWallClockMs::End (void)
{
return m_priv->End ();
}
int64_t
SystemWallClockMs::GetElapsedReal (void) const
{
return m_priv->GetElapsedReal ();
}
int64_t
SystemWallClockMs::GetElapsedUser (void) const
{
return m_priv->GetElapsedUser ();
}
int64_t
SystemWallClockMs::GetElapsedSystem (void) const
{
return m_priv->GetElapsedSystem ();
}
} // namespace ns3
| zy901002-gpsr | src/core/model/unix-system-wall-clock-ms.cc | C++ | gpl2 | 4,546 |
#include "ref-count-base.h"
namespace ns3 {
RefCountBase::~RefCountBase ()
{
}
} // namespace ns3
| zy901002-gpsr | src/core/model/ref-count-base.cc | C++ | gpl2 | 101 |
#include "int64x64-128.h"
#include "abort.h"
#include "assert.h"
namespace ns3 {
#define OUTPUT_SIGN(sa,sb,ua,ub) \
({ bool negA, negB; \
negA = sa < 0; \
negB = sb < 0; \
ua = negA ? -sa : sa; \
ub = negB ? -sb : sb; \
(negA && !negB) || (!negA && negB); })
#define MASK_LO ((((int128_t)1)<<64)-1)
#define MASK_HI (~MASK_LO)
void
int64x64_t::Mul (int64x64_t const &o)
{
bool negResult;
uint128_t a, b;
negResult = OUTPUT_SIGN (_v, o._v, a, b);
int128_t result = Umul (a, b);
// add the sign to the result
result = negResult ? -result : result;
_v = result;
}
uint128_t
int64x64_t::Umul (uint128_t a, uint128_t b)
{
uint128_t aL = a & MASK_LO;
uint128_t bL = b & MASK_LO;
uint128_t aH = (a >> 64) & MASK_LO;
uint128_t bH = (b >> 64) & MASK_LO;
uint128_t result;
uint128_t hiPart,loPart,midPart;
// Multiplying (a.h 2^64 + a.l) x (b.h 2^64 + b.l) =
// 2^128 a.h b.h + 2^64*(a.h b.l+b.h a.l) + a.l b.l
// get the low part a.l b.l
// multiply the fractional part
loPart = aL * bL;
// compute the middle part 2^64*(a.h b.l+b.h a.l)
midPart = aL * bH + aH * bL;
// truncate the low part
result = (loPart >> 64) + (midPart & MASK_LO);
// compute the high part 2^128 a.h b.h
hiPart = aH * bH;
// truncate the high part and only use the low part
result |= ((hiPart & MASK_LO) << 64) + (midPart & MASK_HI);
// if the high part is not zero, put a warning
NS_ABORT_MSG_IF ((hiPart & MASK_HI) != 0,
"High precision 128 bits multiplication error: multiplication overflow.");
return result;
}
void
int64x64_t::Div (int64x64_t const &o)
{
bool negResult;
uint128_t a, b;
negResult = OUTPUT_SIGN (_v, o._v, a, b);
int128_t result = Divu (a, b);
result = negResult ? -result : result;
_v = result;
}
uint128_t
int64x64_t::Divu (uint128_t a, uint128_t b)
{
uint128_t quo = a / b;
uint128_t rem = (a % b);
uint128_t result = quo << 64;
// Now, manage the remainder
uint128_t tmp = rem >> 64;
uint128_t div;
if (tmp == 0)
{
rem = rem << 64;
div = b;
}
else
{
rem = rem;
div = b >> 64;
}
quo = rem / div;
result = result + quo;
return result;
}
void
int64x64_t::MulByInvert (const int64x64_t &o)
{
bool negResult = _v < 0;
uint128_t a = negResult ? -_v : _v;
uint128_t result = UmulByInvert (a, o._v);
_v = negResult ? -result : result;
}
uint128_t
int64x64_t::UmulByInvert (uint128_t a, uint128_t b)
{
uint128_t result, ah, bh, al, bl;
uint128_t hi, mid;
ah = a >> 64;
bh = b >> 64;
al = a & MASK_LO;
bl = b & MASK_LO;
hi = ah * bh;
mid = ah * bl + al * bh;
mid >>= 64;
result = hi + mid;
return result;
}
int64x64_t
int64x64_t::Invert (uint64_t v)
{
NS_ASSERT (v > 1);
uint128_t a;
a = 1;
a <<= 64;
int64x64_t result;
result._v = Divu (a, v);
int64x64_t tmp = int64x64_t (v, false);
tmp.MulByInvert (result);
if (tmp.GetHigh () != 1)
{
result._v += 1;
}
return result;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/int64x64-128.cc | C++ | gpl2 | 3,326 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "int64x64-cairo.h"
#include "test.h"
#include "abort.h"
#include "assert.h"
#include <math.h>
#include <iostream>
namespace ns3 {
#define OUTPUT_SIGN(sa,sb,ua,ub) \
({ bool negA, negB; \
negA = _cairo_int128_negative (sa); \
negB = _cairo_int128_negative (sb); \
ua = _cairo_int128_to_uint128 (sa); \
ub = _cairo_int128_to_uint128 (sb); \
ua = negA ? _cairo_uint128_negate (ua) : ua; \
ub = negB ? _cairo_uint128_negate (ub) : ub; \
(negA && !negB) || (!negA && negB); })
void
int64x64_t::Mul (int64x64_t const &o)
{
cairo_uint128_t a, b, result;
bool sign = OUTPUT_SIGN (_v, o._v, a, b);
result = Umul (a, b);
_v = sign ? _cairo_uint128_negate (result) : result;
}
/**
* this function multiplies two 128 bits fractions considering
* the high 64 bits as the integer part and the low 64 bits
* as the fractional part. It takes into account the sign
* of the operands to produce a signed 128 bits result.
*/
cairo_uint128_t
int64x64_t::Umul (cairo_uint128_t a, cairo_uint128_t b)
{
cairo_uint128_t result;
cairo_uint128_t hiPart,loPart,midPart;
// Multiplying (a.h 2^64 + a.l) x (b.h 2^64 + b.l) =
// 2^128 a.h b.h + 2^64*(a.h b.l+b.h a.l) + a.l b.l
// get the low part a.l b.l
// multiply the fractional part
loPart = _cairo_uint64x64_128_mul (a.lo, b.lo);
// compute the middle part 2^64*(a.h b.l+b.h a.l)
midPart = _cairo_uint128_add (_cairo_uint64x64_128_mul (a.lo, b.hi),
_cairo_uint64x64_128_mul (a.hi, b.lo));
// truncate the low part
result.lo = _cairo_uint64_add (loPart.hi,midPart.lo);
// compute the high part 2^128 a.h b.h
hiPart = _cairo_uint64x64_128_mul (a.hi, b.hi);
// truncate the high part and only use the low part
result.hi = _cairo_uint64_add (hiPart.lo,midPart.hi);
// if the high part is not zero, put a warning
NS_ABORT_MSG_IF (hiPart.hi != 0,
"High precision 128 bits multiplication error: multiplication overflow.");
return result;
}
void
int64x64_t::Div (int64x64_t const &o)
{
cairo_uint128_t a, b, result;
bool sign = OUTPUT_SIGN (_v, o._v, a, b);
result = Udiv (a, b);
_v = sign ? _cairo_uint128_negate (result) : result;
}
cairo_uint128_t
int64x64_t::Udiv (cairo_uint128_t a, cairo_uint128_t b)
{
cairo_uquorem128_t qr = _cairo_uint128_divrem (a, b);
cairo_uint128_t result = _cairo_uint128_lsl (qr.quo, 64);
// Now, manage the remainder
cairo_uint128_t tmp = _cairo_uint128_rsl (qr.rem, 64);
cairo_uint128_t zero = _cairo_uint64_to_uint128 (0);
cairo_uint128_t rem, div;
if (_cairo_uint128_eq (tmp, zero))
{
rem = _cairo_uint128_lsl (qr.rem, 64);
div = b;
}
else
{
rem = qr.rem;
div = _cairo_uint128_rsl (b, 64);
}
qr = _cairo_uint128_divrem (rem, div);
result = _cairo_uint128_add (result, qr.quo);
return result;
}
void
int64x64_t::MulByInvert (const int64x64_t &o)
{
bool negResult = _cairo_int128_negative (_v);
cairo_uint128_t a = negResult ? _cairo_int128_negate (_v) : _v;
cairo_uint128_t result = UmulByInvert (a, o._v);
_v = negResult ? _cairo_int128_negate (result) : result;
}
cairo_uint128_t
int64x64_t::UmulByInvert (cairo_uint128_t a, cairo_uint128_t b)
{
cairo_uint128_t result;
cairo_uint128_t hi, mid;
hi = _cairo_uint64x64_128_mul (a.hi, b.hi);
mid = _cairo_uint128_add (_cairo_uint64x64_128_mul (a.hi, b.lo),
_cairo_uint64x64_128_mul (a.lo, b.hi));
mid.lo = mid.hi;
mid.hi = 0;
result = _cairo_uint128_add (hi,mid);
return result;
}
int64x64_t
int64x64_t::Invert (uint64_t v)
{
NS_ASSERT (v > 1);
cairo_uint128_t a, factor;
a.hi = 1;
a.lo = 0;
factor.hi = 0;
factor.lo = v;
int64x64_t result;
result._v = Udiv (a, factor);
int64x64_t tmp = int64x64_t (v, 0);
tmp.MulByInvert (result);
if (tmp.GetHigh () != 1)
{
cairo_uint128_t one = { 1, 0};
result._v = _cairo_uint128_add (result._v, one);
}
return result;
}
} // namespace ns3
// include directly to allow optimizations within the compilation unit.
extern "C" {
#include "cairo-wideint.c"
}
| zy901002-gpsr | src/core/model/int64x64-cairo.cc | C++ | gpl2 | 5,212 |
#ifndef EMPTY_H
#define EMPTY_H
namespace ns3 {
/**
* \brief make Callback use a separate empty type
*/
class empty {};
}
#endif /* EMPTY_H */
| zy901002-gpsr | src/core/model/empty.h | C++ | gpl2 | 147 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "calendar-scheduler.h"
#include "event-impl.h"
#include <utility>
#include <string>
#include <list>
#include "assert.h"
#include "log.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("CalendarScheduler");
NS_OBJECT_ENSURE_REGISTERED (CalendarScheduler);
TypeId
CalendarScheduler::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::CalendarScheduler")
.SetParent<Scheduler> ()
.AddConstructor<CalendarScheduler> ()
;
return tid;
}
CalendarScheduler::CalendarScheduler ()
{
NS_LOG_FUNCTION (this);
Init (2, 1, 0);
m_qSize = 0;
}
CalendarScheduler::~CalendarScheduler ()
{
NS_LOG_FUNCTION (this);
delete [] m_buckets;
m_buckets = 0;
}
void
CalendarScheduler::Init (uint32_t nBuckets,
uint64_t width,
uint64_t startPrio)
{
NS_LOG_FUNCTION (this << nBuckets << width << startPrio);
m_buckets = new Bucket [nBuckets];
m_nBuckets = nBuckets;
m_width = width;
m_lastPrio = startPrio;
m_lastBucket = Hash (startPrio);
m_bucketTop = (startPrio / width + 1) * width;
}
void
CalendarScheduler::PrintInfo (void)
{
std::cout << "nBuckets=" << m_nBuckets << ", width=" << m_width << std::endl;
std::cout << "Bucket Distribution ";
for (uint32_t i = 0; i < m_nBuckets; i++)
{
std::cout << m_buckets[i].size () << " ";
}
std::cout << std::endl;
}
uint32_t
CalendarScheduler::Hash (uint64_t ts) const
{
uint32_t bucket = (ts / m_width) % m_nBuckets;
return bucket;
}
void
CalendarScheduler::DoInsert (const Event &ev)
{
NS_LOG_FUNCTION (this << ev.key.m_ts << ev.key.m_uid);
// calculate bucket index.
uint32_t bucket = Hash (ev.key.m_ts);
NS_LOG_LOGIC ("insert in bucket=" << bucket);
// insert in bucket list.
Bucket::iterator end = m_buckets[bucket].end ();
for (Bucket::iterator i = m_buckets[bucket].begin (); i != end; ++i)
{
if (ev.key < i->key)
{
m_buckets[bucket].insert (i, ev);
return;
}
}
m_buckets[bucket].push_back (ev);
}
void
CalendarScheduler::Insert (const Event &ev)
{
DoInsert (ev);
m_qSize++;
ResizeUp ();
}
bool
CalendarScheduler::IsEmpty (void) const
{
return m_qSize == 0;
}
Scheduler::Event
CalendarScheduler::PeekNext (void) const
{
NS_LOG_FUNCTION (this << m_lastBucket << m_bucketTop);
NS_ASSERT (!IsEmpty ());
uint32_t i = m_lastBucket;
uint64_t bucketTop = m_bucketTop;
Scheduler::Event minEvent = { 0, { ~0, ~0}};
do
{
if (!m_buckets[i].empty ())
{
Scheduler::Event next = m_buckets[i].front ();
if (next.key.m_ts < bucketTop)
{
return next;
}
if (next.key < minEvent.key)
{
minEvent = next;
}
}
i++;
i %= m_nBuckets;
bucketTop += m_width;
}
while (i != m_lastBucket);
return minEvent;
}
Scheduler::Event
CalendarScheduler::DoRemoveNext (void)
{
uint32_t i = m_lastBucket;
uint64_t bucketTop = m_bucketTop;
Scheduler::Event minEvent = { 0, { ~0, ~0}};
do
{
if (!m_buckets[i].empty ())
{
Scheduler::Event next = m_buckets[i].front ();
if (next.key.m_ts < bucketTop)
{
m_lastBucket = i;
m_lastPrio = next.key.m_ts;
m_bucketTop = bucketTop;
m_buckets[i].pop_front ();
return next;
}
if (next.key < minEvent.key)
{
minEvent = next;
}
}
i++;
i %= m_nBuckets;
bucketTop += m_width;
}
while (i != m_lastBucket);
m_lastPrio = minEvent.key.m_ts;
m_lastBucket = Hash (minEvent.key.m_ts);
m_bucketTop = (minEvent.key.m_ts / m_width + 1) * m_width;
m_buckets[m_lastBucket].pop_front ();
return minEvent;
}
Scheduler::Event
CalendarScheduler::RemoveNext (void)
{
NS_LOG_FUNCTION (this << m_lastBucket << m_bucketTop);
NS_ASSERT (!IsEmpty ());
Scheduler::Event ev = DoRemoveNext ();
NS_LOG_LOGIC ("remove ts=" << ev.key.m_ts <<
", key=" << ev.key.m_uid <<
", from bucket=" << m_lastBucket);
m_qSize--;
ResizeDown ();
return ev;
}
void
CalendarScheduler::Remove (const Event &ev)
{
NS_ASSERT (!IsEmpty ());
// bucket index of event
uint32_t bucket = Hash (ev.key.m_ts);
Bucket::iterator end = m_buckets[bucket].end ();
for (Bucket::iterator i = m_buckets[bucket].begin (); i != end; ++i)
{
if (i->key.m_uid == ev.key.m_uid)
{
NS_ASSERT (ev.impl == i->impl);
m_buckets[bucket].erase (i);
m_qSize--;
ResizeDown ();
return;
}
}
NS_ASSERT (false);
}
void
CalendarScheduler::ResizeUp (void)
{
if (m_qSize > m_nBuckets * 2
&& m_nBuckets < 32768)
{
Resize (m_nBuckets * 2);
}
}
void
CalendarScheduler::ResizeDown (void)
{
if (m_qSize < m_nBuckets / 2)
{
Resize (m_nBuckets / 2);
}
}
uint32_t
CalendarScheduler::CalculateNewWidth (void)
{
if (m_qSize < 2)
{
return 1;
}
uint32_t nSamples;
if (m_qSize <= 5)
{
nSamples = m_qSize;
}
else
{
nSamples = 5 + m_qSize / 10;
}
if (nSamples > 25)
{
nSamples = 25;
}
// we gather the first nSamples from the queue
std::list<Scheduler::Event> samples;
// save state
uint32_t lastBucket = m_lastBucket;
uint64_t bucketTop = m_bucketTop;
uint64_t lastPrio = m_lastPrio;
// gather requested events
for (uint32_t i = 0; i < nSamples; i++)
{
samples.push_back (DoRemoveNext ());
}
// put them back
for (std::list<Scheduler::Event>::const_iterator i = samples.begin ();
i != samples.end (); ++i)
{
DoInsert (*i);
}
// restore state.
m_lastBucket = lastBucket;
m_bucketTop = bucketTop;
m_lastPrio = lastPrio;
// finally calculate inter-time average over samples.
uint64_t totalSeparation = 0;
std::list<Scheduler::Event>::const_iterator end = samples.end ();
std::list<Scheduler::Event>::const_iterator cur = samples.begin ();
std::list<Scheduler::Event>::const_iterator next = cur;
next++;
while (next != end)
{
totalSeparation += next->key.m_ts - cur->key.m_ts;
cur++;
next++;
}
uint64_t twiceAvg = totalSeparation / (nSamples - 1) * 2;
totalSeparation = 0;
cur = samples.begin ();
next = cur;
next++;
while (next != end)
{
uint64_t diff = next->key.m_ts - cur->key.m_ts;
if (diff <= twiceAvg)
{
totalSeparation += diff;
}
cur++;
next++;
}
totalSeparation *= 3;
totalSeparation = std::max (totalSeparation, (uint64_t)1);
return totalSeparation;
}
void
CalendarScheduler::DoResize (uint32_t newSize, uint32_t newWidth)
{
Bucket *oldBuckets = m_buckets;
uint32_t oldNBuckets = m_nBuckets;
Init (newSize, newWidth, m_lastPrio);
for (uint32_t i = 0; i < oldNBuckets; i++)
{
Bucket::iterator end = oldBuckets[i].end ();
for (Bucket::iterator j = oldBuckets[i].begin (); j != end; ++j)
{
DoInsert (*j);
}
}
delete [] oldBuckets;
}
void
CalendarScheduler::Resize (uint32_t newSize)
{
NS_LOG_FUNCTION (this << newSize);
// PrintInfo ();
uint32_t newWidth = CalculateNewWidth ();
DoResize (newSize, newWidth);
}
} // namespace ns3
| zy901002-gpsr | src/core/model/calendar-scheduler.cc | C++ | gpl2 | 8,169 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/core-config.h"
#include "simulator.h"
#include "simulator-impl.h"
#include "scheduler.h"
#include "map-scheduler.h"
#include "event-impl.h"
#include "ptr.h"
#include "string.h"
#include "object-factory.h"
#include "global-value.h"
#include "assert.h"
#include "log.h"
#include <math.h>
#include <fstream>
#include <list>
#include <vector>
#include <iostream>
NS_LOG_COMPONENT_DEFINE ("Simulator");
namespace ns3 {
GlobalValue g_simTypeImpl = GlobalValue ("SimulatorImplementationType",
"The object class to use as the simulator implementation",
StringValue ("ns3::DefaultSimulatorImpl"),
MakeStringChecker ());
GlobalValue g_schedTypeImpl = GlobalValue ("SchedulerType",
"The object class to use as the scheduler implementation",
TypeIdValue (MapScheduler::GetTypeId ()),
MakeTypeIdChecker ());
static void
TimePrinter (std::ostream &os)
{
os << Simulator::Now ().GetSeconds () << "s";
}
static void
NodePrinter (std::ostream &os)
{
if (Simulator::GetContext () == 0xffffffff)
{
os << "-1";
}
else
{
os << Simulator::GetContext ();
}
}
static SimulatorImpl **PeekImpl (void)
{
static SimulatorImpl *impl = 0;
return &impl;
}
static SimulatorImpl * GetImpl (void)
{
SimulatorImpl **pimpl = PeekImpl ();
/* Please, don't include any calls to logging macros in this function
* or pay the price, that is, stack explosions.
*/
if (*pimpl == 0)
{
{
ObjectFactory factory;
StringValue s;
g_simTypeImpl.GetValue (s);
factory.SetTypeId (s.Get ());
*pimpl = GetPointer (factory.Create<SimulatorImpl> ());
}
{
ObjectFactory factory;
StringValue s;
g_schedTypeImpl.GetValue (s);
factory.SetTypeId (s.Get ());
(*pimpl)->SetScheduler (factory);
}
//
// Note: we call LogSetTimePrinter _after_ creating the implementation
// object because the act of creation can trigger calls to the logging
// framework which would call the TimePrinter function which would call
// Simulator::Now which would call Simulator::GetImpl, and, thus, get us
// in an infinite recursion until the stack explodes.
//
LogSetTimePrinter (&TimePrinter);
LogSetNodePrinter (&NodePrinter);
}
return *pimpl;
}
void
Simulator::Destroy (void)
{
NS_LOG_FUNCTION_NOARGS ();
SimulatorImpl **pimpl = PeekImpl ();
if (*pimpl == 0)
{
return;
}
/* Note: we have to call LogSetTimePrinter (0) below because if we do not do
* this, and restart a simulation after this call to Destroy, (which is
* legal), Simulator::GetImpl will trigger again an infinite recursion until
* the stack explodes.
*/
LogSetTimePrinter (0);
LogSetNodePrinter (0);
(*pimpl)->Destroy ();
(*pimpl)->Unref ();
*pimpl = 0;
}
void
Simulator::SetScheduler (ObjectFactory schedulerFactory)
{
NS_LOG_FUNCTION (schedulerFactory);
GetImpl ()->SetScheduler (schedulerFactory);
}
bool
Simulator::IsFinished (void)
{
NS_LOG_FUNCTION_NOARGS ();
return GetImpl ()->IsFinished ();
}
Time
Simulator::Next (void)
{
NS_LOG_FUNCTION_NOARGS ();
return GetImpl ()->Next ();
}
void
Simulator::Run (void)
{
NS_LOG_FUNCTION_NOARGS ();
GetImpl ()->Run ();
}
void
Simulator::RunOneEvent (void)
{
NS_LOG_FUNCTION_NOARGS ();
GetImpl ()->RunOneEvent ();
}
void
Simulator::Stop (void)
{
NS_LOG_LOGIC ("stop");
GetImpl ()->Stop ();
}
void
Simulator::Stop (Time const &time)
{
NS_LOG_FUNCTION (time);
GetImpl ()->Stop (time);
}
Time
Simulator::Now (void)
{
/* Please, don't include any calls to logging macros in this function
* or pay the price, that is, stack explosions.
*/
return GetImpl ()->Now ();
}
Time
Simulator::GetDelayLeft (const EventId &id)
{
NS_LOG_FUNCTION (&id);
return GetImpl ()->GetDelayLeft (id);
}
EventId
Simulator::Schedule (Time const &time, const Ptr<EventImpl> &ev)
{
NS_LOG_FUNCTION (time << ev);
return DoSchedule (time, GetPointer (ev));
}
EventId
Simulator::ScheduleNow (const Ptr<EventImpl> &ev)
{
NS_LOG_FUNCTION (ev);
return DoScheduleNow (GetPointer (ev));
}
void
Simulator::ScheduleWithContext (uint32_t context, const Time &time, EventImpl *impl)
{
return GetImpl ()->ScheduleWithContext (context, time, impl);
}
EventId
Simulator::ScheduleDestroy (const Ptr<EventImpl> &ev)
{
NS_LOG_FUNCTION (ev);
return DoScheduleDestroy (GetPointer (ev));
}
EventId
Simulator::DoSchedule (Time const &time, EventImpl *impl)
{
return GetImpl ()->Schedule (time, impl);
}
EventId
Simulator::DoScheduleNow (EventImpl *impl)
{
return GetImpl ()->ScheduleNow (impl);
}
EventId
Simulator::DoScheduleDestroy (EventImpl *impl)
{
return GetImpl ()->ScheduleDestroy (impl);
}
EventId
Simulator::Schedule (Time const &time, void (*f)(void))
{
NS_LOG_FUNCTION (time << f);
return DoSchedule (time, MakeEvent (f));
}
void
Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(void))
{
NS_LOG_FUNCTION (time << context << f);
return ScheduleWithContext (context, time, MakeEvent (f));
}
EventId
Simulator::ScheduleNow (void (*f)(void))
{
NS_LOG_FUNCTION (f);
return DoScheduleNow (MakeEvent (f));
}
EventId
Simulator::ScheduleDestroy (void (*f)(void))
{
NS_LOG_FUNCTION (f);
return DoScheduleDestroy (MakeEvent (f));
}
void
Simulator::Remove (const EventId &ev)
{
NS_LOG_FUNCTION (&ev);
if (*PeekImpl () == 0)
{
return;
}
return GetImpl ()->Remove (ev);
}
void
Simulator::Cancel (const EventId &ev)
{
NS_LOG_FUNCTION (&ev);
if (*PeekImpl () == 0)
{
return;
}
return GetImpl ()->Cancel (ev);
}
bool
Simulator::IsExpired (const EventId &id)
{
NS_LOG_FUNCTION (&id);
if (*PeekImpl () == 0)
{
return true;
}
return GetImpl ()->IsExpired (id);
}
Time Now (void)
{
NS_LOG_FUNCTION_NOARGS ();
return Time (Simulator::Now ());
}
Time
Simulator::GetMaximumSimulationTime (void)
{
NS_LOG_FUNCTION_NOARGS ();
return GetImpl ()->GetMaximumSimulationTime ();
}
uint32_t
Simulator::GetContext (void)
{
return GetImpl ()->GetContext ();
}
uint32_t
Simulator::GetSystemId (void)
{
NS_LOG_FUNCTION_NOARGS ();
if (*PeekImpl () != 0)
{
return GetImpl ()->GetSystemId ();
}
else
{
return 0;
}
}
void
Simulator::SetImplementation (Ptr<SimulatorImpl> impl)
{
if (*PeekImpl () != 0)
{
NS_FATAL_ERROR ("It is not possible to set the implementation after calling any Simulator:: function. Call Simulator::SetImplementation earlier or after Simulator::Destroy.");
}
*PeekImpl () = GetPointer (impl);
// Set the default scheduler
ObjectFactory factory;
StringValue s;
g_schedTypeImpl.GetValue (s);
factory.SetTypeId (s.Get ());
impl->SetScheduler (factory);
//
// Note: we call LogSetTimePrinter _after_ creating the implementation
// object because the act of creation can trigger calls to the logging
// framework which would call the TimePrinter function which would call
// Simulator::Now which would call Simulator::GetImpl, and, thus, get us
// in an infinite recursion until the stack explodes.
//
LogSetTimePrinter (&TimePrinter);
LogSetNodePrinter (&NodePrinter);
}
Ptr<SimulatorImpl>
Simulator::GetImplementation (void)
{
return GetImpl ();
}
} // namespace ns3
| zy901002-gpsr | src/core/model/simulator.cc | C++ | gpl2 | 8,355 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA, Gustavo Carneiro
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Gustavo Carneiro <gjcarneiro@gmail.com>,
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef OBJECT_H
#define OBJECT_H
#include <stdint.h>
#include <string>
#include <vector>
#include "ptr.h"
#include "attribute.h"
#include "object-base.h"
#include "attribute-construction-list.h"
#include "simple-ref-count.h"
namespace ns3 {
class Object;
class AttributeAccessor;
class AttributeValue;
class TraceSourceAccessor;
struct ObjectDeleter
{
inline static void Delete (Object *object);
};
/**
* \ingroup core
* \defgroup object Object
*/
/**
* \ingroup object
* \brief a base class which provides memory management and object aggregation
*
* The memory management scheme is based on reference-counting with dispose-like
* functionality to break the reference cycles. The reference count is increamented
* and decremented with the methods Object::Ref and Object::Unref. If a reference cycle is
* present, the user is responsible for breaking it by calling Object::Dispose in
* a single location. This will eventually trigger the invocation of Object::DoDispose
* on itself and all its aggregates. The Object::DoDispose method is always automatically
* invoked from the Object::Unref method before destroying the object, even if the user
* did not call Object::Dispose directly.
*/
class Object : public SimpleRefCount<Object,ObjectBase,ObjectDeleter>
{
public:
static TypeId GetTypeId (void);
/**
* \brief Iterate over the objects aggregated to an ns3::Object.
*
* This iterator does not allow you to iterate over the initial
* object used to call Object::GetAggregateIterator.
*
* Note: this is a java-style iterator.
*/
class AggregateIterator
{
public:
AggregateIterator ();
/**
* \returns true if HasNext can be called and return a non-null
* pointer, false otherwise.
*/
bool HasNext (void) const;
/**
* \returns the next aggregated object.
*/
Ptr<const Object> Next (void);
private:
friend class Object;
AggregateIterator (Ptr<const Object> object);
Ptr<const Object> m_object;
uint32_t m_current;
};
Object ();
virtual ~Object ();
/*
* Implement the GetInstanceTypeId method defined in ObjectBase.
*/
virtual TypeId GetInstanceTypeId (void) const;
/**
* \returns a pointer to the requested interface or zero if it could not be found.
*/
template <typename T>
inline Ptr<T> GetObject (void) const;
/**
* \param tid the interface id of the requested interface
* \returns a pointer to the requested interface or zero if it could not be found.
*/
template <typename T>
Ptr<T> GetObject (TypeId tid) const;
/**
* Run the DoDispose methods of this object and all the
* objects aggregated to it.
* After calling this method, the object is expected to be
* totally unusable except for the Ref and Unref methods.
*
* Note that you can call Dispose many times on the same object or
* different objects aggregated together, and DoDispose will be
* called only once for each aggregated object.
*
* This method is typically used to break reference cycles.
*/
void Dispose (void);
/**
* \param other another object pointer
*
* This method aggregates the two objects together: after this
* method returns, it becomes possible to call GetObject
* on one to get the other, and vice-versa.
*
* This method calls the virtual method NotifyNewAggregates to
* notify all aggregated objects that they have been aggregated
* together.
*
* \sa NotifyNewAggregate
*/
void AggregateObject (Ptr<Object> other);
/**
* \returns an iterator to the first object aggregated to this
* object.
*
* If no objects are aggregated to this object, then, the returned
* iterator will be empty and AggregateIterator::HasNext will
* always return false.
*/
AggregateIterator GetAggregateIterator (void) const;
/**
* This method calls the virtual DoStart method on all the objects
* aggregated to this object. DoStart will be called only once over
* the lifetime of an object, just like DoDispose is called only
* once.
*
* \sa DoStart
*/
void Start (void);
protected:
/**
* This method is invoked whenever two sets of objects are aggregated together.
* It is invoked exactly once for each object in both sets.
* This method can be overriden by subclasses who wish to be notified of aggregation
* events. These subclasses must chain up to their base class NotifyNewAggregate method.
* It is safe to call GetObject and AggregateObject from within this method.
*/
virtual void NotifyNewAggregate (void);
/**
* This method is called only once by Object::Start. If the user
* calls Object::Start multiple times, DoStart is called only the
* first time.
*
* Subclasses are expected to override this method and _chain up_
* to their parent's implementation once they are done. It is
* safe to call GetObject and AggregateObject from within this method.
*/
virtual void DoStart (void);
/**
* This method is called by Object::Dispose or by the object's
* destructor, whichever comes first.
*
* Subclasses are expected to implement their real destruction
* code in an overriden version of this method and chain
* up to their parent's implementation once they are done.
* i.e., for simplicity, the destructor of every subclass should
* be empty and its content should be moved to the associated
* DoDispose method.
*
* It is safe to call GetObject from within this method.
*/
virtual void DoDispose (void);
/**
* \param o the object to copy.
*
* Allow subclasses to implement a copy constructor.
* While it is technically possible to implement a copy
* constructor in a subclass, we strongly discourage you
* to do so. If you really want to do it anyway, you have
* to understand that this copy constructor will _not_
* copy aggregated objects. i.e., if your object instance
* is already aggregated to another object and if you invoke
* this copy constructor, the new object instance will be
* a pristine standalone object instance not aggregated to
* any other object. It is thus _your_ responsability
* as a caller of this method to do what needs to be done
* (if it is needed) to ensure that the object stays in a
* valid state.
*/
Object (const Object &o);
private:
template <typename T>
friend Ptr<T> CopyObject (Ptr<T> object);
template <typename T>
friend Ptr<T> CopyObject (Ptr<const T> object);
template <typename T>
friend Ptr<T> CompleteConstruct (T *object);
friend class ObjectFactory;
friend class AggregateIterator;
friend struct ObjectDeleter;
/**
* This data structure uses a classic C-style trick to
* hold an array of variable size without performing
* two memory allocations: the declaration of the structure
* declares a one-element array but when we allocate
* memory for this struct, we effectively allocate a larger
* chunk of memory than the struct to allow space for a larger
* variable sized buffer whose size is indicated by the element
* 'n'
*/
struct Aggregates {
uint32_t n;
Object *buffer[1];
};
Ptr<Object> DoGetObject (TypeId tid) const;
bool Check (void) const;
bool CheckLoose (void) const;
/**
* \param tid an TypeId
*
* Invoked from ns3::CreateObject only.
* Initialize the m_tid member variable to
* keep track of the type of this object instance.
*/
void SetTypeId (TypeId tid);
/**
* \param attributes the attribute values used to initialize
* the member variables of this object's instance.
*
* Invoked from ns3::ObjectFactory::Create and ns3::CreateObject only.
* Initialize all the member variables which were
* registered with the associated TypeId.
*/
void Construct (const AttributeConstructionList &attributes);
void UpdateSortedArray (struct Aggregates *aggregates, uint32_t i) const;
/**
* Attempt to delete this object. This method iterates
* over all aggregated objects to check if they all
* have a zero refcount. If yes, the object and all
* its aggregates are deleted. If not, nothing is done.
*/
void DoDelete (void);
/**
* Identifies the type of this object instance.
*/
TypeId m_tid;
/**
* Set to true when the DoDispose method of the object
* has run, false otherwise.
*/
bool m_disposed;
/**
* Set to true once the DoStart method has run,
* false otherwise
*/
bool m_started;
/**
* a pointer to an array of 'aggregates'. i.e., a pointer to
* each object aggregated to this object is stored in this
* array. The array is shared by all aggregated objects
* so the size of the array is indirectly a reference count.
*/
struct Aggregates * m_aggregates;
/**
* Indicates the number of times the object was accessed with a
* call to GetObject. This integer is used to implement a
* heuristic to sort the array of aggregates to put at the start
* of the array the most-frequently accessed elements.
*/
uint32_t m_getObjectCount;
};
/**
* \param object a pointer to the object to copy.
* \returns a copy of the input object.
*
* This method invoke the copy constructor of the input object
* and returns the new instance.
*/
template <typename T>
Ptr<T> CopyObject (Ptr<const T> object);
template <typename T>
Ptr<T> CopyObject (Ptr<T> object);
} // namespace ns3
namespace ns3 {
void
ObjectDeleter::Delete (Object *object)
{
object->DoDelete ();
}
/*************************************************************************
* The Object implementation which depends on templates
*************************************************************************/
template <typename T>
Ptr<T>
Object::GetObject () const
{
// This is an optimization: if the cast works (which is likely),
// things will be pretty fast.
T *result = dynamic_cast<T *> (m_aggregates->buffer[0]);
if (result != 0)
{
return Ptr<T> (result);
}
// if the cast does not work, we try to do a full type check.
Ptr<Object> found = DoGetObject (T::GetTypeId ());
if (found != 0)
{
return Ptr<T> (static_cast<T *> (PeekPointer (found)));
}
return 0;
}
template <typename T>
Ptr<T>
Object::GetObject (TypeId tid) const
{
Ptr<Object> found = DoGetObject (tid);
if (found != 0)
{
return Ptr<T> (static_cast<T *> (PeekPointer (found)));
}
return 0;
}
/*************************************************************************
* The helper functions which need templates.
*************************************************************************/
template <typename T>
Ptr<T> CopyObject (Ptr<T> object)
{
Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
NS_ASSERT (p->GetInstanceTypeId () == object->GetInstanceTypeId ());
return p;
}
template <typename T>
Ptr<T> CopyObject (Ptr<const T> object)
{
Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
NS_ASSERT (p->GetInstanceTypeId () == object->GetInstanceTypeId ());
return p;
}
template <typename T>
Ptr<T> CompleteConstruct (T *p)
{
p->SetTypeId (T::GetTypeId ());
p->Object::Construct (AttributeConstructionList ());
return Ptr<T> (p, false);
}
template <typename T>
Ptr<T> CreateObject (void)
{
return CompleteConstruct (new T ());
}
template <typename T, typename T1>
Ptr<T> CreateObject (T1 a1)
{
return CompleteConstruct (new T (a1));
}
template <typename T, typename T1, typename T2>
Ptr<T> CreateObject (T1 a1, T2 a2)
{
return CompleteConstruct (new T (a1,a2));
}
template <typename T, typename T1, typename T2, typename T3>
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3)
{
return CompleteConstruct (new T (a1,a2,a3));
}
template <typename T, typename T1, typename T2, typename T3, typename T4>
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
{
return CompleteConstruct (new T (a1,a2,a3,a4));
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
{
return CompleteConstruct (new T (a1,a2,a3,a4,a5));
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
{
return CompleteConstruct (new T (a1,a2,a3,a4,a5,a6));
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
{
return CompleteConstruct (new T (a1,a2,a3,a4,a5,a6,a7));
}
} // namespace ns3
#endif /* OBJECT_H */
| zy901002-gpsr | src/core/model/object.h | C++ | gpl2 | 13,539 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 1997 David Wetherall
* Copyright (c) 2005 David Wei
* Copyright (c) 2009 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors:
* David Wetherall <djw@juniper.lcs.mit.edu>: originally, in ns-2, back in 1997
* David X. Wei: optimizations in ns-2.28
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>: port to ns-3
*/
#ifndef NS2_CALENDAR_SCHEDULER_H
#define NS2_CALENDAR_SCHEDULER_H
#include "scheduler.h"
#include <stdint.h>
#include <list>
namespace ns3 {
class EventImpl;
/**
* \ingroup scheduler
* \brief a calendar queue event scheduler
*
* This event scheduler is a copy/paste of the ns2.29 calendar scheduler.
*/
class Ns2CalendarScheduler : public Scheduler
{
public:
static TypeId GetTypeId (void);
Ns2CalendarScheduler ();
virtual ~Ns2CalendarScheduler ();
virtual void Insert (const Event &ev);
virtual bool IsEmpty (void) const;
virtual Event PeekNext (void) const;
virtual Event RemoveNext (void);
virtual void Remove (const Event &ev);
private:
struct BucketItem
{
ns3::Scheduler::Event event;
struct BucketItem *next_;
struct BucketItem *prev_;
};
struct Bucket
{
struct BucketItem *list_;
int count_;
};
void reinit (int nbuck, uint64_t bwidth, Scheduler::EventKey start);
void resize (int newsize, Scheduler::EventKey start);
uint64_t newwidth (int newsize);
void insert2 (Ns2CalendarScheduler::BucketItem *e);
Ns2CalendarScheduler::BucketItem * head (void);
uint64_t min_bin_width_; // minimum bin width for Calendar Queue
unsigned int adjust_new_width_interval_; // The interval (in unit of resize time) for adjustment of bin width. A zero value disables automatic bin width adjustment
unsigned time_to_newwidth_; // how many time we failed to adjust the width based on snoopy-queue
long unsigned head_search_;
long unsigned insert_search_;
int round_num_;
long int gap_num_; // the number of gap samples in this window (in process of calculation)
uint64_t last_time_; // the departure time of first event in this window
int64_t avg_gap_; // the average gap in last window (finished calculation)
uint64_t width_;
uint64_t diff0_, diff1_, diff2_; /* wrap-around checks */
int stat_qsize_; /* # of distinct priorities in queue*/
int nbuckets_;
int lastbucket_;
int top_threshold_;
int bot_threshold_;
int qsize_;
struct Bucket *buckets_;
Scheduler::EventKey cal_clock_;
};
} // namespace ns3
#endif /* NS2_CALENDAR_SCHEDULER_H */
| zy901002-gpsr | src/core/model/ns2-calendar-scheduler.h | C++ | gpl2 | 3,233 |
#ifndef TYPE_TRAITS_H
#define TYPE_TRAITS_H
template <typename T>
struct TypeTraits
{
private:
struct NullType {};
template <typename U> struct UnConst
{
typedef U Result;
};
template <typename U> struct UnConst<const U>
{
typedef U Result;
};
template <typename U> struct ReferenceTraits
{
enum { IsReference = 0};
typedef U ReferencedType;
};
template <typename U> struct ReferenceTraits<U&>
{
enum { IsReference = 1};
typedef U ReferencedType;
};
template <typename U> struct PointerTraits
{
enum { IsPointer = 0};
typedef U PointeeType;
};
template <typename U> struct PointerTraits<U *>
{
enum { IsPointer = 1};
typedef U PointeeType;
};
template <typename U> struct FunctionPtrTraits
{
enum { IsFunctionPointer = 0};
};
template <typename U>
struct FunctionPtrTraits <U (*)(void)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 0};
typedef U ReturnType;
};
template <typename U, typename V1>
struct FunctionPtrTraits <U (*)(V1)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 1};
typedef U ReturnType;
typedef V1 Arg1Type;
};
template <typename U, typename V1, typename V2>
struct FunctionPtrTraits <U (*)(V1,V2)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 2};
typedef U ReturnType;
typedef V1 Arg1Type;
typedef V2 Arg2Type;
};
template <typename U, typename V1, typename V2,
typename V3>
struct FunctionPtrTraits <U (*)(V1,V2,V3)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 3};
typedef U ReturnType;
typedef V1 Arg1Type;
typedef V2 Arg2Type;
typedef V3 Arg3Type;
};
template <typename U, typename V1, typename V2,
typename V3, typename V4>
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 4};
typedef U ReturnType;
typedef V1 Arg1Type;
typedef V2 Arg2Type;
typedef V3 Arg3Type;
typedef V4 Arg4Type;
};
template <typename U, typename V1, typename V2,
typename V3, typename V4,
typename V5>
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4,V5)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 5};
typedef U ReturnType;
typedef V1 Arg1Type;
typedef V2 Arg2Type;
typedef V3 Arg3Type;
typedef V4 Arg4Type;
typedef V5 Arg5Type;
};
template <typename U, typename V1, typename V2,
typename V3, typename V4,
typename V5, typename V6>
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4,V5,V6)>
{
enum { IsFunctionPointer = 1};
enum { nArgs = 6};
typedef U ReturnType;
typedef V1 Arg1Type;
typedef V2 Arg2Type;
typedef V3 Arg3Type;
typedef V4 Arg4Type;
typedef V5 Arg5Type;
typedef V6 Arg6Type;
};
template <typename U> struct PtrToMemberTraits
{
enum { IsPointerToMember = 0};
};
template <typename U, typename V>
struct PtrToMemberTraits <U (V::*) (void)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 0};
typedef U ReturnType;
};
template <typename U, typename V>
struct PtrToMemberTraits <U (V::*) (void) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 0};
typedef U ReturnType;
};
template <typename U, typename V,typename W1>
struct PtrToMemberTraits <U (V::*) (W1)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 1};
typedef U ReturnType;
typedef W1 Arg1Type;
};
template <typename U, typename V,typename W1>
struct PtrToMemberTraits <U (V::*) (W1) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 1};
typedef U ReturnType;
typedef W1 Arg1Type;
};
template <typename U, typename V,typename W1, typename W2>
struct PtrToMemberTraits <U (V::*) (W1,W2)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 2};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
};
template <typename U, typename V,typename W1, typename W2>
struct PtrToMemberTraits <U (V::*) (W1,W2) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 2};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 3};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 3};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3, typename W4>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 4};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
typedef W4 Arg4Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3, typename W4>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 4};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
typedef W4 Arg4Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3, typename W4,
typename W5>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 5};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
typedef W4 Arg4Type;
typedef W5 Arg5Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3, typename W4,
typename W5>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 5};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
typedef W4 Arg4Type;
typedef W5 Arg5Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3, typename W4,
typename W5, typename W6>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5,W6)>
{
enum { IsPointerToMember = 1};
enum { nArgs = 6};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
typedef W4 Arg4Type;
typedef W5 Arg5Type;
typedef W6 Arg6Type;
};
template <typename U, typename V,
typename W1, typename W2,
typename W3, typename W4,
typename W5, typename W6>
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5,W6) const>
{
enum { IsPointerToMember = 1};
enum { nArgs = 6};
typedef U ReturnType;
typedef W1 Arg1Type;
typedef W2 Arg2Type;
typedef W3 Arg3Type;
typedef W4 Arg4Type;
typedef W5 Arg5Type;
typedef W6 Arg6Type;
};
public:
typedef typename UnConst<T>::Result NonConstType;
typedef typename ReferenceTraits<T>::ReferencedType ReferencedType;
typedef typename PointerTraits<T>::PointeeType PointeeType;
enum { IsPointerToMember = PtrToMemberTraits<T>::IsPointerToMember};
enum { IsPointer = PointerTraits<T>::IsPointer};
enum { IsReference = ReferenceTraits<T>::IsReference};
enum { IsFunctionPointer = FunctionPtrTraits<T>::IsFunctionPointer};
typedef PtrToMemberTraits<T> PointerToMemberTraits;
typedef FunctionPtrTraits<T> FunctionPointerTraits;
};
#endif /* TYPE_TRAITS_H */
| zy901002-gpsr | src/core/model/type-traits.h | C++ | gpl2 | 7,897 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 NICTA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Quincy Tse <quincy.tse@nicta.com.au>
*/
#ifndef FATAL_IMPL_H
#define FATAL_IMPL_H
#include <ostream>
/**
* \ingroup debugging
* \defgroup fatalHandler Fatal Error Handler
*
* \brief Functions to help clean up when fatal error
* is encountered.
*
* The functions in this group are used to perform
* limited clean up, like flushing active streams, when
* fatal error are encountered (through assertion fail,
* calls to NS_ABORT_* and calls to NS_FATAL_ERROR.
*
* Currently, other than flushing active ostreams, these
* functions does not interfere with outside memory. There
* is still a residual risk that may be invalid ostream
* pointers may be present, and may corrupt the memory
* on the attempt to execute the flush() function.
*/
namespace ns3 {
namespace FatalImpl {
/**
* \ingroup fatalHandler
* \param stream The stream to be flushed on abnormal exit.
*
* \brief Register a stream to be flushed on abnormal exit.
*
* If a std::terminate() call is encountered after the
* stream had been registered and before it had been
* unregistered, stream->flush() will be called. Users of
* this function is to ensure stream remains valid until
* it had been unregistered.
*/
void RegisterStream (std::ostream* stream);
/**
* \ingroup fatalHandler
* \param stream The stream to be unregistered.
*
* \brief Unregister a stream for flushing on abnormal exit.
*
* After a stream had been unregistered, stream->flush()
* will no longer be called should abnormal termination is
* encountered.
*
* If stream is not registered, nothing will happen.
*/
void UnregisterStream (std::ostream* stream);
/**
* \ingroup fatalHandler
*
* \brief Flush all currently registered streams.
*
* This function iterates through each registered stream and
* unregister them. The default SIGSEGV handler is overridden
* when this function is being executed, and will be restored
* when this function returns.
*
* If a SIGSEGV is encountered (most likely due to bad ostream*
* being registered, or a registered osteam* pointing to an
* ostream that had already been destroyed), this function will
* skip the bad ostream* and continue to flush the next stram.
* The function will then terminate raising SIGIOT (aka SIGABRT)
*
* DO NOT call this function until the program is ready to crash.
*/
void FlushStreams (void);
} //FatalImpl
} //ns3
#endif
| zy901002-gpsr | src/core/model/fatal-impl.h | C++ | gpl2 | 3,148 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "object-base.h"
#include "log.h"
#include "trace-source-accessor.h"
#include "attribute-construction-list.h"
#include "string.h"
#include "ns3/core-config.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
NS_LOG_COMPONENT_DEFINE ("ObjectBase");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (ObjectBase);
static TypeId
GetObjectIid (void)
{
TypeId tid = TypeId ("ns3::ObjectBase");
tid.SetParent (tid);
return tid;
}
TypeId
ObjectBase::GetTypeId (void)
{
static TypeId tid = GetObjectIid ();
return tid;
}
ObjectBase::~ObjectBase ()
{
}
void
ObjectBase::NotifyConstructionCompleted (void)
{}
void
ObjectBase::ConstructSelf (const AttributeConstructionList &attributes)
{
// loop over the inheritance tree back to the Object base class.
TypeId tid = GetInstanceTypeId ();
do {
// loop over all attributes in object type
NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetAttributeN ());
for (uint32_t i = 0; i < tid.GetAttributeN (); i++)
{
struct TypeId::AttributeInformation info = tid.GetAttribute(i);
NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<<
info.name <<"\"");
if (!(info.flags & TypeId::ATTR_CONSTRUCT))
{
continue;
}
bool found = false;
// is this attribute stored in this AttributeConstructionList instance ?
Ptr<AttributeValue> value = attributes.Find(info.checker);
if (value != 0)
{
// We have a matching attribute value.
if (DoSet (info.accessor, info.checker, *value))
{
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
info.name<<"\"");
found = true;
continue;
}
}
if (!found)
{
// No matching attribute value so we try to look at the env var.
#ifdef HAVE_GETENV
char *envVar = getenv ("NS_ATTRIBUTE_DEFAULT");
if (envVar != 0)
{
std::string env = std::string (envVar);
std::string::size_type cur = 0;
std::string::size_type next = 0;
while (next != std::string::npos)
{
next = env.find (";", cur);
std::string tmp = std::string (env, cur, next-cur);
std::string::size_type equal = tmp.find ("=");
if (equal != std::string::npos)
{
std::string name = tmp.substr (0, equal);
std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
if (name == tid.GetAttributeFullName (i))
{
if (DoSet (info.accessor, info.checker, StringValue (value)))
{
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
info.name <<"\" from env var");
found = true;
break;
}
}
}
cur = next + 1;
}
}
#endif /* HAVE_GETENV */
}
if (!found)
{
// No matching attribute value so we try to set the default value.
DoSet (info.accessor, info.checker, *info.initialValue);
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
info.name <<"\" from initial value.");
}
}
tid = tid.GetParent ();
} while (tid != ObjectBase::GetTypeId ());
NotifyConstructionCompleted ();
}
bool
ObjectBase::DoSet (Ptr<const AttributeAccessor> accessor,
Ptr<const AttributeChecker> checker,
const AttributeValue &value)
{
Ptr<AttributeValue> v = checker->CreateValidValue (value);
if (v == 0)
{
return false;
}
bool ok = accessor->Set (this, *v);
return ok;
}
void
ObjectBase::SetAttribute (std::string name, const AttributeValue &value)
{
struct TypeId::AttributeInformation info;
TypeId tid = GetInstanceTypeId ();
if (!tid.LookupAttributeByName (name, &info))
{
NS_FATAL_ERROR ("Attribute name="<<name<<" does not exist for this object: tid="<<tid.GetName ());
}
if (!(info.flags & TypeId::ATTR_SET) ||
!info.accessor->HasSetter ())
{
NS_FATAL_ERROR ("Attribute name="<<name<<" is not settable for this object: tid="<<tid.GetName ());
}
if (!DoSet (info.accessor, info.checker, value))
{
NS_FATAL_ERROR ("Attribute name="<<name<<" could not be set for this object: tid="<<tid.GetName ());
}
}
bool
ObjectBase::SetAttributeFailSafe (std::string name, const AttributeValue &value)
{
struct TypeId::AttributeInformation info;
TypeId tid = GetInstanceTypeId ();
if (!tid.LookupAttributeByName (name, &info))
{
return false;
}
if (!(info.flags & TypeId::ATTR_SET) ||
!info.accessor->HasSetter ())
{
return false;
}
return DoSet (info.accessor, info.checker, value);
}
void
ObjectBase::GetAttribute (std::string name, AttributeValue &value) const
{
struct TypeId::AttributeInformation info;
TypeId tid = GetInstanceTypeId ();
if (!tid.LookupAttributeByName (name, &info))
{
NS_FATAL_ERROR ("Attribute name="<<name<<" does not exist for this object: tid="<<tid.GetName ());
}
if (!(info.flags & TypeId::ATTR_GET) ||
!info.accessor->HasGetter ())
{
NS_FATAL_ERROR ("Attribute name="<<name<<" is not gettable for this object: tid="<<tid.GetName ());
}
bool ok = info.accessor->Get (this, value);
if (ok)
{
return;
}
StringValue *str = dynamic_cast<StringValue *> (&value);
if (str == 0)
{
NS_FATAL_ERROR ("Attribute name="<<name<<" tid="<<tid.GetName () << ": input value is not a string");
}
Ptr<AttributeValue> v = info.checker->Create ();
ok = info.accessor->Get (this, *PeekPointer (v));
if (!ok)
{
NS_FATAL_ERROR ("Attribute name="<<name<<" tid="<<tid.GetName () << ": could not get value");
}
str->Set (v->SerializeToString (info.checker));
}
bool
ObjectBase::GetAttributeFailSafe (std::string name, AttributeValue &value) const
{
struct TypeId::AttributeInformation info;
TypeId tid = GetInstanceTypeId ();
if (!tid.LookupAttributeByName (name, &info))
{
return false;
}
if (!(info.flags & TypeId::ATTR_GET) ||
!info.accessor->HasGetter ())
{
return false;
}
bool ok = info.accessor->Get (this, value);
if (ok)
{
return true;
}
StringValue *str = dynamic_cast<StringValue *> (&value);
if (str == 0)
{
return false;
}
Ptr<AttributeValue> v = info.checker->Create ();
ok = info.accessor->Get (this, *PeekPointer (v));
if (!ok)
{
return false;
}
str->Set (v->SerializeToString (info.checker));
return true;
}
bool
ObjectBase::TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
{
TypeId tid = GetInstanceTypeId ();
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
if (accessor == 0)
{
return false;
}
bool ok = accessor->ConnectWithoutContext (this, cb);
return ok;
}
bool
ObjectBase::TraceConnect (std::string name, std::string context, const CallbackBase &cb)
{
TypeId tid = GetInstanceTypeId ();
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
if (accessor == 0)
{
return false;
}
bool ok = accessor->Connect (this, context, cb);
return ok;
}
bool
ObjectBase::TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
{
TypeId tid = GetInstanceTypeId ();
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
if (accessor == 0)
{
return false;
}
bool ok = accessor->DisconnectWithoutContext (this, cb);
return ok;
}
bool
ObjectBase::TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
{
TypeId tid = GetInstanceTypeId ();
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
if (accessor == 0)
{
return false;
}
bool ok = accessor->Disconnect (this, context, cb);
return ok;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/object-base.cc | C++ | gpl2 | 9,420 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Mathieu Lacage
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
*/
#include "attribute-construction-list.h"
#include "log.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE("AttributeConstructionList");
AttributeConstructionList::AttributeConstructionList ()
{}
void
AttributeConstructionList::Add (std::string name, Ptr<const AttributeChecker> checker, Ptr<AttributeValue> value)
{
// get rid of any previous value stored in this
// vector of values.
for (std::list<struct Item>::iterator k = m_list.begin (); k != m_list.end (); k++)
{
if (k->checker == checker)
{
m_list.erase (k);
break;
}
}
// store the new value.
struct Item attr;
attr.checker = checker;
attr.value = value;
attr.name = name;
m_list.push_back (attr);
}
Ptr<AttributeValue>
AttributeConstructionList::Find (Ptr<const AttributeChecker> checker) const
{
NS_LOG_FUNCTION (checker);
for (CIterator k = m_list.begin (); k != m_list.end (); k++)
{
NS_LOG_DEBUG ("Found " << k->name << " " << k->checker << " " << k->value);
if (k->checker == checker)
{
return k->value;
}
}
return 0;
}
AttributeConstructionList::CIterator
AttributeConstructionList::Begin (void) const
{
return m_list.begin();
}
AttributeConstructionList::CIterator
AttributeConstructionList::End (void) const
{
return m_list.end();
}
} // namespace ns3
| zy901002-gpsr | src/core/model/attribute-construction-list.cc | C++ | gpl2 | 2,153 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "type-id.h"
#include "singleton.h"
#include "trace-source-accessor.h"
#include <vector>
#include <sstream>
/*********************************************************************
* Helper code
*********************************************************************/
namespace {
class IidManager
{
public:
IidManager ();
uint16_t AllocateUid (std::string name);
void SetParent (uint16_t uid, uint16_t parent);
void SetGroupName (uint16_t uid, std::string groupName);
void AddConstructor (uint16_t uid, ns3::Callback<ns3::ObjectBase *> callback);
void HideFromDocumentation (uint16_t uid);
uint16_t GetUid (std::string name) const;
std::string GetName (uint16_t uid) const;
uint16_t GetParent (uint16_t uid) const;
std::string GetGroupName (uint16_t uid) const;
ns3::Callback<ns3::ObjectBase *> GetConstructor (uint16_t uid) const;
bool HasConstructor (uint16_t uid) const;
uint32_t GetRegisteredN (void) const;
uint16_t GetRegistered (uint32_t i) const;
void AddAttribute (uint16_t uid,
std::string name,
std::string help,
uint32_t flags,
ns3::Ptr<const ns3::AttributeValue> initialValue,
ns3::Ptr<const ns3::AttributeAccessor> spec,
ns3::Ptr<const ns3::AttributeChecker> checker);
void SetAttributeInitialValue(uint16_t uid,
uint32_t i,
ns3::Ptr<const ns3::AttributeValue> initialValue);
uint32_t GetAttributeN (uint16_t uid) const;
struct ns3::TypeId::AttributeInformation GetAttribute(uint16_t uid, uint32_t i) const;
void AddTraceSource (uint16_t uid,
std::string name,
std::string help,
ns3::Ptr<const ns3::TraceSourceAccessor> accessor);
uint32_t GetTraceSourceN (uint16_t uid) const;
struct ns3::TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, uint32_t i) const;
bool MustHideFromDocumentation (uint16_t uid) const;
private:
bool HasTraceSource (uint16_t uid, std::string name);
bool HasAttribute (uint16_t uid, std::string name);
struct IidInformation {
std::string name;
uint16_t parent;
std::string groupName;
bool hasConstructor;
ns3::Callback<ns3::ObjectBase *> constructor;
bool mustHideFromDocumentation;
std::vector<struct ns3::TypeId::AttributeInformation> attributes;
std::vector<struct ns3::TypeId::TraceSourceInformation> traceSources;
};
typedef std::vector<struct IidInformation>::const_iterator Iterator;
struct IidManager::IidInformation *LookupInformation (uint16_t uid) const;
std::vector<struct IidInformation> m_information;
};
IidManager::IidManager ()
{
}
uint16_t
IidManager::AllocateUid (std::string name)
{
uint16_t j = 1;
for (Iterator i = m_information.begin (); i != m_information.end (); i++)
{
if (i->name == name)
{
NS_FATAL_ERROR ("Trying to allocate twice the same uid: " << name);
return 0;
}
j++;
}
struct IidInformation information;
information.name = name;
information.parent = 0;
information.groupName = "";
information.hasConstructor = false;
information.mustHideFromDocumentation = false;
m_information.push_back (information);
uint32_t uid = m_information.size ();
NS_ASSERT (uid <= 0xffff);
return uid;
}
struct IidManager::IidInformation *
IidManager::LookupInformation (uint16_t uid) const
{
NS_ASSERT (uid <= m_information.size () && uid != 0);
return const_cast<struct IidInformation *> (&m_information[uid-1]);
}
void
IidManager::SetParent (uint16_t uid, uint16_t parent)
{
NS_ASSERT (parent <= m_information.size ());
struct IidInformation *information = LookupInformation (uid);
information->parent = parent;
}
void
IidManager::SetGroupName (uint16_t uid, std::string groupName)
{
struct IidInformation *information = LookupInformation (uid);
information->groupName = groupName;
}
void
IidManager::HideFromDocumentation (uint16_t uid)
{
struct IidInformation *information = LookupInformation (uid);
information->mustHideFromDocumentation = true;
}
void
IidManager::AddConstructor (uint16_t uid, ns3::Callback<ns3::ObjectBase *> callback)
{
struct IidInformation *information = LookupInformation (uid);
if (information->hasConstructor)
{
NS_FATAL_ERROR (information->name<<" already has a constructor.");
}
information->hasConstructor = true;
information->constructor = callback;
}
uint16_t
IidManager::GetUid (std::string name) const
{
uint32_t j = 1;
for (Iterator i = m_information.begin (); i != m_information.end (); i++)
{
if (i->name == name)
{
NS_ASSERT (j <= 0xffff);
return j;
}
j++;
}
return 0;
}
std::string
IidManager::GetName (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->name;
}
uint16_t
IidManager::GetParent (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->parent;
}
std::string
IidManager::GetGroupName (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->groupName;
}
ns3::Callback<ns3::ObjectBase *>
IidManager::GetConstructor (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
if (!information->hasConstructor)
{
NS_FATAL_ERROR ("Requested constructor for "<<information->name<<" but it does not have one.");
}
return information->constructor;
}
bool
IidManager::HasConstructor (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->hasConstructor;
}
uint32_t
IidManager::GetRegisteredN (void) const
{
return m_information.size ();
}
uint16_t
IidManager::GetRegistered (uint32_t i) const
{
return i + 1;
}
bool
IidManager::HasAttribute (uint16_t uid,
std::string name)
{
struct IidInformation *information = LookupInformation (uid);
while (true)
{
for (std::vector<struct ns3::TypeId::AttributeInformation>::const_iterator i = information->attributes.begin ();
i != information->attributes.end (); ++i)
{
if (i->name == name)
{
return true;
}
}
struct IidInformation *parent = LookupInformation (information->parent);
if (parent == information)
{
// top of inheritance tree
return false;
}
// check parent
information = parent;
}
return false;
}
void
IidManager::AddAttribute (uint16_t uid,
std::string name,
std::string help,
uint32_t flags,
ns3::Ptr<const ns3::AttributeValue> initialValue,
ns3::Ptr<const ns3::AttributeAccessor> accessor,
ns3::Ptr<const ns3::AttributeChecker> checker)
{
struct IidInformation *information = LookupInformation (uid);
if (HasAttribute (uid, name))
{
NS_FATAL_ERROR ("Attribute \"" << name << "\" already registered on tid=\"" <<
information->name << "\"");
}
struct ns3::TypeId::AttributeInformation info;
info.name = name;
info.help = help;
info.flags = flags;
info.initialValue = initialValue;
info.originalInitialValue = initialValue;
info.accessor = accessor;
info.checker = checker;
information->attributes.push_back (info);
}
void
IidManager::SetAttributeInitialValue(uint16_t uid,
uint32_t i,
ns3::Ptr<const ns3::AttributeValue> initialValue)
{
struct IidInformation *information = LookupInformation (uid);
NS_ASSERT (i < information->attributes.size ());
information->attributes[i].initialValue = initialValue;
}
uint32_t
IidManager::GetAttributeN (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->attributes.size ();
}
struct ns3::TypeId::AttributeInformation
IidManager::GetAttribute(uint16_t uid, uint32_t i) const
{
struct IidInformation *information = LookupInformation (uid);
NS_ASSERT (i < information->attributes.size ());
return information->attributes[i];
}
bool
IidManager::HasTraceSource (uint16_t uid,
std::string name)
{
struct IidInformation *information = LookupInformation (uid);
while (true)
{
for (std::vector<struct ns3::TypeId::TraceSourceInformation>::const_iterator i = information->traceSources.begin ();
i != information->traceSources.end (); ++i)
{
if (i->name == name)
{
return true;
}
}
struct IidInformation *parent = LookupInformation (information->parent);
if (parent == information)
{
// top of inheritance tree
return false;
}
// check parent
information = parent;
}
return false;
}
void
IidManager::AddTraceSource (uint16_t uid,
std::string name,
std::string help,
ns3::Ptr<const ns3::TraceSourceAccessor> accessor)
{
struct IidInformation *information = LookupInformation (uid);
if (HasTraceSource (uid, name))
{
NS_FATAL_ERROR ("Trace source \"" << name << "\" already registered on tid=\"" <<
information->name << "\"");
}
struct ns3::TypeId::TraceSourceInformation source;
source.name = name;
source.help = help;
source.accessor = accessor;
information->traceSources.push_back (source);
}
uint32_t
IidManager::GetTraceSourceN (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->traceSources.size ();
}
struct ns3::TypeId::TraceSourceInformation
IidManager::GetTraceSource(uint16_t uid, uint32_t i) const
{
struct IidInformation *information = LookupInformation (uid);
NS_ASSERT (i < information->traceSources.size ());
return information->traceSources[i];
}
bool
IidManager::MustHideFromDocumentation (uint16_t uid) const
{
struct IidInformation *information = LookupInformation (uid);
return information->mustHideFromDocumentation;
}
} // anonymous namespace
namespace ns3 {
/*********************************************************************
* The TypeId class
*********************************************************************/
TypeId::TypeId (const char *name)
{
uint16_t uid = Singleton<IidManager>::Get ()->AllocateUid (name);
NS_ASSERT (uid != 0);
m_tid = uid;
}
TypeId::TypeId (uint16_t tid)
: m_tid (tid)
{
}
TypeId
TypeId::LookupByName (std::string name)
{
uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name);
NS_ASSERT_MSG (uid != 0, "Assert in TypeId::LookupByName: " << name << " not found");
return TypeId (uid);
}
bool
TypeId::LookupByNameFailSafe (std::string name, TypeId *tid)
{
uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name);
if (uid == 0)
{
return false;
}
*tid = TypeId (uid);
return true;
}
uint32_t
TypeId::GetRegisteredN (void)
{
return Singleton<IidManager>::Get ()->GetRegisteredN ();
}
TypeId
TypeId::GetRegistered (uint32_t i)
{
return TypeId (Singleton<IidManager>::Get ()->GetRegistered (i));
}
bool
TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInformation *info) const
{
TypeId tid;
TypeId nextTid = *this;
do {
tid = nextTid;
for (uint32_t i = 0; i < tid.GetAttributeN (); i++)
{
struct TypeId::AttributeInformation tmp = tid.GetAttribute(i);
if (tmp.name == name)
{
*info = tmp;
return true;
}
}
nextTid = tid.GetParent ();
} while (nextTid != tid);
return false;
}
TypeId
TypeId::SetParent (TypeId tid)
{
Singleton<IidManager>::Get ()->SetParent (m_tid, tid.m_tid);
return *this;
}
TypeId
TypeId::SetGroupName (std::string groupName)
{
Singleton<IidManager>::Get ()->SetGroupName (m_tid, groupName);
return *this;
}
TypeId
TypeId::GetParent (void) const
{
uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_tid);
return TypeId (parent);
}
bool
TypeId::HasParent (void) const
{
uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_tid);
return parent != m_tid;
}
bool
TypeId::IsChildOf (TypeId other) const
{
TypeId tmp = *this;
while (tmp != other && tmp != tmp.GetParent ())
{
tmp = tmp.GetParent ();
}
return tmp == other && *this != other;
}
std::string
TypeId::GetGroupName (void) const
{
std::string groupName = Singleton<IidManager>::Get ()->GetGroupName (m_tid);
return groupName;
}
std::string
TypeId::GetName (void) const
{
std::string name = Singleton<IidManager>::Get ()->GetName (m_tid);
return name;
}
bool
TypeId::HasConstructor (void) const
{
bool hasConstructor = Singleton<IidManager>::Get ()->HasConstructor (m_tid);
return hasConstructor;
}
void
TypeId::DoAddConstructor (Callback<ObjectBase *> cb)
{
Singleton<IidManager>::Get ()->AddConstructor (m_tid, cb);
}
TypeId
TypeId::AddAttribute (std::string name,
std::string help,
const AttributeValue &initialValue,
Ptr<const AttributeAccessor> accessor,
Ptr<const AttributeChecker> checker)
{
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue.Copy (), accessor, checker);
return *this;
}
TypeId
TypeId::AddAttribute (std::string name,
std::string help,
uint32_t flags,
const AttributeValue &initialValue,
Ptr<const AttributeAccessor> accessor,
Ptr<const AttributeChecker> checker)
{
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, initialValue.Copy (), accessor, checker);
return *this;
}
bool
TypeId::SetAttributeInitialValue(uint32_t i,
Ptr<const AttributeValue> initialValue)
{
Singleton<IidManager>::Get ()->SetAttributeInitialValue (m_tid, i, initialValue);
return true;
}
Callback<ObjectBase *>
TypeId::GetConstructor (void) const
{
Callback<ObjectBase *> cb = Singleton<IidManager>::Get ()->GetConstructor (m_tid);
return cb;
}
bool
TypeId::MustHideFromDocumentation (void) const
{
bool mustHide = Singleton<IidManager>::Get ()->MustHideFromDocumentation (m_tid);
return mustHide;
}
uint32_t
TypeId::GetAttributeN (void) const
{
uint32_t n = Singleton<IidManager>::Get ()->GetAttributeN (m_tid);
return n;
}
struct TypeId::AttributeInformation
TypeId::GetAttribute(uint32_t i) const
{
return Singleton<IidManager>::Get ()->GetAttribute(m_tid, i);
}
std::string
TypeId::GetAttributeFullName (uint32_t i) const
{
struct TypeId::AttributeInformation info = GetAttribute(i);
return GetName () + "::" + info.name;
}
uint32_t
TypeId::GetTraceSourceN (void) const
{
return Singleton<IidManager>::Get ()->GetTraceSourceN (m_tid);
}
struct TypeId::TraceSourceInformation
TypeId::GetTraceSource(uint32_t i) const
{
return Singleton<IidManager>::Get ()->GetTraceSource(m_tid, i);
}
TypeId
TypeId::AddTraceSource (std::string name,
std::string help,
Ptr<const TraceSourceAccessor> accessor)
{
Singleton<IidManager>::Get ()->AddTraceSource (m_tid, name, help, accessor);
return *this;
}
TypeId
TypeId::HideFromDocumentation (void)
{
Singleton<IidManager>::Get ()->HideFromDocumentation (m_tid);
return *this;
}
Ptr<const TraceSourceAccessor>
TypeId::LookupTraceSourceByName (std::string name) const
{
TypeId tid;
TypeId nextTid = *this;
do {
tid = nextTid;
for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++)
{
struct TypeId::TraceSourceInformation info = tid.GetTraceSource (i);
if (info.name == name)
{
return info.accessor;
}
}
nextTid = tid.GetParent ();
} while (nextTid != tid);
return 0;
}
uint16_t
TypeId::GetUid (void) const
{
return m_tid;
}
void
TypeId::SetUid (uint16_t tid)
{
m_tid = tid;
}
std::ostream & operator << (std::ostream &os, TypeId tid)
{
os << tid.GetName ();
return os;
}
std::istream & operator >> (std::istream &is, TypeId &tid)
{
std::string tidString;
is >> tidString;
bool ok = TypeId::LookupByNameFailSafe (tidString, &tid);
if (!ok)
{
is.setstate (std::ios_base::badbit);
}
return is;
}
ATTRIBUTE_HELPER_CPP (TypeId);
bool operator < (TypeId a, TypeId b)
{
return a.m_tid < b.m_tid;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/type-id.cc | C++ | gpl2 | 17,703 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA, Mathieu Lacage
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
*/
#ifndef OBJECT_VECTOR_H
#define OBJECT_VECTOR_H
#include <vector>
#include "object.h"
#include "ptr.h"
#include "attribute.h"
#include "object-ptr-container.h"
namespace ns3 {
typedef ObjectPtrContainerValue ObjectVectorValue;
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (U T::*memberContainer);
template <typename T>
Ptr<const AttributeChecker> MakeObjectVectorChecker (void);
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const);
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (INDEX (T::*getN)(void) const,
Ptr<U> (T::*get)(INDEX) const);
} // namespace ns3
namespace ns3 {
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (U T::*memberVector)
{
struct MemberStdContainer : public ObjectPtrContainerAccessor
{
virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const {
const T *obj = dynamic_cast<const T *> (object);
if (obj == 0)
{
return false;
}
*n = (obj->*m_memberVector).size ();
return true;
}
virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i) const {
const T *obj = static_cast<const T *> (object);
typename U::const_iterator begin = (obj->*m_memberVector).begin ();
typename U::const_iterator end = (obj->*m_memberVector).end ();
uint32_t k = 0;
for (typename U::const_iterator j = begin; j != end; j++, k++)
{
if (k == i)
{
return *j;
break;
}
}
NS_ASSERT (false);
// quiet compiler.
return 0;
}
U T::*m_memberVector;
} *spec = new MemberStdContainer ();
spec->m_memberVector = memberVector;
return Ptr<const AttributeAccessor> (spec, false);
}
template <typename T>
Ptr<const AttributeChecker> MakeObjectVectorChecker (void)
{
return MakeObjectPtrContainerChecker<T> ();
}
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const)
{
return MakeObjectPtrContainerAccessor<T,U,INDEX>(get, getN);
}
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (INDEX (T::*getN)(void) const,
Ptr<U> (T::*get)(INDEX) const)
{
return MakeObjectPtrContainerAccessor<T,U,INDEX>(get, getN);
}
} // namespace ns3
#endif /* OBJECT_VECTOR_H */
| zy901002-gpsr | src/core/model/object-vector.h | C++ | gpl2 | 3,491 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "double.h"
#include "object.h"
#include <sstream>
namespace ns3 {
ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (double, Double);
namespace internal {
Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max, std::string name)
{
struct Checker : public AttributeChecker
{
Checker (double minValue, double maxValue, std::string name)
: m_minValue (minValue),
m_maxValue (maxValue),
m_name (name) {}
virtual bool Check (const AttributeValue &value) const {
const DoubleValue *v = dynamic_cast<const DoubleValue *> (&value);
if (v == 0)
{
return false;
}
return v->Get () >= m_minValue && v->Get () <= m_maxValue;
}
virtual std::string GetValueTypeName (void) const {
return "ns3::DoubleValue";
}
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetUnderlyingTypeInformation (void) const {
std::ostringstream oss;
oss << m_name << " " << m_minValue << ":" << m_maxValue;
return oss.str ();
}
virtual Ptr<AttributeValue> Create (void) const {
return ns3::Create<DoubleValue> ();
}
virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
const DoubleValue *src = dynamic_cast<const DoubleValue *> (&source);
DoubleValue *dst = dynamic_cast<DoubleValue *> (&destination);
if (src == 0 || dst == 0)
{
return false;
}
*dst = *src;
return true;
}
double m_minValue;
double m_maxValue;
std::string m_name;
} *checker = new Checker (min, max, name);
return Ptr<const AttributeChecker> (checker, false);
}
} // namespace internal
} // namespace ns3
| zy901002-gpsr | src/core/model/double.cc | C++ | gpl2 | 2,573 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "timer.h"
#include "simulator.h"
#include "simulation-singleton.h"
namespace ns3 {
Timer::Timer ()
: m_flags (CHECK_ON_DESTROY),
m_delay (FemtoSeconds (0)),
m_event (),
m_impl (0)
{
}
Timer::Timer (enum DestroyPolicy destroyPolicy)
: m_flags (destroyPolicy),
m_delay (FemtoSeconds (0)),
m_event (),
m_impl (0)
{
}
Timer::~Timer ()
{
if (m_flags & CHECK_ON_DESTROY)
{
if (m_event.IsRunning ())
{
NS_FATAL_ERROR ("Event is still running while destroying.");
}
}
else if (m_flags & CANCEL_ON_DESTROY)
{
m_event.Cancel ();
}
else if (m_flags & REMOVE_ON_DESTROY)
{
Simulator::Remove (m_event);
}
delete m_impl;
}
void
Timer::SetDelay (const Time &time)
{
m_delay = time;
}
Time
Timer::GetDelay (void) const
{
return m_delay;
}
Time
Timer::GetDelayLeft (void) const
{
switch (GetState ())
{
case Timer::RUNNING:
return Simulator::GetDelayLeft (m_event);
break;
case Timer::EXPIRED:
return TimeStep (0);
break;
case Timer::SUSPENDED:
return m_delayLeft;
break;
default:
NS_ASSERT (false);
return TimeStep (0);
break;
}
}
void
Timer::Cancel (void)
{
Simulator::Cancel (m_event);
}
void
Timer::Remove (void)
{
Simulator::Remove (m_event);
}
bool
Timer::IsExpired (void) const
{
return !IsSuspended () && m_event.IsExpired ();
}
bool
Timer::IsRunning (void) const
{
return !IsSuspended () && m_event.IsRunning ();
}
bool
Timer::IsSuspended (void) const
{
return (m_flags & TIMER_SUSPENDED) == TIMER_SUSPENDED;
}
enum Timer::State
Timer::GetState (void) const
{
if (IsRunning ())
{
return Timer::RUNNING;
}
else if (IsExpired ())
{
return Timer::EXPIRED;
}
else
{
NS_ASSERT (IsSuspended ());
return Timer::SUSPENDED;
}
}
void
Timer::Schedule (void)
{
Schedule (m_delay);
}
void
Timer::Schedule (Time delay)
{
NS_ASSERT (m_impl != 0);
if (m_event.IsRunning ())
{
NS_FATAL_ERROR ("Event is still running while re-scheduling.");
}
m_event = m_impl->Schedule (delay);
}
void
Timer::Suspend (void)
{
NS_ASSERT (IsRunning ());
m_delayLeft = Simulator::GetDelayLeft (m_event);
Simulator::Remove (m_event);
m_flags |= TIMER_SUSPENDED;
}
void
Timer::Resume (void)
{
NS_ASSERT (m_flags & TIMER_SUSPENDED);
m_event = m_impl->Schedule (m_delayLeft);
m_flags &= ~TIMER_SUSPENDED;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/timer.cc | C++ | gpl2 | 3,302 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef SIMULATOR_IMPL_H
#define SIMULATOR_IMPL_H
#include "event-impl.h"
#include "event-id.h"
#include "nstime.h"
#include "object.h"
#include "object-factory.h"
#include "ptr.h"
namespace ns3 {
class Scheduler;
class SimulatorImpl : public Object
{
public:
static TypeId GetTypeId (void);
/**
* Every event scheduled by the Simulator::insertAtDestroy method is
* invoked. Then, we ensure that any memory allocated by the
* Simulator is freed.
* This method is typically invoked at the end of a simulation
* to avoid false-positive reports by a leak checker.
* After this method has been invoked, it is actually possible
* to restart a new simulation with a set of calls to Simulator::run
* and Simulator::insert_*.
*/
virtual void Destroy () = 0;
/**
* If there are no more events lefts to be scheduled, or if simulation
* time has already reached the "stop time" (see Simulator::Stop()),
* return true. Return false otherwise.
*/
virtual bool IsFinished (void) const = 0;
/**
* If Simulator::IsFinished returns true, the behavior of this
* method is undefined. Otherwise, it returns the microsecond-based
* time of the next event expected to be scheduled.
*/
virtual Time Next (void) const = 0;
/**
* If an event invokes this method, it will be the last
* event scheduled by the Simulator::run method before
* returning to the caller.
*/
virtual void Stop (void) = 0;
/**
* Force the Simulator::run method to return to the caller when the
* expiration time of the next event to be processed is greater than
* or equal to the stop time. The stop time is relative to the
* current simulation time.
* @param time the stop time, relative to the current time.
*/
virtual void Stop (Time const &time) = 0;
/**
* \param time delay until the event expires
* \param event the event to schedule
* \returns a unique identifier for the newly-scheduled event.
*
* This method will be typically used by language bindings
* to delegate events to their own subclass of the EventImpl base class.
*/
virtual EventId Schedule (Time const &time, EventImpl *event) = 0;
/**
* \param time delay until the event expires
* \param context event context
* \param event the event to schedule
* \returns a unique identifier for the newly-scheduled event.
*
* This method will be typically used by language bindings
* to delegate events to their own subclass of the EventImpl base class.
*/
virtual void ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event) = 0;
/**
* \param event the event to schedule
* \returns a unique identifier for the newly-scheduled event.
*
* This method will be typically used by language bindings
* to delegate events to their own subclass of the EventImpl base class.
*/
virtual EventId ScheduleNow (EventImpl *event) = 0;
/**
* \param event the event to schedule
* \returns a unique identifier for the newly-scheduled event.
*
* This method will be typically used by language bindings
* to delegate events to their own subclass of the EventImpl base class.
*/
virtual EventId ScheduleDestroy (EventImpl *event) = 0;
/**
* Remove an event from the event list.
* This method has the same visible effect as the
* ns3::EventId::Cancel method
* but its algorithmic complexity is much higher: it has often
* O(log(n)) complexity, sometimes O(n), sometimes worse.
* Note that it is not possible to remove events which were scheduled
* for the "destroy" time. Doing so will result in a program error (crash).
*
* @param ev the event to remove from the list of scheduled events.
*/
virtual void Remove (const EventId &ev) = 0;
/**
* Set the cancel bit on this event: the event's associated function
* will not be invoked when it expires.
* This method has the same visible effect as the
* ns3::Simulator::remove method but its algorithmic complexity is
* much lower: it has O(1) complexity.
* This method has the exact same semantics as ns3::EventId::cancel.
* Note that it is not possible to cancel events which were scheduled
* for the "destroy" time. Doing so will result in a program error (crash).
*
* @param ev the event to cancel
*/
virtual void Cancel (const EventId &ev) = 0;
/**
* This method has O(1) complexity.
* Note that it is not possible to test for the expiration of
* events which were scheduled for the "destroy" time. Doing so
* will result in a program error (crash).
* An event is said to "expire" when it starts being scheduled
* which means that if the code executed by the event calls
* this function, it will get true.
*
* @param ev the event to test for expiration
* @returns true if the event has expired, false otherwise.
*/
virtual bool IsExpired (const EventId &ev) const = 0;
/**
* Run the simulation until one of:
* - no events are present anymore
* - the user called Simulator::stop
* - the user called Simulator::stopAtUs and the
* expiration time of the next event to be processed
* is greater than or equal to the stop time.
*/
virtual void Run (void) = 0;
/**
* Process only the next simulation event, then return immediately.
*/
virtual void RunOneEvent (void) = 0;
/**
* Return the "current simulation time".
*/
virtual Time Now (void) const = 0;
/**
* \param id the event id to analyse
* \return the delay left until the input event id expires.
* if the event is not running, this method returns
* zero.
*/
virtual Time GetDelayLeft (const EventId &id) const = 0;
/**
* \return the maximum simulation time at which an event
* can be scheduled.
*
* The returned value will always be bigger than or equal to Simulator::Now.
*/
virtual Time GetMaximumSimulationTime (void) const = 0;
/**
* \param schedulerFactory a new event scheduler factory
*
* The event scheduler can be set at any time: the events scheduled
* in the previous scheduler will be transfered to the new scheduler
* before we start to use it.
*/
virtual void SetScheduler (ObjectFactory schedulerFactory) = 0;
/**
* \return the system id for this simulator; used for
* MPI or other distributed simulations
*/
virtual uint32_t GetSystemId () const = 0;
/**
* \return the current simulation context
*/
virtual uint32_t GetContext (void) const = 0;
};
} // namespace ns3
#endif /* SIMULATOR_IMPL_H */
| zy901002-gpsr | src/core/model/simulator-impl.h | C++ | gpl2 | 7,447 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pthread.h>
#include <errno.h>
#include <sys/time.h>
#include "fatal-error.h"
#include "system-condition.h"
#include "log.h"
NS_LOG_COMPONENT_DEFINE ("SystemCondition");
namespace ns3 {
class SystemConditionPrivate {
public:
static const uint64_t NS_PER_SEC = (uint64_t)1000000000;
SystemConditionPrivate ();
~SystemConditionPrivate ();
void SetCondition (bool condition);
bool GetCondition (void);
void Signal (void);
void Broadcast (void);
void Wait (void);
bool TimedWait (uint64_t ns);
private:
pthread_mutex_t m_mutex;
pthread_cond_t m_cond;
bool m_condition;
};
SystemConditionPrivate::SystemConditionPrivate ()
{
NS_LOG_FUNCTION_NOARGS ();
m_condition = false;
pthread_mutexattr_t mAttr;
pthread_mutexattr_init (&mAttr);
//
// Linux and OS X (at least) have, of course chosen different names for the
// error checking flags just to make life difficult.
//
#if defined (PTHREAD_MUTEX_ERRORCHECK_NP)
pthread_mutexattr_settype (&mAttr, PTHREAD_MUTEX_ERRORCHECK_NP);
#else
pthread_mutexattr_settype (&mAttr, PTHREAD_MUTEX_ERRORCHECK);
#endif
pthread_mutex_init (&m_mutex, &mAttr);
pthread_condattr_t cAttr;
pthread_condattr_init (&cAttr);
pthread_condattr_setpshared (&cAttr, PTHREAD_PROCESS_PRIVATE);
pthread_cond_init (&m_cond, &cAttr);
}
SystemConditionPrivate::~SystemConditionPrivate()
{
NS_LOG_FUNCTION_NOARGS ();
pthread_mutex_destroy (&m_mutex);
pthread_cond_destroy (&m_cond);
}
void
SystemConditionPrivate::SetCondition (bool condition)
{
NS_LOG_FUNCTION_NOARGS ();
m_condition = condition;
}
bool
SystemConditionPrivate::GetCondition (void)
{
NS_LOG_FUNCTION_NOARGS ();
return m_condition;
}
void
SystemConditionPrivate::Signal (void)
{
NS_LOG_FUNCTION_NOARGS ();
pthread_mutex_lock (&m_mutex);
pthread_cond_signal (&m_cond);
pthread_mutex_unlock (&m_mutex);
}
void
SystemConditionPrivate::Broadcast (void)
{
NS_LOG_FUNCTION_NOARGS ();
pthread_mutex_lock (&m_mutex);
pthread_cond_broadcast (&m_cond);
pthread_mutex_unlock (&m_mutex);
}
void
SystemConditionPrivate::Wait (void)
{
NS_LOG_FUNCTION_NOARGS ();
pthread_mutex_lock (&m_mutex);
m_condition = false;
while (m_condition == false)
{
pthread_cond_wait (&m_cond, &m_mutex);
}
pthread_mutex_unlock (&m_mutex);
}
bool
SystemConditionPrivate::TimedWait (uint64_t ns)
{
NS_LOG_FUNCTION_NOARGS ();
struct timespec ts;
ts.tv_sec = ns / NS_PER_SEC;
ts.tv_nsec = ns % NS_PER_SEC;
struct timeval tv;
gettimeofday (&tv, NULL);
ts.tv_sec += tv.tv_sec;
ts.tv_nsec += tv.tv_usec * 1000;
if (ts.tv_nsec > (int64_t)NS_PER_SEC)
{
++ts.tv_sec;
ts.tv_nsec %= NS_PER_SEC;
}
int rc;
pthread_mutex_lock (&m_mutex);
while (m_condition == false)
{
rc = pthread_cond_timedwait (&m_cond, &m_mutex, &ts);
if (rc == ETIMEDOUT)
{
pthread_mutex_unlock (&m_mutex);
return true;
}
}
pthread_mutex_unlock (&m_mutex);
return false;
}
SystemCondition::SystemCondition()
: m_priv (new SystemConditionPrivate ())
{
NS_LOG_FUNCTION_NOARGS ();
}
SystemCondition::~SystemCondition ()
{
NS_LOG_FUNCTION_NOARGS ();
delete m_priv;
}
void
SystemCondition::SetCondition (bool condition)
{
NS_LOG_FUNCTION_NOARGS ();
m_priv->SetCondition (condition);
}
bool
SystemCondition::GetCondition (void)
{
NS_LOG_FUNCTION_NOARGS ();
return m_priv->GetCondition ();
}
void
SystemCondition::Signal (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_priv->Signal ();
}
void
SystemCondition::Broadcast (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_priv->Broadcast ();
}
void
SystemCondition::Wait (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_priv->Wait ();
}
bool
SystemCondition::TimedWait (uint64_t ns)
{
NS_LOG_FUNCTION_NOARGS ();
return m_priv->TimedWait (ns);
}
} // namespace ns3
| zy901002-gpsr | src/core/model/unix-system-condition.cc | C++ | gpl2 | 4,638 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef NS_DOUBLE_H
#define NS_DOUBLE_H
#include "attribute.h"
#include "attribute-helper.h"
#include <stdint.h>
#include <limits>
namespace ns3 {
/**
* \ingroup attribute
*
* \class ns3::DoubleValue
* \brief Hold an floating point type
*
* \anchor double
* This class can be used to hold variables of floating point type
* such as 'double' or 'float'. The internal format is 'double'.
*/
ATTRIBUTE_VALUE_DEFINE_WITH_NAME (double, Double);
ATTRIBUTE_ACCESSOR_DEFINE (Double);
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (void);
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (double min);
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max);
} // namespace ns3
#include "type-name.h"
namespace ns3 {
namespace internal {
Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max, std::string name);
} // namespace internal
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (void)
{
return internal::MakeDoubleChecker (-std::numeric_limits<T>::max (),
std::numeric_limits<T>::max (),
TypeNameGet<T> ());
}
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (double min)
{
return internal::MakeDoubleChecker (min,
std::numeric_limits<T>::max (),
TypeNameGet<T> ());
}
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max)
{
return internal::MakeDoubleChecker (min,
max,
TypeNameGet<T> ());
}
} // namespace ns3
#endif /* NS_DOUBLE_H */
| zy901002-gpsr | src/core/model/double.h | C++ | gpl2 | 2,584 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OBJECT_NAMES_H
#define OBJECT_NAMES_H
#include "ptr.h"
#include "object.h"
namespace ns3 {
/**
* \brief A directory of name and Ptr<Object> associations that allows us to
* give any ns3 Object a name.
*/
class Names
{
public:
/**
* \brief Add the association between the string "name" and the Ptr<Object> obj.
*
* The name may begin either with "/Names" to explicitly call out the fact
* that the name provided is installed under the root of the name space,
* or it may begin with the name of the first object in the path. For example,
* Names::Add ("/Names/client", obj) and Names::Add ("client", obj) accomplish
* exactly the same thing. A name at a given level in the name space path must
* be unique. In the case of the example above, it would be illegal to try and
* associate a different object with the same name: "client" at the same level
* ("/Names") in the path.
*
* As well as specifying a name at the root of the "/Names" namespace, the
* name parameter can contain a path that fully qualifies the name to
* be added. For example, if you previously have named an object "client"
* in the root namespace as above, you could name an object "under" that
* name by making a call like Names::Add ("/Names/client/eth0", obj). This
* will define the name "eth0" and make it reachable using the path specified.
* Note that Names::Add ("client/eth0", obj) would accomplish exactly the same
* thing.
*
* Duplicate names are not allowed at the same level in a path, however you may
* associate similar names with different paths. For example, if you define
* "/Names/Client", you may not define another "/Names/Client" just as you may
* not have two files with the same name in a classical filesystem. However,
* you may have "/Names/Client/eth0" and "/Names/Server/eth0" defined at the
* same time just as you might have different files of the same name under
* different directories.
*
* \param name The name of the object you want to associate; which may be
* prepended with a path to that object.
* \param object A smart pointer to the object itself.
*/
static void Add (std::string name, Ptr<Object> object);
/**
* \brief An intermediate form of Names::Add allowing you to provide a path to
* the parent object (under which you want this name to be defined) in the form
* of a name path string.
*
* In some cases, it is desirable to break up the path used to describe an item
* in the names namespace into a path and a name. This is analogous to a
* file system operation in which you provide a directory name and a file name.
*
* For example, consider a situation where you have previously named an object
* "/Names/server". If you further want to create an association for between a
* Ptr<Object> object that you want to live "under" the server in the name space
* -- perhaps "eth0" -- you could do this in two ways, depending on which was
* more convenient: Names::Add ("/Names/server/eth0", object) or, using the split
* path and name approach, Names::Add ("/Names/server", "eth0", object).
*
* Duplicate names are not allowed at the same level in a path, however you may
* associate similar names with different paths. For example, if you define
* "/Names/Client", you may not define another "/Names/Client" just as you may
* not have two files with the same name in a classical filesystem. However,
* you may have "/Names/Client/eth0" and "/Names/Server/eth0" defined at the
* same time just as you might have different files of the same name under
* different directories.
*
* \param path A path name describing a previously named object under which
* you want this new name to be defined.
* \param name The name of the object you want to associate.
* \param object A smart pointer to the object itself.
*
* \see Names::Add (Ptr<Object> context, std::string name, Ptr<Object> object);
*/
static void Add (std::string path, std::string name, Ptr<Object> object);
/**
* \brief A low-level form of Names::Add allowing you to specify the path to
* the parent object (under which you want this name to be defined) in the form
* of a previously named object.
*
* In some use cases, it is desirable to break up the path in the names name
* space into a path and a name. This is analogous to a file system operation
* in which you provide a directory name and a file name. Recall that the path
* string actually refers to a previously named object, "under" which you want
* to accomplish some naming action.
*
* However, the path is sometimes not available, and you only have the object
* that is represented by the path in the names name space. To support this
* use-case in a reasonably high-performance way, the path string is can be
* replaced by the object pointer to which that path would refer. In the spirit
* of the Config code where this use-case is most prominent, we refer to this
* object as the "context" for the names operation.
*
* You can think of the context roughly as the inode number of a directory file
* in Unix. The inode number can be used to look up the directory file which
* contains the list of file names defined at that directory level. Similarly
* the context is used to look up an internal name service entry which contains
* the names defined for that context.
*
* For example, consider a situation where you have previously named an object
* "/Names/server". If you further want to create an association for between a
* Ptr<Object> object that you want to live "under" the server in the name space
* -- perhaps "eth0" -- you could do this by providing a complete path to the
* new name: Names::Add ("/Names/server/eth0", object). If, however, somewhere
* in your code you only had a pointer to the server, say Ptr<Node> node, and
* not a handy path string, you could also accomplish this by
* Names::Add (node, "eth0", object).
*
* Duplicate names are not allowed at the same level in a path. In the case
* of this method, the context object gives the same information as a path
* string. You may associate similar names with different paths. For example,
* if you define"/Names/Client", you may not define another "/Names/Client"
* just as you may not have two files with the same name in a classical filesystem.
* However, you may have "/Names/Client/eth0" and "/Names/Server/eth0" defined at
* the same time just as you might have different files of the same name under
* different directories.
*
* \param context A smart pointer to an object that is used in place of the path
* under which you want this new name to be defined.
* \param name The name of the object you want to associate.
* \param object A smart pointer to the object itself.
*/
static void Add (Ptr<Object> context, std::string name, Ptr<Object> object);
/**
* \brief Rename a previously associated name.
*
* The name may begin either with "/Names" to explicitly call out the fact
* that the name provided is installed under the root of the name space,
* or it may begin with the name of the first object in the path. For example,
* Names::Rename ("/Names/client", "server") and Names::Rename ("client", "server")
* accomplish exactly the same thing. Names at a given level in the name space
* path must be unique. In the case of the example above, it would be illegal
* to try and rename a different object to the same name: "server" at the same
* level ("/Names") in the path.
*
* As well as specifying a name at the root of the "/Names" namespace, the
* name parameter can contain a path that fully qualifies the name to
* be changed. For example, if you previously have (re)named an object
* "server" in the root namespace as above, you could then rename an object
* "under" that name by making a call like Names::Rename ("/Names/server/csma", "eth0").
* This will rename the object previously associated with "/Names/server/csma"
* to "eth0" and make leave it reachable using the path "/Names/server/eth0".
* Note that Names::Rename ("server/csma", "eth0") would accomplish exactly the
* same thing.
*
* \param oldpath The current path name to the object you want to change.
* \param newname The new name of the object you want to change.
*
* \see Names::Add (std::string name, Ptr<Object> obj)
*/
static void Rename (std::string oldpath, std::string newname);
/**
* \brief An intermediate form of Names::Rename allowing you to provide a path to
* the parent object (under which you want this name to be changed) in the form
* of a name path string.
*
* In some cases, it is desirable to break up the path used to describe an item
* in the names namespace into a path and a name. This is analogous to a
* file system operation in which you provide a directory name and a file name.
*
* For example, consider a situation where you have previously named an object
* "/Names/server/csma". If you want to change the name "csma" to "eth0", you
* could do this in two ways, depending on which was more convenient:
* Names::Rename ("/Names/server/csma", "eth0") or, using the split
* path and name approach, Names::Rename ("/Names/server", "csma", "eth0").
*
* \param path A path name describing a previously named object under which
* you want this name change to occur (cf. directory).
* \param oldname The currently defined name of the object.
* \param newname The new name you want the object to have.
*/
static void Rename (std::string path, std::string oldname, std::string newname);
/**
* \brief A low-level form of Names::Rename allowing you to specify the path to
* the parent object (under which you want this name to be changed) in the form
* of a previously named object.
*
* In some use cases, it is desirable to break up the path in the names name
* space into a path and a name. This is analogous to a file system operation
* in which you provide a directory name and a file name. Recall that the path
* string actually refers to a previously named object, "under" which you want
* to accomplish some naming action.
*
* However, the path is sometimes not available, and you only have the object
* that is represented by the path in the names name space. To support this
* use-case in a reasonably high-performance way, the path string is can be
* replaced by the object pointer to which that path would refer. In the spirit
* of the Config code where this use-case is most prominent, we refer to this
* object as the "context" for the names operation.
*
* You can think of the context roughly as the inode number of a directory file
* in Unix. The inode number can be used to look up the directory file which
* contains the list of file names defined at that directory level. Similarly
* the context is used to look up an internal name service entry which contains
* the names defined for that context.
*
* For example, consider a situation where you have previously named an object
* "/Names/server/csma". If you later decide to rename the csma object to say
* "eth0" -- you could do this by providing a complete path as in
* Names::Rename ("/Names/server/csma", "eth0"). If, however, somewhere
* in your code you only had a pointer to the server, and not a handy path
* string, say Ptr<Node> node, you could also accomplish this by
* Names::Rename (node, "csma", "eth0").
*
* \param context A smart pointer to an object that is used in place of the path
* under which you want this new name to be defined.
* \param oldname The current shortname of the object you want to change.
* \param newname The new shortname of the object you want to change.
*/
static void Rename (Ptr<Object> context, std::string oldname, std::string newname);
/**
* Given a pointer to an object, look to see if that object has a name
* associated with it and, if so, return the name of the object otherwise
* return an empty string.
*
* An object can be referred to in two ways. Either you can talk about it
* using its fully qualified path name, for example, "/Names/client/eth0"
* or you can refer to it by its name, in this case "eth0".
*
* This method returns the name of the object, e.g., "eth0".
*
* \param object A smart pointer to an object for which you want to find
* its name.
*
* \returns a string containing the name of the object if found, otherwise
* the empty string.
*/
static std::string FindName (Ptr<Object> object);
/**
* Given a pointer to an object, look to see if that object has a name
* associated with it and return the fully qualified name path of the
* object otherwise return an empty string.
*
* An object can be referred to in two ways. Either you can talk about it
* using its fully qualified path name, for example, "/Names/client/eth0"
* or you can refer to it by its name, in this case "eth0".
*
* This method returns the name path of the object, e.g., "Names/client/eth0".
*
* \param object A smart pointer to an object for which you want to find
* its fullname.
*
* \returns a string containing the name path of the object, otherwise
* the empty string.
*/
static std::string FindPath (Ptr<Object> object);
/**
* Clear the list of objects associated with names.
*/
static void Clear (void);
/**
* Given a name path string, look to see if there's an object in the system
* with that associated to it. If there is, do a GetObject on the resulting
* object to convert it to the requested typename and return it.
*
* An object can be referred to in two ways. Either you can talk about it
* using its fully qualified path name, for example, "/Names/client/eth0"
* or you can refer to it by its name, in this case "eth0".
*
* This method requires that the name path of the object be provided, e.g.,
* "Names/client/eth0".
*
* \param path A string containing a name space path used to locate the object.
*
* \returns a smart pointer to the named object converted to the requested
* type.
*/
template <typename T>
static Ptr<T> Find (std::string path);
/**
* Given a path to an object and an object name, look through the names defined
* under the path to see if there's an object there with the given name.
*
* In some cases, it is desirable to break up the path used to describe an item
* in the names namespace into a path and a name. This is analogous to a
* file system operation in which you provide a directory name and a file name.
*
* For example, consider a situation where you have previously named an object
* "/Names/server/eth0". If you want to discover the object which you associated
* with this path, you could do this in two ways, depending on which was more
* convenient: Names::Find ("/Names/server/eth0") or, using the split path and
* name approach, Names::Find ("/Names/server", "eth0").
*
* \param path A path name describing a previously named object under which
* you want to look for the specified name.
* \param name A string containing a name to search for.
*
* \returns a smart pointer to the named object converted to the requested
* type.
*/
template <typename T>
static Ptr<T> Find (std::string path, std::string name);
/**
* Given a path to an object and an object name, look through the names defined
* under the path to see if there's an object there with the given name.
*
* In some cases, it is desirable to break up the path used to describe an item
* in the names namespace into a path and a name. This is analogous to a
* file system operation in which you provide a directory name and a file name.
*
* For example, consider a situation where you have previously named an object
* "/Names/server/eth0". If you want to discover the object which you associated
* with this path, you could do this in two ways, depending on which was more
* convenient: Names::Find ("/Names/server/eth0") or, using the split path and
* name approach, Names::Find ("/Names/server", "eth0").
*
* However, the path is sometimes not available, and you only have the object
* that is represented by the path in the names name space. To support this
* use-case in a reasonably high-performance way, the path string is can be
* replaced by the object pointer to which that path would refer. In the spirit
* of the Config code where this use-case is most prominent, we refer to this
* object as the "context" for the names operation.
*
* You can think of the context roughly as the inode number of a directory file
* in Unix. The inode number can be used to look up the directory file which
* contains the list of file names defined at that directory level. Similarly
* the context is used to look up an internal name service entry which contains
* the names defined for that context.
*
* \param context A smart pointer to an object that is used in place of the path
* under which you want this new name to be defined.
* \param name A string containing a name to search for.
*
* \returns a smart pointer to the named object converted to the requested
* type.
*/
template <typename T>
static Ptr<T> Find (Ptr<Object> context, std::string name);
private:
/**
* \internal
*
* \brief Non-templated internal version of Names::Find
*
* \param name A string containing the path of the object to look for.
*
* \returns a smart pointer to the named object.
*/
static Ptr<Object> FindInternal (std::string path);
/**
* \internal
*
* \brief Non-templated internal version of Names::Find
*
* \param context A string containing the path to search for the object in.
* \param name A string containing the name of the object to look for.
*
* \returns a smart pointer to the named object.
*/
static Ptr<Object> FindInternal (std::string path, std::string name);
/**
* \internal
*
* \brief Non-templated internal version of Names::Find
*
* \param context A smart pointer to an object under which you want to look
* for the provided name.
* \param name A string containing the name to look for.
*
* \returns a smart pointer to the named object.
*/
static Ptr<Object> FindInternal (Ptr<Object> context, std::string name);
};
/**
* \brief Template definition of corresponding template declaration found in class Names.
*/
template <typename T>
Ptr<T>
Names::Find (std::string name)
{
Ptr<Object> obj = FindInternal (name);
if (obj)
{
return obj->GetObject<T> ();
}
else
{
return 0;
}
}
/**
* \brief Template definition of corresponding template declaration found in class Names.
*/
template <typename T>
Ptr<T>
Names::Find (std::string path, std::string name)
{
Ptr<Object> obj = FindInternal (path, name);
if (obj)
{
return obj->GetObject<T> ();
}
else
{
return 0;
}
}
/**
* \brief Template definition of corresponding template declaration found in class Names.
*/
template <typename T>
Ptr<T>
Names::Find (Ptr<Object> context, std::string name)
{
Ptr<Object> obj = FindInternal (context, name);
if (obj)
{
return obj->GetObject<T> ();
}
else
{
return 0;
}
}
} // namespace ns3
#endif /* OBJECT_NAMES_H */
| zy901002-gpsr | src/core/model/names.h | C++ | gpl2 | 20,768 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "boolean.h"
#include "fatal-error.h"
namespace ns3 {
BooleanValue::BooleanValue ()
: m_value (false)
{
}
BooleanValue::BooleanValue (bool value)
: m_value (value)
{
}
void
BooleanValue::Set (bool value)
{
m_value = value;
}
bool
BooleanValue::Get (void) const
{
return m_value;
}
BooleanValue::operator bool () const
{
return m_value;
}
std::ostream & operator << (std::ostream &os, const BooleanValue &value)
{
if (value.Get ())
{
os << "true";
}
else
{
os << "false";
}
return os;
}
Ptr<AttributeValue>
BooleanValue::Copy (void) const
{
return Create<BooleanValue> (*this);
}
std::string
BooleanValue::SerializeToString (Ptr<const AttributeChecker> checker) const
{
if (m_value)
{
return "true";
}
else
{
return "false";
}
}
bool
BooleanValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
{
if (value == "true" ||
value == "1" ||
value == "t")
{
m_value = true;
return true;
}
else if (value == "false" ||
value == "0" ||
value == "f")
{
m_value = false;
return true;
}
else
{
return false;
}
}
ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME (Boolean,"bool");
} // namespace ns3
| zy901002-gpsr | src/core/model/boolean.cc | C++ | gpl2 | 2,113 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef PTR_H
#define PTR_H
#include <iostream>
#include <stdint.h>
#include "assert.h"
namespace ns3 {
/**
* \ingroup core
* \defgroup ptr Smart Pointer
*/
/**
* \ingroup ptr
*
* \brief smart pointer class similar to boost::intrusive_ptr
*
* This smart-pointer class assumes that the underlying
* type provides a pair of Ref and Unref methods which are
* expected to increment and decrement the internal refcount
* of the object instance.
*
* This implementation allows you to manipulate the smart pointer
* as if it was a normal pointer: you can compare it with zero,
* compare it against other pointers, assign zero to it, etc.
*
* It is possible to extract the raw pointer from this
* smart pointer with the GetPointer and PeekPointer methods.
*
* If you want to store a newed object into a smart pointer,
* we recommend you to use the Create template functions
* to create the object and store it in a smart pointer to avoid
* memory leaks. These functions are really small convenience
* functions and their goal is just is save you a small
* bit of typing.
*/
template <typename T>
class Ptr
{
private:
T *m_ptr;
class Tester {
private:
void operator delete (void *);
};
friend class Ptr<const T>;
template <typename U>
friend U *GetPointer (const Ptr<U> &p);
template <typename U>
friend U *PeekPointer (const Ptr<U> &p);
inline void Acquire (void) const;
public:
/**
* Create an empty smart pointer
*/
Ptr ();
/**
* \param ptr raw pointer to manage
*
* Create a smart pointer which points to the object pointed to by
* the input raw pointer ptr. This method creates its own reference
* to the pointed object. The caller is responsible for Unref()'ing
* its own reference, and the smart pointer will eventually do the
* same, so that object is deleted if no more references to it
* remain.
*/
Ptr (T *ptr);
/**
* \param ptr raw pointer to manage
* \param ref if set to true, this method calls Ref, otherwise,
* it does not call Ref.
*
* Create a smart pointer which points to the object pointed to by
* the input raw pointer ptr.
*/
Ptr (T *ptr, bool ref);
Ptr (Ptr const&o);
// allow conversions from T to T const.
template <typename U>
Ptr (Ptr<U> const &o);
~Ptr ();
Ptr<T> &operator = (Ptr const& o);
T *operator -> () const;
T *operator -> ();
const T &operator * () const;
T &operator * ();
// allow if (!sp)
bool operator! ();
// allow if (sp)
// disable delete sp
operator Tester * () const;
};
template <typename T>
Ptr<T> Create (void);
template <typename T, typename T1>
Ptr<T> Create (T1 a1);
template <typename T, typename T1, typename T2>
Ptr<T> Create (T1 a1, T2 a2);
template <typename T, typename T1, typename T2, typename T3>
Ptr<T> Create (T1 a1, T2 a2, T3 a3);
template <typename T, typename T1, typename T2, typename T3, typename T4>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4);
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
/**
* \relates Ptr
* \param p smart pointer
* \return the pointer managed by this smart pointer.
*
* The underlying refcount is not incremented prior
* to returning to the caller so the caller is not
* responsible for calling Unref himself.
*/
template <typename T>
T * PeekPointer (const Ptr<T> &p);
/**
* \relates Ptr
* \param p smart pointer
* \return the pointer managed by this smart pointer.
*
* The underlying refcount is incremented prior
* to returning to the caller so the caller is
* responsible for calling Unref himself.
*/
template <typename T>
T * GetPointer (const Ptr<T> &p);
template <typename T>
std::ostream &operator << (std::ostream &, const Ptr<T> &p);
// allow if (sp == 0)
template <typename T1, typename T2>
bool operator == (Ptr<T1> const &lhs, T2 const *rhs);
// allow if (0 == sp)
template <typename T1, typename T2>
bool operator == (T1 const *lhs, Ptr<T2> &rhs);
// allow if (sp != 0)
template <typename T1, typename T2>
bool operator != (Ptr<T1> const &lhs, T2 const *rhs);
// allow if (0 != sp)
template <typename T1, typename T2>
bool operator != (T1 const *lhs, Ptr<T2> &rhs);
// allow if (sp0 == sp1)
template <typename T1, typename T2>
bool operator == (Ptr<T1> const &lhs, Ptr<T2> const &rhs);
// allow if (sp0 != sp1)
template <typename T1, typename T2>
bool operator != (Ptr<T1> const &lhs, Ptr<T2> const &rhs);
template <typename T1, typename T2>
Ptr<T1> const_pointer_cast (Ptr<T2> const&p);
template <typename T>
struct CallbackTraits;
template <typename T>
struct CallbackTraits<Ptr<T> >
{
static T & GetReference (Ptr<T> const p)
{
return *PeekPointer (p);
}
};
template <typename T>
struct EventMemberImplObjTraits;
template <typename T>
struct EventMemberImplObjTraits<Ptr<T> >
{
static T &GetReference (Ptr<T> p) {
return *PeekPointer (p);
}
};
} // namespace ns3
namespace ns3 {
/*************************************************
* friend non-member function implementations
************************************************/
template <typename T>
Ptr<T> Create (void)
{
return Ptr<T> (new T (), false);
}
template <typename T, typename T1>
Ptr<T> Create (T1 a1)
{
return Ptr<T> (new T (a1), false);
}
template <typename T, typename T1, typename T2>
Ptr<T> Create (T1 a1, T2 a2)
{
return Ptr<T> (new T (a1, a2), false);
}
template <typename T, typename T1, typename T2, typename T3>
Ptr<T> Create (T1 a1, T2 a2, T3 a3)
{
return Ptr<T> (new T (a1, a2, a3), false);
}
template <typename T, typename T1, typename T2, typename T3, typename T4>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4)
{
return Ptr<T> (new T (a1, a2, a3, a4), false);
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
{
return Ptr<T> (new T (a1, a2, a3, a4, a5), false);
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
{
return Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false);
}
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
{
return Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false);
}
template <typename T>
T * PeekPointer (const Ptr<T> &p)
{
return p.m_ptr;
}
template <typename T>
T * GetPointer (const Ptr<T> &p)
{
p.Acquire ();
return p.m_ptr;
}
template <typename T>
std::ostream &operator << (std::ostream &os, const Ptr<T> &p)
{
os << PeekPointer (p);
return os;
}
template <typename T1, typename T2>
bool
operator == (Ptr<T1> const &lhs, T2 const *rhs)
{
return PeekPointer (lhs) == rhs;
}
template <typename T1, typename T2>
bool
operator == (T1 const *lhs, Ptr<T2> &rhs)
{
return lhs == PeekPointer (rhs);
}
template <typename T1, typename T2>
bool
operator != (Ptr<T1> const &lhs, T2 const *rhs)
{
return PeekPointer (lhs) != rhs;
}
template <typename T1, typename T2>
bool
operator != (T1 const *lhs, Ptr<T2> &rhs)
{
return lhs != PeekPointer (rhs);
}
template <typename T1, typename T2>
bool
operator == (Ptr<T1> const &lhs, Ptr<T2> const &rhs)
{
return PeekPointer (lhs) == PeekPointer (rhs);
}
template <typename T1, typename T2>
bool
operator != (Ptr<T1> const &lhs, Ptr<T2> const &rhs)
{
return PeekPointer (lhs) != PeekPointer (rhs);
}
template <typename T>
bool operator < (const Ptr<T> &lhs, const Ptr<T> &rhs)
{
return PeekPointer<T> (lhs) < PeekPointer<T> (rhs);
}
template <typename T>
bool operator <= (const Ptr<T> &lhs, const Ptr<T> &rhs)
{
return PeekPointer<T> (lhs) <= PeekPointer<T> (rhs);
}
template <typename T>
bool operator > (const Ptr<T> &lhs, const Ptr<T> &rhs)
{
return PeekPointer<T> (lhs) > PeekPointer<T> (rhs);
}
template <typename T>
bool operator >= (const Ptr<T> &lhs, const Ptr<T> &rhs)
{
return PeekPointer<T> (lhs) >= PeekPointer<T> (rhs);
}
template <typename T1, typename T2>
Ptr<T1>
ConstCast (Ptr<T2> const&p)
{
return Ptr<T1> (const_cast<T1 *> (PeekPointer (p)));
}
template <typename T1, typename T2>
Ptr<T1>
DynamicCast (Ptr<T2> const&p)
{
return Ptr<T1> (dynamic_cast<T1 *> (PeekPointer (p)));
}
template <typename T1, typename T2>
Ptr<T1>
StaticCast (Ptr<T2> const&p)
{
return Ptr<T1> (static_cast<T1 *> (PeekPointer (p)));
}
template <typename T>
Ptr<T> Copy (Ptr<T> object)
{
Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
return p;
}
template <typename T>
Ptr<T> Copy (Ptr<const T> object)
{
Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
return p;
}
/****************************************************
* Member method implementations.
***************************************************/
template <typename T>
void
Ptr<T>::Acquire (void) const
{
if (m_ptr != 0)
{
m_ptr->Ref ();
}
}
template <typename T>
Ptr<T>::Ptr ()
: m_ptr (0)
{
}
template <typename T>
Ptr<T>::Ptr (T *ptr)
: m_ptr (ptr)
{
Acquire ();
}
template <typename T>
Ptr<T>::Ptr (T *ptr, bool ref)
: m_ptr (ptr)
{
if (ref)
{
Acquire ();
}
}
template <typename T>
Ptr<T>::Ptr (Ptr const&o)
: m_ptr (PeekPointer (o))
{
Acquire ();
}
template <typename T>
template <typename U>
Ptr<T>::Ptr (Ptr<U> const &o)
: m_ptr (PeekPointer (o))
{
Acquire ();
}
template <typename T>
Ptr<T>::~Ptr ()
{
if (m_ptr != 0)
{
m_ptr->Unref ();
}
}
template <typename T>
Ptr<T> &
Ptr<T>::operator = (Ptr const& o)
{
if (&o == this)
{
return *this;
}
if (m_ptr != 0)
{
m_ptr->Unref ();
}
m_ptr = o.m_ptr;
Acquire ();
return *this;
}
template <typename T>
T *
Ptr<T>::operator -> ()
{
return m_ptr;
}
template <typename T>
T *
Ptr<T>::operator -> () const
{
return m_ptr;
}
template <typename T>
const T &
Ptr<T>::operator * () const
{
return *m_ptr;
}
template <typename T>
T &
Ptr<T>::operator * ()
{
return *m_ptr;
}
template <typename T>
bool
Ptr<T>::operator! ()
{
return m_ptr == 0;
}
template <typename T>
Ptr<T>::operator Tester * () const
{
if (m_ptr == 0)
{
return 0;
}
static Tester test;
return &test;
}
} // namespace ns3
#endif /* PTR_H */
| zy901002-gpsr | src/core/model/ptr.h | C++ | gpl2 | 11,505 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INESC Porto, INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Gustavo Carneiro <gjc@inescporto.pt>
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef BREAKPOINT_H
#define BREAKPOINT_H
namespace ns3 {
/* Hacker macro to place breakpoints for selected machines.
* Actual use is strongly discouraged of course ;)
* Copied from GLib 2.12.9.
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
/**
* \ingroup debugging
*
* Inserts a breakpoint instruction (or equivalent system call) into
* the code for selected machines. When an NS_ASSERT cannot verify its condition,
* this macro is used. Falls back to calling
* AssertBreakpoint() for architectures where breakpoint assembly
* instructions are not supported.
*/
#if (defined (__i386__) || defined (__amd64__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2
# define NS_BREAKPOINT() \
do { __asm__ __volatile__ ("int $03"); } while(false)
#elif defined (_MSC_VER) && defined (_M_IX86)
# define NS_BREAKPOINT() \
do { __asm int 3h } while(false)
#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2
# define NS_BREAKPOINT() \
do { __asm__ __volatile__ ("bpt"); } while(false)
#else /* !__i386__ && !__alpha__ */
# define NS_BREAKPOINT() ns3::BreakpointFallback ()
#endif
/**
* \brief fallback breakpoint function
*
* This function is used by the NS_BREAKPOINT() macro as a fallback
* for when breakpoint assembly instructions are not available. It
* attempts to halt program execution either by a raising SIGTRAP, on
* unix systems, or by dereferencing a null pointer.
*
* Normally you should not call this function directly.
*/
void BreakpointFallback (void);
} // namespace ns3
#endif /* BREAKPOINT_H */
| zy901002-gpsr | src/core/model/breakpoint.h | C++ | gpl2 | 2,758 |
#ifndef MAKE_EVENT_H
#define MAKE_EVENT_H
namespace ns3 {
class EventImpl;
template <typename MEM, typename OBJ>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj);
template <typename MEM, typename OBJ,
typename T1>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1);
template <typename MEM, typename OBJ,
typename T1, typename T2>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
template <typename MEM, typename OBJ,
typename T1, typename T2, typename T3>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
template <typename MEM, typename OBJ,
typename T1, typename T2, typename T3, typename T4>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
template <typename MEM, typename OBJ,
typename T1, typename T2, typename T3, typename T4, typename T5>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
EventImpl * MakeEvent (void (*f)(void));
template <typename U1,
typename T1>
EventImpl * MakeEvent (void (*f)(U1), T1 a1);
template <typename U1, typename U2,
typename T1, typename T2>
EventImpl * MakeEvent (void (*f)(U1,U2), T1 a1, T2 a2);
template <typename U1, typename U2, typename U3,
typename T1, typename T2, typename T3>
EventImpl * MakeEvent (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
template <typename U1, typename U2, typename U3, typename U4,
typename T1, typename T2, typename T3, typename T4>
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
template <typename U1, typename U2, typename U3, typename U4, typename U5,
typename T1, typename T2, typename T3, typename T4, typename T5>
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
} // namespace ns3
/********************************************************************
Implementation of templates defined above
********************************************************************/
#include "event-impl.h"
#include "type-traits.h"
namespace ns3 {
template <typename T>
struct EventMemberImplObjTraits;
template <typename T>
struct EventMemberImplObjTraits<T *>
{
static T &GetReference (T *p)
{
return *p;
}
};
template <typename MEM, typename OBJ>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj)
{
// zero argument version
class EventMemberImpl0 : public EventImpl
{
public:
EventMemberImpl0 (OBJ obj, MEM function)
: m_obj (obj),
m_function (function)
{
}
virtual ~EventMemberImpl0 ()
{
}
private:
virtual void Notify (void)
{
(EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)();
}
OBJ m_obj;
MEM m_function;
} *ev = new EventMemberImpl0 (obj, mem_ptr);
return ev;
}
template <typename MEM, typename OBJ,
typename T1>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1)
{
// one argument version
class EventMemberImpl1 : public EventImpl
{
public:
EventMemberImpl1 (OBJ obj, MEM function, T1 a1)
: m_obj (obj),
m_function (function),
m_a1 (a1)
{
}
protected:
virtual ~EventMemberImpl1 ()
{
}
private:
virtual void Notify (void)
{
(EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1);
}
OBJ m_obj;
MEM m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
} *ev = new EventMemberImpl1 (obj, mem_ptr, a1);
return ev;
}
template <typename MEM, typename OBJ,
typename T1, typename T2>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
{
// two argument version
class EventMemberImpl2 : public EventImpl
{
public:
EventMemberImpl2 (OBJ obj, MEM function, T1 a1, T2 a2)
: m_obj (obj),
m_function (function),
m_a1 (a1),
m_a2 (a2)
{
}
protected:
virtual ~EventMemberImpl2 ()
{
}
private:
virtual void Notify (void)
{
(EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2);
}
OBJ m_obj;
MEM m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
} *ev = new EventMemberImpl2 (obj, mem_ptr, a1, a2);
return ev;
}
template <typename MEM, typename OBJ,
typename T1, typename T2, typename T3>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
{
// three argument version
class EventMemberImpl3 : public EventImpl
{
public:
EventMemberImpl3 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3)
: m_obj (obj),
m_function (function),
m_a1 (a1),
m_a2 (a2),
m_a3 (a3)
{
}
protected:
virtual ~EventMemberImpl3 ()
{
}
private:
virtual void Notify (void)
{
(EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3);
}
OBJ m_obj;
MEM m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
typename TypeTraits<T3>::ReferencedType m_a3;
} *ev = new EventMemberImpl3 (obj, mem_ptr, a1, a2, a3);
return ev;
}
template <typename MEM, typename OBJ,
typename T1, typename T2, typename T3, typename T4>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
{
// four argument version
class EventMemberImpl4 : public EventImpl
{
public:
EventMemberImpl4 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4)
: m_obj (obj),
m_function (function),
m_a1 (a1),
m_a2 (a2),
m_a3 (a3),
m_a4 (a4)
{
}
protected:
virtual ~EventMemberImpl4 ()
{
}
private:
virtual void Notify (void)
{
(EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4);
}
OBJ m_obj;
MEM m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
typename TypeTraits<T3>::ReferencedType m_a3;
typename TypeTraits<T4>::ReferencedType m_a4;
} *ev = new EventMemberImpl4 (obj, mem_ptr, a1, a2, a3, a4);
return ev;
}
template <typename MEM, typename OBJ,
typename T1, typename T2, typename T3, typename T4, typename T5>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
{
// five argument version
class EventMemberImpl5 : public EventImpl
{
public:
EventMemberImpl5 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
: m_obj (obj),
m_function (function),
m_a1 (a1),
m_a2 (a2),
m_a3 (a3),
m_a4 (a4),
m_a5 (a5)
{
}
protected:
virtual ~EventMemberImpl5 ()
{
}
private:
virtual void Notify (void)
{
(EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5);
}
OBJ m_obj;
MEM m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
typename TypeTraits<T3>::ReferencedType m_a3;
typename TypeTraits<T4>::ReferencedType m_a4;
typename TypeTraits<T5>::ReferencedType m_a5;
} *ev = new EventMemberImpl5 (obj, mem_ptr, a1, a2, a3, a4, a5);
return ev;
}
template <typename U1, typename T1>
EventImpl * MakeEvent (void (*f)(U1), T1 a1)
{
// one arg version
class EventFunctionImpl1 : public EventImpl
{
public:
typedef void (*F)(U1);
EventFunctionImpl1 (F function, T1 a1)
: m_function (function),
m_a1 (a1)
{
}
protected:
virtual ~EventFunctionImpl1 ()
{
}
private:
virtual void Notify (void)
{
(*m_function)(m_a1);
}
F m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
} *ev = new EventFunctionImpl1 (f, a1);
return ev;
}
template <typename U1, typename U2, typename T1, typename T2>
EventImpl * MakeEvent (void (*f)(U1,U2), T1 a1, T2 a2)
{
// two arg version
class EventFunctionImpl2 : public EventImpl
{
public:
typedef void (*F)(U1, U2);
EventFunctionImpl2 (F function, T1 a1, T2 a2)
: m_function (function),
m_a1 (a1),
m_a2 (a2)
{
}
protected:
virtual ~EventFunctionImpl2 ()
{
}
private:
virtual void Notify (void)
{
(*m_function)(m_a1, m_a2);
}
F m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
} *ev = new EventFunctionImpl2 (f, a1, a2);
return ev;
}
template <typename U1, typename U2, typename U3,
typename T1, typename T2, typename T3>
EventImpl * MakeEvent (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
{
// three arg version
class EventFunctionImpl3 : public EventImpl
{
public:
typedef void (*F)(U1, U2, U3);
EventFunctionImpl3 (F function, T1 a1, T2 a2, T3 a3)
: m_function (function),
m_a1 (a1),
m_a2 (a2),
m_a3 (a3)
{
}
protected:
virtual ~EventFunctionImpl3 ()
{
}
private:
virtual void Notify (void)
{
(*m_function)(m_a1, m_a2, m_a3);
}
F m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
typename TypeTraits<T3>::ReferencedType m_a3;
} *ev = new EventFunctionImpl3 (f, a1, a2, a3);
return ev;
}
template <typename U1, typename U2, typename U3, typename U4,
typename T1, typename T2, typename T3, typename T4>
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
{
// four arg version
class EventFunctionImpl4 : public EventImpl
{
public:
typedef void (*F)(U1, U2, U3, U4);
EventFunctionImpl4 (F function, T1 a1, T2 a2, T3 a3, T4 a4)
: m_function (function),
m_a1 (a1),
m_a2 (a2),
m_a3 (a3),
m_a4 (a4)
{
}
protected:
virtual ~EventFunctionImpl4 ()
{
}
private:
virtual void Notify (void)
{
(*m_function)(m_a1, m_a2, m_a3, m_a4);
}
F m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
typename TypeTraits<T3>::ReferencedType m_a3;
typename TypeTraits<T4>::ReferencedType m_a4;
} *ev = new EventFunctionImpl4 (f, a1, a2, a3, a4);
return ev;
}
template <typename U1, typename U2, typename U3, typename U4, typename U5,
typename T1, typename T2, typename T3, typename T4, typename T5>
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
{
// five arg version
class EventFunctionImpl5 : public EventImpl
{
public:
typedef void (*F)(U1,U2,U3,U4,U5);
EventFunctionImpl5 (F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
: m_function (function),
m_a1 (a1),
m_a2 (a2),
m_a3 (a3),
m_a4 (a4),
m_a5 (a5)
{
}
protected:
virtual ~EventFunctionImpl5 ()
{
}
private:
virtual void Notify (void)
{
(*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5);
}
F m_function;
typename TypeTraits<T1>::ReferencedType m_a1;
typename TypeTraits<T2>::ReferencedType m_a2;
typename TypeTraits<T3>::ReferencedType m_a3;
typename TypeTraits<T4>::ReferencedType m_a4;
typename TypeTraits<T5>::ReferencedType m_a5;
} *ev = new EventFunctionImpl5 (f, a1, a2, a3, a4, a5);
return ev;
}
} // namespace ns3
#endif /* MAKE_EVENT_H */
| zy901002-gpsr | src/core/model/make-event.h | C++ | gpl2 | 11,382 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA, 2010 NICTA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Quincy Tse <quincy.tse@nicta.com.au>
*/
#ifndef NS3_FATAL_ERROR_H
#define NS3_FATAL_ERROR_H
#include <iostream>
#include <exception>
#include <cstdlib>
#include "fatal-impl.h"
/**
* \ingroup debugging
* \brief fatal error handling
*
* When this macro is hit at runtime, details of filename
* and line number is printed to stderr, and the program
* is halted by calling std::terminate(). This will
* trigger any clean up code registered by
* std::set_terminate (NS3 default is a stream-flushing
* code), but may be overridden.
*
* This macro is enabled unconditionally in all builds,
* including debug and optimized builds.
*/
#define NS_FATAL_ERROR_NO_MSG() \
do \
{ \
std::cerr << "file=" << __FILE__ << ", line=" << \
__LINE__ << std::endl; \
::ns3::FatalImpl::FlushStreams (); \
std::terminate (); \
} \
while (false)
/**
* \ingroup debugging
* \brief fatal error handling
*
* \param msg message to output when this macro is hit.
*
* When this macro is hit at runtime, the user-specified
* error message is printed to stderr, followed by a call
* to the NS_FATAL_ERROR_NO_MSG() macro which prints the
* details of filename and line number to stderr. The
* program will be halted by calling std::terminate(),
* triggering any clean up code registered by
* std::set_terminate (NS3 default is a stream-flushing
* code, but may be overridden).
*
* This macro is enabled unconditionally in all builds,
* including debug and optimized builds.
*/
#define NS_FATAL_ERROR(msg) \
do \
{ \
std::cerr << "msg=\"" << msg << "\", "; \
NS_FATAL_ERROR_NO_MSG (); \
} \
while (false)
#endif /* FATAL_ERROR_H */
| zy901002-gpsr | src/core/model/fatal-error.h | C++ | gpl2 | 3,003 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef LOG_H
#define LOG_H
#include <string>
#include <iostream>
#include <stdint.h>
namespace ns3 {
enum LogLevel {
LOG_NONE = 0x00000000, // no logging
LOG_ERROR = 0x00000001, // serious error messages only
LOG_LEVEL_ERROR = 0x00000001,
LOG_WARN = 0x00000002, // warning messages
LOG_LEVEL_WARN = 0x00000003,
LOG_DEBUG = 0x00000004, // rare ad-hoc debug messages
LOG_LEVEL_DEBUG = 0x00000007,
LOG_INFO = 0x00000008, // informational messages (e.g., banners)
LOG_LEVEL_INFO = 0x0000000f,
LOG_FUNCTION = 0x00000010, // function tracing
LOG_LEVEL_FUNCTION = 0x0000001f,
LOG_LOGIC = 0x00000020, // control flow tracing within functions
LOG_LEVEL_LOGIC = 0x0000003f,
LOG_ALL = 0x1fffffff, // print everything
LOG_LEVEL_ALL = LOG_ALL,
LOG_PREFIX_FUNC = 0x80000000, // prefix all trace prints with function
LOG_PREFIX_TIME = 0x40000000, // prefix all trace prints with simulation time
LOG_PREFIX_NODE = 0x20000000 // prefix all trace prints with simulation node
};
/**
* \param name a log component name
* \param level a logging level
* \ingroup logging
*
* Enable the logging output associated with that log component.
* The logging output can be later disabled with a call
* to ns3::LogComponentDisable.
*
* Same as running your program with the NS_LOG environment
* variable set as NS_LOG='name=level'
*/
void LogComponentEnable (char const *name, enum LogLevel level);
/**
* \param level a logging level
* \ingroup logging
*
* Enable the logging output for all registered log components.
*
* Same as running your program with the NS_LOG environment
* variable set as NS_LOG='*=level'
*/
void LogComponentEnableAll (enum LogLevel level);
/**
* \param name a log component name
* \param level a logging level
* \ingroup logging
*
* Disable the logging output associated with that log component.
* The logging output can be later re-enabled with a call
* to ns3::LogComponentEnable.
*/
void LogComponentDisable (char const *name, enum LogLevel level);
/**
* \param level a logging level
* \ingroup logging
*
* Disable all logging for all components.
*/
void LogComponentDisableAll (enum LogLevel level);
} // namespace ns3
/**
* \ingroup logging
* \param name a string
*
* Define a Log component with a specific name. This macro
* should be used at the top of every file in which you want
* to use the NS_LOG macro. This macro defines a new
* "log component" which can be later selectively enabled
* or disabled with the ns3::LogComponentEnable and
* ns3::LogComponentDisable functions or with the NS_LOG
* environment variable.
*/
#define NS_LOG_COMPONENT_DEFINE(name) \
static ns3::LogComponent g_log = ns3::LogComponent (name)
#define NS_LOG_APPEND_TIME_PREFIX \
if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) \
{ \
ns3::LogTimePrinter printer = ns3::LogGetTimePrinter (); \
if (printer != 0) \
{ \
(*printer)(std::clog); \
std::clog << " "; \
} \
}
#define NS_LOG_APPEND_NODE_PREFIX \
if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE)) \
{ \
ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); \
if (printer != 0) \
{ \
(*printer)(std::clog); \
std::clog << " "; \
} \
}
#define NS_LOG_APPEND_FUNC_PREFIX \
if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) \
{ \
std::clog << g_log.Name () << ":" << \
__FUNCTION__ << "(): "; \
} \
#ifndef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT
#endif /* NS_LOG_APPEND_CONTEXT */
#ifdef NS3_LOG_ENABLE
/**
* \ingroup debugging
* \defgroup logging Logging
* \brief Logging functions and macros
*
* LOG functionality: macros which allow developers to
* send information out on screen. All logging messages
* are disabled by default. To enable selected logging
* messages, use the ns3::LogComponentEnable
* function or use the NS_LOG environment variable
*
* Use the environment variable NS_LOG to define a ':'-separated list of
* logging components to enable. For example (using bash syntax),
* NS_LOG="OlsrAgent" would enable one component at all log levels.
* NS_LOG="OlsrAgent:Ipv4L3Protocol" would enable two components,
* at all log levels, etc.
* NS_LOG="*" will enable all available log components at all levels.
*
* To control more selectively the log levels for each component, use
* this syntax: NS_LOG='Component1=func|warn:Component2=error|debug'
* This example would enable the 'func', and 'warn' log
* levels for 'Component1' and the 'error' and 'debug' log levels
* for 'Component2'. The wildcard can be used here as well. For example
* NS_LOG='*=level_all|prefix' would enable all log levels and prefix all
* prints with the component and function names.
*/
/**
* \ingroup logging
* \param level the log level
* \param msg the message to log
*
* This macro allows you to log an arbitrary message at a specific
* log level. The log message is expected to be a C++ ostream
* message such as "my string" << aNumber << "my oth stream".
*
* Typical usage looks like:
* \code
* NS_LOG (LOG_DEBUG, "a number="<<aNumber<<", anotherNumber="<<anotherNumber);
* \endcode
*/
#define NS_LOG(level, msg) \
do \
{ \
if (g_log.IsEnabled (level)) \
{ \
NS_LOG_APPEND_TIME_PREFIX; \
NS_LOG_APPEND_NODE_PREFIX; \
NS_LOG_APPEND_CONTEXT; \
NS_LOG_APPEND_FUNC_PREFIX; \
std::clog << msg << std::endl; \
} \
} \
while (false)
/**
* \ingroup logging
* \param msg the message to log
*
* Use \ref NS_LOG to output a message of level LOG_ERROR.
*/
#define NS_LOG_ERROR(msg) \
NS_LOG (ns3::LOG_ERROR, msg)
/**
* \ingroup logging
* \param msg the message to log
*
* Use \ref NS_LOG to output a message of level LOG_WARN.
*/
#define NS_LOG_WARN(msg) \
NS_LOG (ns3::LOG_WARN, msg)
/**
* \ingroup logging
* \param msg the message to log
*
* Use \ref NS_LOG to output a message of level LOG_DEBUG.
*/
#define NS_LOG_DEBUG(msg) \
NS_LOG (ns3::LOG_DEBUG, msg)
/**
* \ingroup logging
* \param msg the message to log
*
* Use \ref NS_LOG to output a message of level LOG_INFO.
*/
#define NS_LOG_INFO(msg) \
NS_LOG (ns3::LOG_INFO, msg)
/**
* \ingroup logging
*
* Output the name of the function.
*/
#define NS_LOG_FUNCTION_NOARGS() \
do \
{ \
if (g_log.IsEnabled (ns3::LOG_FUNCTION)) \
{ \
NS_LOG_APPEND_TIME_PREFIX; \
NS_LOG_APPEND_NODE_PREFIX; \
NS_LOG_APPEND_CONTEXT; \
std::clog << g_log.Name () << ":" \
<< __FUNCTION__ << "()" << std::endl; \
} \
} \
while (false)
/**
* \ingroup logging
* \param parameters the parameters to output.
*
* If log level LOG_FUNCTION is enabled, this macro will output
* all input parameters separated by ", ".
*
* Typical usage looks like:
* \code
* NS_LOG_FUNCTION (aNumber<<anotherNumber);
* \endcode
* And the output will look like:
* \code
* Component:Function (aNumber, anotherNumber)
* \endcode
*/
#define NS_LOG_FUNCTION(parameters) \
do \
{ \
if (g_log.IsEnabled (ns3::LOG_FUNCTION)) \
{ \
NS_LOG_APPEND_TIME_PREFIX; \
NS_LOG_APPEND_NODE_PREFIX; \
NS_LOG_APPEND_CONTEXT; \
std::clog << g_log.Name () << ":" \
<< __FUNCTION__ << "("; \
ns3::ParameterLogger (std::clog) << parameters; \
std::clog << ")" << std::endl; \
} \
} \
while (false)
/**
* \ingroup logging
* \param msg the message to log
*
* Use \ref NS_LOG to output a message of level LOG_LOGIC
*/
#define NS_LOG_LOGIC(msg) \
NS_LOG (ns3::LOG_LOGIC, msg)
/**
* \ingroup logging
* \param msg the message to log
*
* Output the requested message unconditionaly.
*/
#define NS_LOG_UNCOND(msg) \
do \
{ \
std::clog << msg << std::endl; \
} \
while (false)
#else /* LOG_ENABLE */
#define NS_LOG(level, msg)
#define NS_LOG_ERROR(msg)
#define NS_LOG_WARN(msg)
#define NS_LOG_DEBUG(msg)
#define NS_LOG_INFO(msg)
#define NS_LOG_FUNCTION_NOARGS()
#define NS_LOG_FUNCTION(msg)
#define NS_LOG_LOGIC(msg)
#define NS_LOG_UNCOND(msg)
#endif /* LOG_ENABLE */
namespace ns3 {
/**
* \ingroup logging
*
* Print the list of logging messages available.
* Same as running your program with the NS_LOG environment
* variable set as NS_LOG=print-list
*/
void LogComponentPrintList (void);
typedef void (*LogTimePrinter)(std::ostream &os);
typedef void (*LogNodePrinter)(std::ostream &os);
void LogSetTimePrinter (LogTimePrinter);
LogTimePrinter LogGetTimePrinter (void);
void LogSetNodePrinter (LogNodePrinter);
LogNodePrinter LogGetNodePrinter (void);
class LogComponent {
public:
LogComponent (char const *name);
void EnvVarCheck (char const *name);
bool IsEnabled (enum LogLevel level) const;
bool IsNoneEnabled (void) const;
void Enable (enum LogLevel level);
void Disable (enum LogLevel level);
char const *Name (void) const;
private:
int32_t m_levels;
char const *m_name;
};
class ParameterLogger : public std::ostream
{
int m_itemNumber;
std::ostream &m_os;
public:
ParameterLogger (std::ostream &os);
template<typename T>
ParameterLogger& operator<< (T param)
{
switch (m_itemNumber)
{
case 0: // first parameter
m_os << param;
break;
default: // parameter following a previous parameter
m_os << ", " << param;
break;
}
m_itemNumber++;
return *this;
}
};
} // namespace ns3
#endif /* LOG_H */
| zy901002-gpsr | src/core/model/log.h | C++ | gpl2 | 12,931 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef TRACED_CALLBACK_H
#define TRACED_CALLBACK_H
#include <list>
#include "callback.h"
namespace ns3 {
/**
* \brief forward calls to a chain of Callback
* \ingroup tracing
*
* An ns3::TracedCallback has almost exactly the same API as a normal ns3::Callback but
* instead of forwarding calls to a single function (as an ns3::Callback normally does),
* it forwards calls to a chain of ns3::Callback. TracedCallback::Connect adds a ns3::Callback
* at the end of the chain of callbacks. TracedCallback::Disconnect removes a ns3::Callback from
* the chain of callbacks.
*/
template<typename T1 = empty, typename T2 = empty,
typename T3 = empty, typename T4 = empty,
typename T5 = empty, typename T6 = empty,
typename T7 = empty, typename T8 = empty>
class TracedCallback
{
public:
TracedCallback ();
/**
* \param callback callback to add to chain of callbacks
*
* Append the input callback to the end of the internal list
* of ns3::Callback.
*/
void ConnectWithoutContext (const CallbackBase & callback);
/**
* \param callback callback to add to chain of callbacks
* \param path the path to send back to the user callback.
*
* Append the input callback to the end of the internal list
* of ns3::Callback. This method also will make sure that the
* input path specified by the user will be give back to the
* user's callback as its first argument.
*/
void Connect (const CallbackBase & callback, std::string path);
/**
* \param callback callback to remove from the chain of callbacks.
*
* Remove the input callback from the internal list
* of ns3::Callback. This method is really the symmetric
* of the TracedCallback::ConnectWithoutContext method.
*/
void DisconnectWithoutContext (const CallbackBase & callback);
/**
* \param callback callback to remove from the chain of callbacks.
* \param path the path which is sent back to the user callback.
*
* Remove the input callback which has a matching path as first argument
* from the internal list of ns3::Callback. This method is really the symmetric
* of the TracedCallback::Connect method.
*/
void Disconnect (const CallbackBase & callback, std::string path);
void operator() (void) const;
void operator() (T1 a1) const;
void operator() (T1 a1, T2 a2) const;
void operator() (T1 a1, T2 a2, T3 a3) const;
void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const;
void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const;
void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) const;
void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) const;
void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) const;
private:
typedef std::list<Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> > CallbackList;
CallbackList m_callbackList;
};
} // namespace ns3
// implementation below.
namespace ns3 {
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::TracedCallback ()
: m_callbackList ()
{
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::ConnectWithoutContext (const CallbackBase & callback)
{
Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> cb;
cb.Assign (callback);
m_callbackList.push_back (cb);
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::Connect (const CallbackBase & callback, std::string path)
{
Callback<void,std::string,T1,T2,T3,T4,T5,T6,T7,T8> cb;
cb.Assign (callback);
Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> realCb = cb.Bind (path);
m_callbackList.push_back (realCb);
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::DisconnectWithoutContext (const CallbackBase & callback)
{
for (typename CallbackList::iterator i = m_callbackList.begin ();
i != m_callbackList.end (); /* empty */)
{
if ((*i).IsEqual (callback))
{
i = m_callbackList.erase (i);
}
else
{
i++;
}
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::Disconnect (const CallbackBase & callback, std::string path)
{
Callback<void,std::string,T1,T2,T3,T4,T5,T6,T7,T8> cb;
cb.Assign (callback);
Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> realCb = cb.Bind (path);
DisconnectWithoutContext (realCb);
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (void) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)();
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2, a3);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2, a3, a4);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2, a3, a4, a5);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2, a3, a4, a5, a6);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2, a3, a4, a5, a6, a7);
}
}
template<typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8>
void
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) const
{
for (typename CallbackList::const_iterator i = m_callbackList.begin ();
i != m_callbackList.end (); i++)
{
(*i)(a1, a2, a3, a4, a5, a6, a7, a8);
}
}
} // namespace ns3
#endif /* TRACED_CALLBACK_H */
| zy901002-gpsr | src/core/model/traced-callback.h | C++ | gpl2 | 9,300 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "global-value.h"
#include "fatal-error.h"
#include "attribute.h"
#include "string.h"
#include "uinteger.h"
#include "ns3/core-config.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
namespace ns3 {
GlobalValue::GlobalValue (std::string name, std::string help,
const AttributeValue &initialValue,
Ptr<const AttributeChecker> checker)
: m_name (name),
m_help (help),
m_initialValue (0),
m_currentValue (0),
m_checker (checker)
{
if (m_checker == 0)
{
NS_FATAL_ERROR ("Checker should not be zero.");
}
m_initialValue = m_checker->CreateValidValue (initialValue);
m_currentValue = m_initialValue;
if (m_initialValue == 0)
{
NS_FATAL_ERROR ("Value set by user is invalid.");
}
GetVector ()->push_back (this);
InitializeFromEnv ();
}
void
GlobalValue::InitializeFromEnv (void)
{
#ifdef HAVE_GETENV
char *envVar = getenv ("NS_GLOBAL_VALUE");
if (envVar == 0)
{
return;
}
std::string env = std::string (envVar);
std::string::size_type cur = 0;
std::string::size_type next = 0;
while (next != std::string::npos)
{
next = env.find (";", cur);
std::string tmp = std::string (env, cur, next-cur);
std::string::size_type equal = tmp.find ("=");
if (equal != std::string::npos)
{
std::string name = tmp.substr (0, equal);
std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
if (name == m_name)
{
Ptr<AttributeValue> v = m_checker->CreateValidValue (StringValue (value));
if (v != 0)
{
m_initialValue = v;
m_currentValue = v;
}
return;
}
}
cur = next + 1;
}
#endif /* HAVE_GETENV */
}
std::string
GlobalValue::GetName (void) const
{
return m_name;
}
std::string
GlobalValue::GetHelp (void) const
{
return m_help;
}
void
GlobalValue::GetValue (AttributeValue &value) const
{
bool ok = m_checker->Copy (*m_currentValue, value);
if (ok)
{
return;
}
StringValue *str = dynamic_cast<StringValue *> (&value);
if (str == 0)
{
NS_FATAL_ERROR ("GlobalValue name="<<m_name<<": input value is not a string");
}
str->Set (m_currentValue->SerializeToString (m_checker));
}
Ptr<const AttributeChecker>
GlobalValue::GetChecker (void) const
{
return m_checker;
}
bool
GlobalValue::SetValue (const AttributeValue &value)
{
Ptr<AttributeValue> v = m_checker->CreateValidValue (value);
if (v == 0)
{
return 0;
}
m_currentValue = v;
return true;
}
void
GlobalValue::Bind (std::string name, const AttributeValue &value)
{
for (Iterator i = Begin (); i != End (); i++)
{
if ((*i)->GetName () == name)
{
if (!(*i)->SetValue (value))
{
NS_FATAL_ERROR ("Invalid new value for global value: "<<name);
}
return;
}
}
NS_FATAL_ERROR ("Non-existant global value: "<<name);
}
bool
GlobalValue::BindFailSafe (std::string name, const AttributeValue &value)
{
for (Iterator i = Begin (); i != End (); i++)
{
if ((*i)->GetName () == name)
{
return (*i)->SetValue (value);
}
}
return false;
}
GlobalValue::Iterator
GlobalValue::Begin (void)
{
return GetVector ()->begin ();
}
GlobalValue::Iterator
GlobalValue::End (void)
{
return GetVector ()->end ();
}
void
GlobalValue::ResetInitialValue (void)
{
m_currentValue = m_initialValue;
}
bool
GlobalValue::GetValueByNameFailSafe (std::string name, AttributeValue &value)
{
for (GlobalValue::Iterator gvit = GlobalValue::Begin (); gvit != GlobalValue::End (); ++gvit)
{
if ((*gvit)->GetName () == name)
{
(*gvit)->GetValue (value);
return true;
}
}
return false; // not found
}
void
GlobalValue::GetValueByName (std::string name, AttributeValue &value)
{
if (!GetValueByNameFailSafe (name, value))
{
NS_FATAL_ERROR ("Could not find GlobalValue named \"" << name << "\"");
}
}
GlobalValue::Vector *
GlobalValue::GetVector (void)
{
static Vector vector;
return &vector;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/global-value.cc | C++ | gpl2 | 5,083 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* Copyright (c) 2005 Mathieu Lacage
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*
*/
#include "heap-scheduler.h"
#include "event-impl.h"
#include "assert.h"
#include "log.h"
NS_LOG_COMPONENT_DEFINE ("HeapScheduler");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (HeapScheduler);
TypeId
HeapScheduler::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::HeapScheduler")
.SetParent<Scheduler> ()
.AddConstructor<HeapScheduler> ()
;
return tid;
}
HeapScheduler::HeapScheduler ()
{
// we purposedly waste an item at the start of
// the array to make sure the indexes in the
// array start at one.
Scheduler::Event empty = { 0,{ 0,0}};
m_heap.push_back (empty);
}
HeapScheduler::~HeapScheduler ()
{
}
uint32_t
HeapScheduler::Parent (uint32_t id) const
{
return id / 2;
}
uint32_t
HeapScheduler::Sibling (uint32_t id) const
{
return id + 1;
}
uint32_t
HeapScheduler::LeftChild (uint32_t id) const
{
return id * 2;
}
uint32_t
HeapScheduler::RightChild (uint32_t id) const
{
return id * 2 + 1;
}
uint32_t
HeapScheduler::Root (void) const
{
return 1;
}
bool
HeapScheduler::IsRoot (uint32_t id) const
{
return (id == Root ()) ? true : false;
}
uint32_t
HeapScheduler::Last (void) const
{
return m_heap.size () - 1;
}
bool
HeapScheduler::IsBottom (uint32_t id) const
{
return (id >= m_heap.size ()) ? true : false;
}
void
HeapScheduler::Exch (uint32_t a, uint32_t b)
{
NS_ASSERT (b < m_heap.size () && a < m_heap.size ());
NS_LOG_DEBUG ("Exch " << a << ", " << b);
Event tmp (m_heap[a]);
m_heap[a] = m_heap[b];
m_heap[b] = tmp;
}
bool
HeapScheduler::IsLessStrictly (uint32_t a, uint32_t b) const
{
return m_heap[a] < m_heap[b];
}
uint32_t
HeapScheduler::Smallest (uint32_t a, uint32_t b) const
{
return IsLessStrictly (a,b) ? a : b;
}
bool
HeapScheduler::IsEmpty (void) const
{
return (m_heap.size () == 1) ? true : false;
}
void
HeapScheduler::BottomUp (void)
{
uint32_t index = Last ();
while (!IsRoot (index)
&& IsLessStrictly (index, Parent (index)))
{
Exch (index, Parent (index));
index = Parent (index);
}
}
void
HeapScheduler::TopDown (uint32_t start)
{
uint32_t index = start;
uint32_t right = RightChild (index);
while (!IsBottom (right))
{
uint32_t left = LeftChild (index);
uint32_t tmp = Smallest (left, right);
if (IsLessStrictly (index, tmp))
{
return;
}
Exch (index, tmp);
index = tmp;
right = RightChild (index);
}
if (IsBottom (index))
{
return;
}
NS_ASSERT (!IsBottom (index));
uint32_t left = LeftChild (index);
if (IsBottom (left))
{
return;
}
if (IsLessStrictly (index, left))
{
return;
}
Exch (index, left);
}
void
HeapScheduler::Insert (const Event &ev)
{
m_heap.push_back (ev);
BottomUp ();
}
Scheduler::Event
HeapScheduler::PeekNext (void) const
{
return m_heap[Root ()];
}
Scheduler::Event
HeapScheduler::RemoveNext (void)
{
Event next = m_heap[Root ()];
Exch (Root (), Last ());
m_heap.pop_back ();
TopDown (Root ());
return next;
}
void
HeapScheduler::Remove (const Event &ev)
{
uint32_t uid = ev.key.m_uid;
for (uint32_t i = 1; i < m_heap.size (); i++)
{
if (uid == m_heap[i].key.m_uid)
{
NS_ASSERT (m_heap[i].impl == ev.impl);
Exch (i, Last ());
m_heap.pop_back ();
TopDown (i);
return;
}
}
NS_ASSERT (false);
}
} // namespace ns3
| zy901002-gpsr | src/core/model/heap-scheduler.cc | C++ | gpl2 | 4,267 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "command-line.h"
#include "log.h"
#include "config.h"
#include "global-value.h"
#include "type-id.h"
#include "string.h"
#include <stdlib.h>
#include <stdarg.h>
NS_LOG_COMPONENT_DEFINE ("CommandLine");
namespace ns3 {
CommandLine::CommandLine ()
{
}
CommandLine::CommandLine (const CommandLine &cmd)
{
Copy (cmd);
}
CommandLine &
CommandLine::operator = (const CommandLine &cmd)
{
Clear ();
Copy (cmd);
return *this;
}
CommandLine::~CommandLine ()
{
Clear ();
}
void
CommandLine::Copy (const CommandLine &cmd)
{
for (Items::const_iterator i = cmd.m_items.begin ();
i != cmd.m_items.end (); ++i)
{
m_items.push_back (*i);
}
}
void
CommandLine::Clear (void)
{
for (Items::const_iterator i = m_items.begin (); i != m_items.end (); ++i)
{
delete *i;
}
m_items.clear ();
}
CommandLine::Item::~Item ()
{
}
void
CommandLine::Parse (int iargc, char *argv[]) const
{
int argc = iargc;
for (argc--, argv++; argc > 0; argc--, argv++)
{
// remove "--" or "-" heading.
std::string param = *argv;
std::string::size_type cur = param.find ("--");
if (cur == 0)
{
param = param.substr (2, param.size () - 2);
}
else
{
cur = param.find ("-");
if (cur == 0)
{
param = param.substr (1, param.size () - 1);
}
else
{
// invalid argument. ignore.
continue;
}
}
cur = param.find ("=");
std::string name, value;
if (cur == std::string::npos)
{
name = param;
value = "";
}
else
{
name = param.substr (0, cur);
value = param.substr (cur + 1, param.size () - (cur+1));
}
HandleArgument (name, value);
}
}
void
CommandLine::PrintHelp (void) const
{
std::cout << "--PrintHelp: Print this help message." << std::endl;
std::cout << "--PrintGroups: Print the list of groups." << std::endl;
std::cout << "--PrintTypeIds: Print all TypeIds." << std::endl;
std::cout << "--PrintGroup=[group]: Print all TypeIds of group." << std::endl;
std::cout << "--PrintAttributes=[typeid]: Print all attributes of typeid." << std::endl;
std::cout << "--PrintGlobals: Print the list of globals." << std::endl;
if (!m_items.empty ())
{
std::cout << "User Arguments:" << std::endl;
for (Items::const_iterator i = m_items.begin (); i != m_items.end (); ++i)
{
std::cout << " --" << (*i)->m_name << ": " << (*i)->m_help << std::endl;
}
}
}
void
CommandLine::PrintGlobals (void) const
{
for (GlobalValue::Iterator i = GlobalValue::Begin (); i != GlobalValue::End (); ++i)
{
std::cout << " --" << (*i)->GetName () << "=[";
Ptr<const AttributeChecker> checker = (*i)->GetChecker ();
StringValue v;
(*i)->GetValue (v);
std::cout << v.Get () << "]: "
<< (*i)->GetHelp () << std::endl;
}
}
void
CommandLine::PrintAttributes (std::string type) const
{
TypeId tid;
if (!TypeId::LookupByNameFailSafe (type, &tid))
{
NS_FATAL_ERROR ("Unknown type="<<type<<" in --PrintAttributes");
}
for (uint32_t i = 0; i < tid.GetAttributeN (); ++i)
{
std::cout << " --"<<tid.GetAttributeFullName (i)<<"=[";
struct TypeId::AttributeInformation info = tid.GetAttribute (i);
std::cout << info.initialValue->SerializeToString (info.checker) << "]: "
<< info.help << std::endl;
}
}
void
CommandLine::PrintGroup (std::string group) const
{
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
{
TypeId tid = TypeId::GetRegistered (i);
if (tid.GetGroupName () == group)
{
std::cout << " --PrintAttributes=" <<tid.GetName ()<<std::endl;
}
}
}
void
CommandLine::PrintTypeIds (void) const
{
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
{
TypeId tid = TypeId::GetRegistered (i);
std::cout << " --PrintAttributes=" <<tid.GetName ()<<std::endl;
}
}
void
CommandLine::PrintGroups (void) const
{
std::list<std::string> groups;
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
{
TypeId tid = TypeId::GetRegistered (i);
std::string group = tid.GetGroupName ();
if (group == "")
{
continue;
}
bool found = false;
for (std::list<std::string>::const_iterator j = groups.begin (); j != groups.end (); ++j)
{
if (*j == group)
{
found = true;
break;
}
}
if (!found)
{
groups.push_back (group);
}
}
for (std::list<std::string>::const_iterator k = groups.begin (); k != groups.end (); ++k)
{
std::cout << " --PrintGroup="<<*k<<std::endl;
}
}
void
CommandLine::HandleArgument (std::string name, std::string value) const
{
NS_LOG_DEBUG ("Handle arg name="<<name<<" value="<<value);
if (name == "PrintHelp")
{
// method below never returns.
PrintHelp ();
exit (0);
}
else if (name == "PrintGroups")
{
// method below never returns.
PrintGroups ();
exit (0);
}
else if (name == "PrintTypeIds")
{
// method below never returns.
PrintTypeIds ();
exit (0);
}
else if (name == "PrintGlobals")
{
// method below never returns.
PrintGlobals ();
exit (0);
}
else if (name == "PrintGroup")
{
// method below never returns.
PrintGroup (value);
exit (0);
}
else if (name == "PrintAttributes")
{
// method below never returns.
PrintAttributes (value);
exit (0);
}
else
{
for (Items::const_iterator i = m_items.begin (); i != m_items.end (); ++i)
{
if ((*i)->m_name == name)
{
if (!(*i)->Parse (value))
{
std::cerr << "Invalid argument value: "<<name<<"="<<value << std::endl;
exit (1);
}
else
{
return;
}
}
}
}
if (!Config::SetGlobalFailSafe (name, StringValue (value))
&& !Config::SetDefaultFailSafe (name, StringValue (value)))
{
std::cerr << "Invalid command-line arguments: --"<<name<<"="<<value<<std::endl;
PrintHelp ();
exit (1);
}
}
bool
CommandLine::CallbackItem::Parse (std::string value)
{
NS_LOG_DEBUG ("CommandLine::CallbackItem::Parse \"" << value << "\"");
return m_callback (value);
}
void
CommandLine::AddValue (const std::string &name,
const std::string &help,
Callback<bool, std::string> callback)
{
NS_LOG_FUNCTION (this << name << help << "callback");
CallbackItem *item = new CallbackItem ();
item->m_name = name;
item->m_help = help;
item->m_callback = callback;
m_items.push_back (item);
}
} // namespace ns3
| zy901002-gpsr | src/core/model/command-line.cc | C++ | gpl2 | 7,879 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "vector.h"
#include "fatal-error.h"
#include <cmath>
#include <sstream>
namespace ns3 {
ATTRIBUTE_HELPER_CPP (Vector3D);
ATTRIBUTE_HELPER_CPP (Vector2D);
// compatibility for mobility code
Ptr<const AttributeChecker> MakeVectorChecker (void)
{
return MakeVector3DChecker ();
}
Vector3D::Vector3D (double _x, double _y, double _z)
: x (_x),
y (_y),
z (_z)
{
}
Vector3D::Vector3D ()
: x (0.0),
y (0.0),
z (0.0)
{
}
Vector2D::Vector2D (double _x, double _y)
: x (_x),
y (_y)
{
}
Vector2D::Vector2D ()
: x (0.0),
y (0.0)
{
}
double
CalculateDistance (const Vector3D &a, const Vector3D &b)
{
double dx = b.x - a.x;
double dy = b.y - a.y;
double dz = b.z - a.z;
double distance = std::sqrt (dx * dx + dy * dy + dz * dz);
return distance;
}
double
CalculateDistance (const Vector2D &a, const Vector2D &b)
{
double dx = b.x - a.x;
double dy = b.y - a.y;
double distance = std::sqrt (dx * dx + dy * dy);
return distance;
}
std::ostream &operator << (std::ostream &os, const Vector3D &vector)
{
os << vector.x << ":" << vector.y << ":" << vector.z;
return os;
}
std::istream &operator >> (std::istream &is, Vector3D &vector)
{
char c1, c2;
is >> vector.x >> c1 >> vector.y >> c2 >> vector.z;
if (c1 != ':' ||
c2 != ':')
{
is.setstate (std::ios_base::failbit);
}
return is;
}
std::ostream &operator << (std::ostream &os, const Vector2D &vector)
{
os << vector.x << ":" << vector.y;
return os;
}
std::istream &operator >> (std::istream &is, Vector2D &vector)
{
char c1;
is >> vector.x >> c1 >> vector.y;
if (c1 != ':')
{
is.setstate (std::ios_base::failbit);
}
return is;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/vector.cc | C++ | gpl2 | 2,525 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "ptr.h"
#include <string>
#include <vector>
namespace ns3 {
class AttributeValue;
class Object;
class CallbackBase;
/**
* \brief Configuration of simulation parameters and tracing
* \ingroup core
*/
namespace Config {
/**
* Reset the initial value of every attribute as well as the value of every
* global to what they were before any call to SetDefault and SetGlobal.
*/
void Reset (void);
/**
* \param path a path to match attributes.
* \param value the value to set in all matching attributes.
*
* This function will attempt to find attributes which
* match the input path and will then set their value to the input
* value.
*/
void Set (std::string path, const AttributeValue &value);
/**
* \param name the full name of the attribute
* \param value the value to set.
*
* This method overrides the initial value of the
* matching attribute. This method cannot fail: it will
* crash if the input attribute name or value is invalid.
*/
void SetDefault (std::string name, const AttributeValue &value);
/**
* \param name the full name of the attribute
* \param value the value to set.
* \returns true if the value was set successfully, false otherwise.
*
* This method overrides the initial value of the
* matching attribute.
*/
bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
/**
* \param name the name of the requested GlobalValue.
* \param value the value to set
*
* This method is equivalent to GlobalValue::Bind
*/
void SetGlobal (std::string name, const AttributeValue &value);
/**
* \param name the name of the requested GlobalValue.
* \param value the value to set
*
* This method is equivalent to GlobalValue::BindFailSafe
*/
bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
/**
* \param path a path to match trace sources.
* \param cb the callback to connect to the matching trace sources.
*
* This function will attempt to find all trace sources which
* match the input path and will then connect the input callback
* to them.
*/
void ConnectWithoutContext (std::string path, const CallbackBase &cb);
/**
* \param path a path to match trace sources.
* \param cb the callback to disconnect to the matching trace sources.
*
* This function undoes the work of Config::Connect.
*/
void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
/**
* \param path a path to match trace sources.
* \param cb the callback to connect to the matching trace sources.
*
* This function will attempt to find all trace sources which
* match the input path and will then connect the input callback
* to them in such a way that the callback will receive an extra
* context string upon trace event notification.
*/
void Connect (std::string path, const CallbackBase &cb);
/**
* \param path a path to match trace sources.
* \param cb the callback to connect to the matching trace sources.
*
* This function undoes the work of Config::ConnectWithContext.
*/
void Disconnect (std::string path, const CallbackBase &cb);
/**
* \brief hold a set of objects which match a specific search string.
*
* This class also allows you to perform a set of configuration operations
* on the set of matching objects stored in the container. Specifically,
* it is possible to perform bulk Connects and Sets.
*/
class MatchContainer
{
public:
typedef std::vector<Ptr<Object> >::const_iterator Iterator;
MatchContainer ();
// constructor used only by implementation.
MatchContainer (const std::vector<Ptr<Object> > &objects,
const std::vector<std::string> &contexts,
std::string path);
/**
* \returns an iterator which points to the first item in the container
*/
MatchContainer::Iterator Begin (void) const;
/**
* \returns an iterator which points to the last item in the container
*/
MatchContainer::Iterator End (void) const;
/**
* \returns the number of items in the container
*/
uint32_t GetN (void) const;
/**
* \param i index of item to lookup ([0,n[)
* \returns the item requested.
*/
Ptr<Object> Get (uint32_t i) const;
/**
* \param i index of item to lookup ([0,n[)
* \returns the fully-qualified matching path associated
* to the requested item.
*
* The matching patch uniquely identifies the requested object.
*/
std::string GetMatchedPath (uint32_t i) const;
/**
* \returns the path used to perform the object matching.
*/
std::string GetPath (void) const;
/**
* \param name name of attribute to set
* \param value value to set to the attribute
*
* Set the specified attribute value to all the objects stored in this
* container.
* \sa ns3::Config::Set
*/
void Set (std::string name, const AttributeValue &value);
/**
* \param name the name of the trace source to connect to
* \param cb the sink to connect to the trace source
*
* Connect the specified sink to all the objects stored in this
* container.
* \sa ns3::Config::Connect
*/
void Connect (std::string name, const CallbackBase &cb);
/**
* \param name the name of the trace source to connect to
* \param cb the sink to connect to the trace source
*
* Connect the specified sink to all the objects stored in this
* container.
* \sa ns3::Config::ConnectWithoutContext
*/
void ConnectWithoutContext (std::string name, const CallbackBase &cb);
/**
* \param name the name of the trace source to disconnect from
* \param cb the sink to disconnect from the trace source
*
* Disconnect the specified sink from all the objects stored in this
* container.
* \sa ns3::Config::Disconnect
*/
void Disconnect (std::string name, const CallbackBase &cb);
/**
* \param name the name of the trace source to disconnect from
* \param cb the sink to disconnect from the trace source
*
* Disconnect the specified sink from all the objects stored in this
* container.
* \sa ns3::Config::DisconnectWithoutContext
*/
void DisconnectWithoutContext (std::string name, const CallbackBase &cb);
private:
std::vector<Ptr<Object> > m_objects;
std::vector<std::string> m_contexts;
std::string m_path;
};
/**
* \param path the path to perform a match against
* \returns a container which contains all the objects which match the input
* path.
*/
MatchContainer LookupMatches (std::string path);
/**
* \param obj a new root object
*
* Each root object is used during path matching as
* the root of the path by Config::Connect, and Config::Set.
*/
void RegisterRootNamespaceObject (Ptr<Object> obj);
/**
* \param obj a new root object
*
* This function undoes the work of Config::RegisterRootNamespaceObject.
*/
void UnregisterRootNamespaceObject (Ptr<Object> obj);
/**
* \returns the number of registered root namespace objects.
*/
uint32_t GetRootNamespaceObjectN (void);
/**
* \param i the index of the requested object.
* \returns the requested root namespace object
*/
Ptr<Object> GetRootNamespaceObject (uint32_t i);
} // namespace Config
} // namespace ns3
#endif /* CONFIG_H */
| zy901002-gpsr | src/core/model/config.h | C++ | gpl2 | 7,986 |
#include "simulator-impl.h"
namespace ns3 {
TypeId
SimulatorImpl::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::SimulatorImpl")
.SetParent<Object> ()
;
return tid;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/simulator-impl.cc | C++ | gpl2 | 206 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef NS_POINTER_H
#define NS_POINTER_H
#include "attribute.h"
#include "object.h"
namespace ns3 {
/**
* \ingroup attribute
*
* \brief hold objects of type Ptr<T>
*/
class PointerValue : public AttributeValue
{
public:
PointerValue ();
PointerValue (Ptr<Object> object);
void SetObject (Ptr<Object> object);
Ptr<Object> GetObject (void) const;
template <typename T>
PointerValue (const Ptr<T> &object);
template <typename T>
void Set (const Ptr<T> &object);
template <typename T>
Ptr<T> Get (void) const;
template <typename T>
bool GetAccessor (Ptr<T> &v) const;
template <typename T>
operator Ptr<T> () const;
virtual Ptr<AttributeValue> Copy (void) const;
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
private:
Ptr<Object> m_value;
};
class PointerChecker : public AttributeChecker
{
public:
virtual TypeId GetPointeeTypeId (void) const = 0;
};
template <typename T>
Ptr<AttributeChecker> MakePointerChecker (void);
} // namespace ns3
namespace ns3 {
namespace internal {
template <typename T>
class APointerChecker : public PointerChecker
{
virtual bool Check (const AttributeValue &val) const {
const PointerValue *value = dynamic_cast<const PointerValue *> (&val);
if (value == 0)
{
return false;
}
if (value->GetObject () == 0)
{
return true;
}
T *ptr = dynamic_cast<T*> (PeekPointer (value->GetObject ()));
if (ptr == 0)
{
return false;
}
return true;
}
virtual std::string GetValueTypeName (void) const {
return "ns3::PointerValue";
}
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetUnderlyingTypeInformation (void) const {
TypeId tid = T::GetTypeId ();
return "ns3::Ptr< " + tid.GetName () + " >";
}
virtual Ptr<AttributeValue> Create (void) const {
return ns3::Create<PointerValue> ();
}
virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
const PointerValue *src = dynamic_cast<const PointerValue *> (&source);
PointerValue *dst = dynamic_cast<PointerValue *> (&destination);
if (src == 0 || dst == 0)
{
return false;
}
*dst = *src;
return true;
}
virtual TypeId GetPointeeTypeId (void) const {
return T::GetTypeId ();
}
};
} // namespace internal
template <typename T>
PointerValue::PointerValue (const Ptr<T> &object)
{
m_value = object;
}
template <typename T>
void
PointerValue::Set (const Ptr<T> &object)
{
m_value = object;
}
template <typename T>
Ptr<T>
PointerValue::Get (void) const
{
T *v = dynamic_cast<T *> (PeekPointer (m_value));
return v;
}
template <typename T>
PointerValue::operator Ptr<T> () const
{
return Get<T> ();
}
template <typename T>
bool
PointerValue::GetAccessor (Ptr<T> &v) const
{
Ptr<T> ptr = dynamic_cast<T*> (PeekPointer (m_value));
if (ptr == 0)
{
return false;
}
v = ptr;
return true;
}
ATTRIBUTE_ACCESSOR_DEFINE (Pointer);
template <typename T>
Ptr<AttributeChecker>
MakePointerChecker (void)
{
return Create<internal::APointerChecker<T> > ();
}
} // namespace ns3
#endif /* NS_POINTER_H */
| zy901002-gpsr | src/core/model/pointer.h | C++ | gpl2 | 4,155 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef CALLBACK_H
#define CALLBACK_H
#include "ptr.h"
#include "fatal-error.h"
#include "empty.h"
#include "type-traits.h"
#include "attribute.h"
#include "attribute-helper.h"
#include "simple-ref-count.h"
#include <typeinfo>
namespace ns3 {
/***
* \internal
* This code was originally written based on the techniques
* described in http://www.codeproject.com/cpp/TTLFunction.asp
* It was subsequently rewritten to follow the architecture
* outlined in "Modern C++ Design" by Andrei Alexandrescu in
* chapter 5, "Generalized Functors".
*
* This code uses:
* - default template parameters to saves users from having to
* specify empty parameters when the number of parameters
* is smaller than the maximum supported number
* - the pimpl idiom: the Callback class is passed around by
* value and delegates the crux of the work to its pimpl
* pointer.
* - two pimpl implementations which derive from CallbackImpl
* FunctorCallbackImpl can be used with any functor-type
* while MemPtrCallbackImpl can be used with pointers to
* member functions.
* - a reference list implementation to implement the Callback's
* value semantics.
*
* This code most notably departs from the alexandrescu
* implementation in that it does not use type lists to specify
* and pass around the types of the callback arguments.
* Of course, it also does not use copy-destruction semantics
* and relies on a reference list rather than autoPtr to hold
* the pointer.
*/
template <typename T>
struct CallbackTraits;
template <typename T>
struct CallbackTraits<T *>
{
static T & GetReference (T * const p)
{
return *p;
}
};
class CallbackImplBase : public SimpleRefCount<CallbackImplBase>
{
public:
virtual ~CallbackImplBase () {}
virtual bool IsEqual (Ptr<const CallbackImplBase> other) const = 0;
};
// declare the CallbackImpl class
template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
class CallbackImpl;
// define CallbackImpl for 0 params
template <typename R>
class CallbackImpl<R,empty,empty,empty,empty,empty,empty,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (void) = 0;
};
// define CallbackImpl for 1 params
template <typename R, typename T1>
class CallbackImpl<R,T1,empty,empty,empty,empty,empty,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1) = 0;
};
// define CallbackImpl for 2 params
template <typename R, typename T1, typename T2>
class CallbackImpl<R,T1,T2,empty,empty,empty,empty,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2) = 0;
};
// define CallbackImpl for 3 params
template <typename R, typename T1, typename T2, typename T3>
class CallbackImpl<R,T1,T2,T3,empty,empty,empty,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3) = 0;
};
// define CallbackImpl for 4 params
template <typename R, typename T1, typename T2, typename T3, typename T4>
class CallbackImpl<R,T1,T2,T3,T4,empty,empty,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3, T4) = 0;
};
// define CallbackImpl for 5 params
template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5>
class CallbackImpl<R,T1,T2,T3,T4,T5,empty,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3, T4, T5) = 0;
};
// define CallbackImpl for 6 params
template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
class CallbackImpl<R,T1,T2,T3,T4,T5,T6,empty,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3, T4, T5, T6) = 0;
};
// define CallbackImpl for 7 params
template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
class CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,empty,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3, T4, T5, T6, T7) = 0;
};
// define CallbackImpl for 8 params
template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
class CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty> : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3, T4, T5, T6, T7, T8) = 0;
};
// define CallbackImpl for 9 params
template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
class CallbackImpl : public CallbackImplBase {
public:
virtual ~CallbackImpl () {}
virtual R operator() (T1, T2, T3, T4, T5, T6, T7, T8, T9) = 0;
};
// an impl for Functors:
template <typename T, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8, typename T9>
class FunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> {
public:
FunctorCallbackImpl (T const &functor)
: m_functor (functor) {}
virtual ~FunctorCallbackImpl () {}
R operator() (void) {
return m_functor ();
}
R operator() (T1 a1) {
return m_functor (a1);
}
R operator() (T1 a1,T2 a2) {
return m_functor (a1,a2);
}
R operator() (T1 a1,T2 a2,T3 a3) {
return m_functor (a1,a2,a3);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
return m_functor (a1,a2,a3,a4);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
return m_functor (a1,a2,a3,a4,a5);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
return m_functor (a1,a2,a3,a4,a5,a6);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
return m_functor (a1,a2,a3,a4,a5,a6,a7);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) {
return m_functor (a1,a2,a3,a4,a5,a6,a7,a8);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9) {
return m_functor (a1,a2,a3,a4,a5,a6,a7,a8,a9);
}
virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
FunctorCallbackImpl<T,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> const *otherDerived =
dynamic_cast<FunctorCallbackImpl<T,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> const *> (PeekPointer (other));
if (otherDerived == 0)
{
return false;
}
else if (otherDerived->m_functor != m_functor)
{
return false;
}
return true;
}
private:
T m_functor;
};
// an impl for pointer to member functions
template <typename OBJ_PTR, typename MEM_PTR, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
class MemPtrCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> {
public:
MemPtrCallbackImpl (OBJ_PTR const&objPtr, MEM_PTR mem_ptr)
: m_objPtr (objPtr), m_memPtr (mem_ptr) {}
virtual ~MemPtrCallbackImpl () {}
R operator() (void) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)();
}
R operator() (T1 a1) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1);
}
R operator() (T1 a1,T2 a2) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2);
}
R operator() (T1 a1,T2 a2,T3 a3) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) {
return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> const *otherDerived =
dynamic_cast<MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> const *> (PeekPointer (other));
if (otherDerived == 0)
{
return false;
}
else if (otherDerived->m_objPtr != m_objPtr ||
otherDerived->m_memPtr != m_memPtr)
{
return false;
}
return true;
}
private:
OBJ_PTR const m_objPtr;
MEM_PTR m_memPtr;
};
// an impl for Bound Functors:
template <typename T, typename R, typename TX, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8>
class BoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty> {
public:
template <typename FUNCTOR, typename ARG>
BoundFunctorCallbackImpl (FUNCTOR functor, ARG a)
: m_functor (functor), m_a (a) {}
virtual ~BoundFunctorCallbackImpl () {}
R operator() (void) {
return m_functor (m_a);
}
R operator() (T1 a1) {
return m_functor (m_a,a1);
}
R operator() (T1 a1,T2 a2) {
return m_functor (m_a,a1,a2);
}
R operator() (T1 a1,T2 a2,T3 a3) {
return m_functor (m_a,a1,a2,a3);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
return m_functor (m_a,a1,a2,a3,a4);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
return m_functor (m_a,a1,a2,a3,a4,a5);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
return m_functor (m_a,a1,a2,a3,a4,a5,a6);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
return m_functor (m_a,a1,a2,a3,a4,a5,a6,a7);
}
R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) {
return m_functor (m_a,a1,a2,a3,a4,a5,a6,a7,a8);
}
virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
BoundFunctorCallbackImpl<T,R,TX,T1,T2,T3,T4,T5,T6,T7,T8> const *otherDerived =
dynamic_cast<BoundFunctorCallbackImpl<T,R,TX,T1,T2,T3,T4,T5,T6,T7,T8> const *> (PeekPointer (other));
if (otherDerived == 0)
{
return false;
}
else if (otherDerived->m_functor != m_functor ||
otherDerived->m_a != m_a)
{
return false;
}
return true;
}
private:
T m_functor;
typename TypeTraits<TX>::ReferencedType m_a;
};
class CallbackBase {
public:
CallbackBase () : m_impl () {}
Ptr<CallbackImplBase> GetImpl (void) const { return m_impl; }
protected:
CallbackBase (Ptr<CallbackImplBase> impl) : m_impl (impl) {}
Ptr<CallbackImplBase> m_impl;
static std::string Demangle (const std::string& mangled);
};
/**
* \brief Callback template class
*
* This class template implements the Functor Design Pattern.
* It is used to declare the type of a Callback:
* - the first non-optional template argument represents
* the return type of the callback.
* - the second optional template argument represents
* the type of the first argument to the callback.
* - the third optional template argument represents
* the type of the second argument to the callback.
* - the fourth optional template argument represents
* the type of the third argument to the callback.
* - the fifth optional template argument represents
* the type of the fourth argument to the callback.
* - the sixth optional template argument represents
* the type of the fifth argument to the callback.
*
* Callback instances are built with the \ref MakeCallback
* template functions. Callback instances have POD semantics:
* the memory they allocate is managed automatically, without
* user intervention which allows you to pass around Callback
* instances by value.
*
* Sample code which shows how to use this class template
* as well as the function templates \ref MakeCallback :
* \include src/core/examples/main-callback.cc
*/
template<typename R,
typename T1 = empty, typename T2 = empty,
typename T3 = empty, typename T4 = empty,
typename T5 = empty, typename T6 = empty,
typename T7 = empty, typename T8 = empty,
typename T9 = empty>
class Callback : public CallbackBase {
public:
Callback () {}
// There are two dummy args below to ensure that this constructor is
// always properly disambiguated by the c++ compiler
template <typename FUNCTOR>
Callback (FUNCTOR const &functor, bool, bool)
: CallbackBase (Create<FunctorCallbackImpl<FUNCTOR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > (functor))
{}
template <typename OBJ_PTR, typename MEM_PTR>
Callback (OBJ_PTR const &objPtr, MEM_PTR mem_ptr)
: CallbackBase (Create<MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > (objPtr, mem_ptr))
{}
Callback (Ptr<CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > const &impl)
: CallbackBase (impl)
{}
template <typename T>
Callback<R,T2,T3,T4,T5,T6,T7,T8,T9> Bind (T a) {
Ptr<CallbackImpl<R,T2,T3,T4,T5,T6,T7,T8,T9,empty> > impl =
Ptr<CallbackImpl<R,T2,T3,T4,T5,T6,T7,T8,T9,empty> > (
new BoundFunctorCallbackImpl<
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>,
R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a), false);
return Callback<R,T2,T3,T4,T5,T6,T7,T8,T9> (impl);
}
bool IsNull (void) const {
return (DoPeekImpl () == 0) ? true : false;
}
void Nullify (void) {
m_impl = 0;
}
R operator() (void) const {
return (*(DoPeekImpl ()))();
}
R operator() (T1 a1) const {
return (*(DoPeekImpl ()))(a1);
}
R operator() (T1 a1, T2 a2) const {
return (*(DoPeekImpl ()))(a1,a2);
}
R operator() (T1 a1, T2 a2, T3 a3) const {
return (*(DoPeekImpl ()))(a1,a2,a3);
}
R operator() (T1 a1, T2 a2, T3 a3, T4 a4) const {
return (*(DoPeekImpl ()))(a1,a2,a3,a4);
}
R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) const {
return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5);
}
R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6) const {
return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6);
}
R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7) const {
return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7);
}
R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) const {
return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8);
}
R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) const {
return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8,a9);
}
bool IsEqual (const CallbackBase &other) const {
return m_impl->IsEqual (other.GetImpl ());
}
bool CheckType (const CallbackBase & other) const {
return DoCheckType (other.GetImpl ());
}
void Assign (const CallbackBase &other) {
DoAssign (other.GetImpl ());
}
private:
CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> *DoPeekImpl (void) const {
return static_cast<CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> *> (PeekPointer (m_impl));
}
bool DoCheckType (Ptr<const CallbackImplBase> other) const {
if (other != 0 && dynamic_cast<const CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> *> (PeekPointer (other)) != 0)
{
return true;
}
else if (other == 0)
{
return true;
}
else
{
return false;
}
}
void DoAssign (Ptr<const CallbackImplBase> other) {
if (!DoCheckType (other))
{
NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\" if needed)" << std::endl <<
"got=" << Demangle ( typeid (*other).name () ) << std::endl <<
"expected=" << Demangle ( typeid (CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> *).name () ));
}
m_impl = const_cast<CallbackImplBase *> (PeekPointer (other));
}
};
template <typename R, typename T1, typename T2,
typename T3, typename T4,
typename T5, typename T6,
typename T7, typename T8,
typename T9>
bool operator != (Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> a, Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> b)
{
return !a.IsEqual (b);
}
/**
* \ingroup core
* \defgroup MakeCallback MakeCallback
*
*/
/**
* \ingroup MakeCallback
* \param memPtr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes no arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R>
Callback<R> MakeCallback (R (T::*memPtr)(void), OBJ objPtr) {
return Callback<R> (objPtr, memPtr);
}
template <typename T, typename OBJ, typename R>
Callback<R> MakeCallback (R (T::*mem_ptr)() const, OBJ objPtr) {
return Callback<R> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes one argument
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1>
Callback<R,T1> MakeCallback (R (T::*mem_ptr)(T1), OBJ objPtr) {
return Callback<R,T1> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1>
Callback<R,T1> MakeCallback (R (T::*mem_ptr)(T1) const, OBJ objPtr) {
return Callback<R,T1> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes two arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2>
Callback<R,T1,T2> MakeCallback (R (T::*mem_ptr)(T1,T2), OBJ objPtr) {
return Callback<R,T1,T2> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2>
Callback<R,T1,T2> MakeCallback (R (T::*mem_ptr)(T1,T2) const, OBJ objPtr) {
return Callback<R,T1,T2> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes three arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1,typename T2, typename T3>
Callback<R,T1,T2,T3> MakeCallback (R (T::*mem_ptr)(T1,T2,T3), OBJ objPtr) {
return Callback<R,T1,T2,T3> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1,typename T2, typename T3>
Callback<R,T1,T2,T3> MakeCallback (R (T::*mem_ptr)(T1,T2,T3) const, OBJ objPtr) {
return Callback<R,T1,T2,T3> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes four arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4>
Callback<R,T1,T2,T3,T4> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4), OBJ objPtr) {
return Callback<R,T1,T2,T3,T4> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4>
Callback<R,T1,T2,T3,T4> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4) const, OBJ objPtr) {
return Callback<R,T1,T2,T3,T4> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes five arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5>
Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5), OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5>
Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5) const, OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes six arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6>
Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6), OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6>
Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6) const, OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes seven arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7>
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7), OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7>
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7) const, OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes eight arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7, typename T8>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8), OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8) const, OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param mem_ptr class method member pointer
* \param objPtr class instance
* \return a wrapper Callback
* Build Callbacks for class method members which takes nine arguments
* and potentially return a value.
*/
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8,T9), OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (objPtr, mem_ptr);
}
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8, typename T9>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8,T9) const, OBJ objPtr) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (objPtr, mem_ptr);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes no arguments
* and potentially return a value.
*/
template <typename R>
Callback<R> MakeCallback (R (*fnPtr)()) {
return Callback<R> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes one argument
* and potentially return a value.
*/
template <typename R, typename T1>
Callback<R,T1> MakeCallback (R (*fnPtr)(T1)) {
return Callback<R,T1> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes two arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2>
Callback<R,T1,T2> MakeCallback (R (*fnPtr)(T1,T2)) {
return Callback<R,T1,T2> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes three arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3>
Callback<R,T1,T2,T3> MakeCallback (R (*fnPtr)(T1,T2,T3)) {
return Callback<R,T1,T2,T3> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes four arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4>
Callback<R,T1,T2,T3,T4> MakeCallback (R (*fnPtr)(T1,T2,T3,T4)) {
return Callback<R,T1,T2,T3,T4> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes five arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5)) {
return Callback<R,T1,T2,T3,T4,T5> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes six arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6>
Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6)) {
return Callback<R,T1,T2,T3,T4,T5,T6> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes seven arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7)) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes eight arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8)) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \param fnPtr function pointer
* \return a wrapper Callback
* Build Callbacks for functions which takes nine arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8,T9)) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (fnPtr, true, true);
}
/**
* \ingroup MakeCallback
* \return a wrapper Callback
* Build a null callback which takes no arguments
* and potentially return a value.
*/
template <typename R>
Callback<R> MakeNullCallback (void) {
return Callback<R> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes one argument
* and potentially return a value.
*/
template <typename R, typename T1>
Callback<R,T1> MakeNullCallback (void) {
return Callback<R,T1> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes two arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2>
Callback<R,T1,T2> MakeNullCallback (void) {
return Callback<R,T1,T2> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes three arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3>
Callback<R,T1,T2,T3> MakeNullCallback (void) {
return Callback<R,T1,T2,T3> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes four arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4>
Callback<R,T1,T2,T3,T4> MakeNullCallback (void) {
return Callback<R,T1,T2,T3,T4> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes five arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
Callback<R,T1,T2,T3,T4,T5> MakeNullCallback (void) {
return Callback<R,T1,T2,T3,T4,T5> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes six arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6>
Callback<R,T1,T2,T3,T4,T5,T6> MakeNullCallback (void) {
return Callback<R,T1,T2,T3,T4,T5,T6> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes seven arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeNullCallback (void) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes eight arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeNullCallback (void) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> ();
}
/**
* \ingroup MakeCallback
* \overload Callback<R> MakeNullCallback (void)
* \return a wrapper Callback
* Build a null callback which takes nine arguments
* and potentially return a value.
*/
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeNullCallback (void) {
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> ();
}
/*
* The following is experimental code. It works but we have
* not yet determined whether or not it is really useful and whether
* or not we really want to use it.
*/
template <typename R, typename TX, typename ARG>
Callback<R> MakeBoundCallback (R (*fnPtr)(TX), ARG a) {
Ptr<CallbackImpl<R,empty,empty,empty,empty,empty,empty,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX),R,TX,empty,empty,empty,empty,empty,empty,empty,empty> >(fnPtr, a);
return Callback<R> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1>
Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX,T1), ARG a) {
Ptr<CallbackImpl<R,T1,empty,empty,empty,empty,empty,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1),R,TX,T1,empty,empty,empty,empty,empty,empty,empty> > (fnPtr, a);
return Callback<R,T1> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2>
Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX,T1,T2), ARG a) {
Ptr<CallbackImpl<R,T1,T2,empty,empty,empty,empty,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2),R,TX,T1,T2,empty,empty,empty,empty,empty,empty> > (fnPtr, a);
return Callback<R,T1,T2> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2,typename T3>
Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3), ARG a) {
Ptr<CallbackImpl<R,T1,T2,T3,empty,empty,empty,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3),R,TX,T1,T2,T3,empty,empty,empty,empty,empty> > (fnPtr, a);
return Callback<R,T1,T2,T3> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2,typename T3,typename T4>
Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4), ARG a) {
Ptr<CallbackImpl<R,T1,T2,T3,T4,empty,empty,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4),R,TX,T1,T2,T3,T4,empty,empty,empty,empty> > (fnPtr, a);
return Callback<R,T1,T2,T3,T4> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2,typename T3,typename T4,typename T5>
Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5), ARG a) {
Ptr<CallbackImpl<R,T1,T2,T3,T4,T5,empty,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5),R,TX,T1,T2,T3,T4,T5,empty,empty,empty> > (fnPtr, a);
return Callback<R,T1,T2,T3,T4,T5> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6), ARG a) {
Ptr<CallbackImpl<R,T1,T2,T3,T4,T5,T6,empty,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6),R,TX,T1,T2,T3,T4,T5,T6,empty,empty> > (fnPtr, a);
return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7>
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7), ARG a) {
Ptr<CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,empty,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6,T7),R,TX,T1,T2,T3,T4,T5,T6,T7,empty> > (fnPtr, a);
return Callback<R,T1,T2,T3,T4,T5,T6,T7> (impl);
}
template <typename R, typename TX, typename ARG,
typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7, typename T8>
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7,T8), ARG a) {
Ptr<CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty> > impl =
Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6,T7,T8),R,TX,T1,T2,T3,T4,T5,T6,T7,T8> > (fnPtr, a);
return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (impl);
}
} // namespace ns3
namespace ns3 {
class CallbackValue : public AttributeValue
{
public:
CallbackValue ();
CallbackValue (const CallbackBase &base);
virtual ~CallbackValue ();
void Set (CallbackBase base);
template <typename T>
bool GetAccessor (T &value) const;
virtual Ptr<AttributeValue> Copy (void) const;
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
private:
CallbackBase m_value;
};
ATTRIBUTE_ACCESSOR_DEFINE (Callback);
ATTRIBUTE_CHECKER_DEFINE (Callback);
} // namespace ns3
namespace ns3 {
template <typename T>
bool CallbackValue::GetAccessor (T &value) const
{
if (value.CheckType (m_value))
{
value.Assign (m_value);
return true;
}
return false;
}
} // namespace ns3
#endif /* CALLBACK_H */
| zy901002-gpsr | src/core/model/callback.h | C++ | gpl2 | 37,337 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Georgia Tech Research Corporation, INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: George Riley <riley@ece.gatech.edu>
* Gustavo Carneiro <gjcarneiro@gmail.com>,
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef SIMPLE_REF_COUNT_H
#define SIMPLE_REF_COUNT_H
#include "empty.h"
#include "default-deleter.h"
#include "assert.h"
#include <stdint.h>
#include <limits>
namespace ns3 {
/**
* \brief A template-based reference counting class
*
* This template can be used to give reference-counting powers
* to a class. This template does not require this class to
* have a virtual destructor or no parent class.
*
* Note: if you are moving to this template from the RefCountBase class,
* you need to be careful to mark appropriately your destructor virtual
* if needed. i.e., if your class has subclasses, _do_ mark your destructor
* virtual.
*
*
* This template takes 3 arguments but only the first argument is
* mandatory:
* - T: the typename of the subclass which derives from this template
* class. Yes, this is weird but it's a common C++ template pattern
* whose name is CRTP (Curiously Recursive Template Pattern)
* - PARENT: the typename of the parent of this template. By default,
* this typename is "'ns3::empty'" which is an empty class: compilers
* which implement the RBCO optimization (empty base class optimization)
* will make this a no-op
* - DELETER: the typename of a class which implements a public static
* method named 'Delete'. This method will be called whenever the
* SimpleRefCount template detects that no references to the object
* it manages exist anymore.
*
* Interesting users of this class include ns3::Object as well as ns3::Packet.
*/
template <typename T, typename PARENT = empty, typename DELETER = DefaultDeleter<T> >
class SimpleRefCount : public PARENT
{
public:
SimpleRefCount ()
: m_count (1)
{}
SimpleRefCount (const SimpleRefCount &o)
: m_count (1)
{}
SimpleRefCount &operator = (const SimpleRefCount &o)
{
return *this;
}
/**
* Increment the reference count. This method should not be called
* by user code. SimpleRefCount instances are expected to be used in
* conjunction with the Ptr template which would make calling Ref
* unnecessary and dangerous.
*/
inline void Ref (void) const
{
NS_ASSERT (m_count < std::numeric_limits<uint32_t>::max());
m_count++;
}
/**
* Decrement the reference count. This method should not be called
* by user code. SimpleRefCount instances are expected to be used in
* conjunction with the Ptr template which would make calling Ref
* unnecessary and dangerous.
*/
inline void Unref (void) const
{
m_count--;
if (m_count == 0)
{
DELETER::Delete (static_cast<T*> (const_cast<SimpleRefCount *> (this)));
}
}
/**
* Get the reference count of the object.
* Normally not needed; for language bindings.
*/
inline uint32_t GetReferenceCount (void) const
{
return m_count;
}
static void Cleanup (void) {}
private:
// Note we make this mutable so that the const methods can still
// change it.
mutable uint32_t m_count;
};
} // namespace ns3
#endif /* SIMPLE_REF_COUNT_H */
| zy901002-gpsr | src/core/model/simple-ref-count.h | C++ | gpl2 | 4,005 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef TIME_H
#define TIME_H
#include "assert.h"
#include "attribute.h"
#include "attribute-helper.h"
#include "int64x64.h"
#include <stdint.h>
#include <math.h>
#include <ostream>
namespace ns3 {
/**
* \ingroup core
* \defgroup time Time
*/
/**
* \ingroup time
* \brief keep track of time unit.
*
* This template class is used to keep track of the value
* of a specific time unit: the type TimeUnit<1> is used to
* keep track of seconds, the type TimeUnit<2> is used to keep
* track of seconds squared, the type TimeUnit<-1> is used to
* keep track of 1/seconds, etc.
*
* This base class defines all the functionality shared by all
* these time unit objects: it defines all the classic arithmetic
* operators +, -, *, /, and all the classic comparison operators:
* ==, !=, <, >, <=, >=. It is thus easy to add, substract, or
* multiply multiple TimeUnit objects. The return type of any such
* arithmetic expression is always a TimeUnit object.
*
* The ns3::uint64_t, ns3::Time, ns3::TimeSquare, and ns3::TimeInvert classes
* are aliases for the TimeUnit<0>, TimeUnit<1>, TimeUnit<2> and TimeUnit<-1>
* types respectively.
*
* For example:
* \code
* Time<1> t1 = Seconds (10.0);
* Time<1> t2 = Seconds (10.0);
* Time<2> t3 = t1 * t2;
* Time<0> t4 = t1 / t2;
* Time<3> t5 = t3 * t1;
* Time<-2> t6 = t1 / t5;
* TimeSquare t7 = t3;
* uint64_t s = t4;
* \endcode
*
* If you try to assign the result of an expression which does not
* match the type of the variable it is assigned to, you will get a
* compiler error. For example, the following will not compile:
* \code
* Time<1> = Seconds (10.0) * Seconds (1.5);
* \endcode
*
* You can also use the following non-member functions to manipulate
* any of these ns3::TimeUnit object:
* - \ref ns3-Time-Abs ns3::Abs
* - \ref ns3-Time-Max ns3::Max
* - \ref ns3-Time-Min ns3::Min
*/
/**
* \ingroup time
* \brief keep track of time values and allow control of global simulation resolution
*
* This class defines all the classic C++ arithmetic
* operators +, -, *, /, and all the classic comparison operators:
* ==, !=, <, >, <=, >=. It is thus easy to add, substract, or
* multiply multiple Time objects.
*
* The ns3::uint64_t, ns3::TimeSquare, and ns3::TimeInvert classes
* are backward-compatibility aliases for ns3::Time.
*
* For example:
* \code
* Time t1 = Seconds (10.0);
* Time t2 = Seconds (10.0);
* Time t3 = t1 * t2;
* Time t4 = t1 / t2;
* Time t5 = t3 * t1;
* Time t6 = t1 / t5;
* Time t7 = t3;
* \endcode
*
* You can also use the following non-member functions to manipulate
* any of these ns3::Time object:
* - \ref ns3-Time-Abs ns3::Abs
* - \ref ns3-Time-Max ns3::Max
* - \ref ns3-Time-Min ns3::Min
*
* This class also controls
* the resolution of the underlying time value . The default resolution
* is nanoseconds. That is, TimeStep (1).GetNanoSeconds () will return
* 1. It is possible to either increase or decrease the resolution and the
* code tries really hard to make this easy.
*
* If your resolution is X (say, nanoseconds) and if you create Time objects
* with a lower resolution (say, picoseconds), don't expect that this
* code will return 1: PicoSeconds (1).GetPicoSeconds (). It will most
* likely return 0 because the Time object has only 64 bits of fractional
* precision which means that PicoSeconds (1) is stored as a 64-bit aproximation
* of 1/1000 in the Time object. If you later multiply it again by the exact
* value 1000, the result is unlikely to be 1 exactly. It will be close to
* 1 but not exactly 1.
*
* In general, it is thus a really bad idea to try to use time objects of a
* resolution higher than the global resolution controlled through
* Time::SetResolution. If you do need to use picoseconds, it's thus best
* to switch the global resolution to picoseconds to avoid nasty surprises.
*
* Another important issue to keep in mind is that if you increase the
* global resolution, you also implicitely decrease the range of your simulation.
* i.e., the global simulation time is stored in a 64 bit integer whose interpretation
* will depend on the global resolution so, 2^64 picoseconds which is the maximum
* duration of your simulation if the global resolution is picoseconds
* is smaller than 2^64 nanoseconds which is the maximum duration of your simulation
* if the global resolution is nanoseconds.
*
* Finally, don't even think about ever changing the global resolution after
* creating Time objects: all Time objects created before the call to SetResolution
* will contain values which are not updated to the new resolution. In practice,
* the default value for the attributes of many models is indeed calculated
* before the main function of the main program enters. Because of this, if you
* use one of these models (and it's likely), it's going to be hard to change
* the global simulation resolution in a way which gives reasonable results. This
* issue has been filed as bug 954 in the ns-3 bugzilla installation.
*/
class Time
{
public:
/**
* The unit to use to interpret a number representing time
*/
enum Unit
{
S = 0,
MS = 1,
US = 2,
NS = 3,
PS = 4,
FS = 5,
LAST = 6
};
inline Time &operator = (const Time &o)
{
m_data = o.m_data;
return *this;
}
inline Time ()
: m_data ()
{}
inline Time(const Time &o)
: m_data (o.m_data)
{}
explicit inline Time (double v)
: m_data (lround (v))
{}
explicit inline Time (int v)
: m_data (v)
{}
explicit inline Time (long int v)
: m_data (v)
{}
explicit inline Time (long long int v)
: m_data (v)
{}
explicit inline Time (unsigned int v)
: m_data (v)
{}
explicit inline Time (unsigned long int v)
: m_data (v)
{}
explicit inline Time (unsigned long long int v)
: m_data (v)
{}
/**
* \brief String constructor
* Construct Time object from common time expressions like "
* 1ms" or "10s". Supported units include:
* - s (seconds)
* - ms (milliseconds)
* - us (microseconds)
* - ns (nanoseconds)
* - ps (picoseconds)
* - fs (femtoseconds)
*
* There can be no white space between the numerical portion
* and the units. Any otherwise malformed string causes a fatal error to
* occur.
* \param s The string to parse into a Time
*/
explicit Time (const std::string & s);
/**
* \return true if the time is zero, false otherwise.
*/
inline bool IsZero (void) const
{
return m_data == 0;
}
/**
* \return true if the time is negative or zero, false otherwise.
*/
inline bool IsNegative (void) const
{
return m_data <= 0;
}
/**
* \return true if the time is positive or zero, false otherwise.
*/
inline bool IsPositive (void) const
{
return m_data >= 0;
}
/**
* \return true if the time is strictly negative, false otherwise.
*/
inline bool IsStrictlyNegative (void) const
{
return m_data < 0;
}
/**
* \return true if the time is strictly positive, false otherwise.
*/
inline bool IsStrictlyPositive (void) const
{
return m_data > 0;
}
inline int Compare (const Time &o) const
{
return (m_data < o.m_data) ? -1 : (m_data == o.m_data) ? 0 : 1;
}
/**
* \returns an approximation in seconds of the time stored in this
* instance.
*/
inline double GetSeconds (void) const
{
return ToDouble (Time::S);
}
/**
* \returns an approximation in milliseconds of the time stored in this
* instance.
*/
inline int64_t GetMilliSeconds (void) const
{
return ToInteger (Time::MS);
}
/**
* \returns an approximation in microseconds of the time stored in this
* instance.
*/
inline int64_t GetMicroSeconds (void) const
{
return ToInteger (Time::US);
}
/**
* \returns an approximation in nanoseconds of the time stored in this
* instance.
*/
inline int64_t GetNanoSeconds (void) const
{
return ToInteger (Time::NS);
}
/**
* \returns an approximation in picoseconds of the time stored in this
* instance.
*/
inline int64_t GetPicoSeconds (void) const
{
return ToInteger (Time::PS);
}
/**
* \returns an approximation in femtoseconds of the time stored in this
* instance.
*/
inline int64_t GetFemtoSeconds (void) const
{
return ToInteger (Time::FS);
}
/**
* \returns an approximation of the time stored in this
* instance in the units specified in m_tsPrecision.
*/
inline int64_t GetTimeStep (void) const
{
return m_data;
}
inline double GetDouble (void) const
{
return m_data;
}
inline int64_t GetInteger (void) const
{
return GetTimeStep ();
}
/**
* \param resolution the new resolution to use
*
* Change the global resolution used to convert all
* user-provided time values in Time objects and Time objects
* in user-expected time units.
*/
static void SetResolution (enum Unit resolution);
/**
* \returns the current global resolution.
*/
static enum Unit GetResolution (void);
/**
* \param value to convert into a Time object
* \param timeUnit the unit of the value to convert
* \return a new Time object
*
* This method interprets the input value according to the input
* unit and constructs a matching Time object.
*
* \sa FromDouble, ToDouble, ToInteger
*/
inline static Time FromInteger (uint64_t value, enum Unit timeUnit)
{
struct Information *info = PeekInformation (timeUnit);
if (info->fromMul)
{
value *= info->factor;
}
else
{
value /= info->factor;
}
return Time (value);
}
/**
* \param timeUnit the unit of the value to return
*
* Convert the input time into an integer value according to the requested
* time unit.
*/
inline int64_t ToInteger (enum Unit timeUnit) const
{
struct Information *info = PeekInformation (timeUnit);
int64_t v = m_data;
if (info->toMul)
{
v *= info->factor;
}
else
{
v /= info->factor;
}
return v;
}
/**
* \param value to convert into a Time object
* \param timeUnit the unit of the value to convert
* \return a new Time object
*
* \sa FromInteger, ToInteger, ToDouble
*/
inline static Time FromDouble (double value, enum Unit timeUnit)
{
return From (int64x64_t (value), timeUnit);
}
/**
* \param timeUnit the unit of the value to return
*
* Convert the input time into a floating point value according to the requested
* time unit.
*/
inline double ToDouble (enum Unit timeUnit) const
{
return To (timeUnit).GetDouble ();
}
static inline Time From (const int64x64_t &from, enum Unit timeUnit)
{
struct Information *info = PeekInformation (timeUnit);
// DO NOT REMOVE this temporary variable. It's here
// to work around a compiler bug in gcc 3.4
int64x64_t retval = from;
if (info->fromMul)
{
retval *= info->timeFrom;
}
else
{
retval.MulByInvert (info->timeFrom);
}
return Time (retval);
}
inline int64x64_t To (enum Unit timeUnit) const
{
struct Information *info = PeekInformation (timeUnit);
int64x64_t retval = int64x64_t (m_data);
if (info->toMul)
{
retval *= info->timeTo;
}
else
{
retval.MulByInvert (info->timeTo);
}
return retval;
}
inline operator int64x64_t () const
{
return int64x64_t (m_data);
}
explicit inline Time (const int64x64_t &value)
: m_data (value.GetHigh ())
{}
inline static Time From (const int64x64_t &value)
{
return Time (value);
}
private:
struct Information
{
bool toMul;
bool fromMul;
uint64_t factor;
int64x64_t timeTo;
int64x64_t timeFrom;
};
struct Resolution
{
struct Information info[LAST];
enum Time::Unit unit;
};
static inline struct Resolution *PeekResolution (void)
{
static struct Time::Resolution resolution = GetNsResolution ();
return &resolution;
}
static inline struct Information *PeekInformation (enum Unit timeUnit)
{
return &(PeekResolution ()->info[timeUnit]);
}
static struct Resolution GetNsResolution (void);
static void SetResolution (enum Unit unit, struct Resolution *resolution);
friend bool operator == (const Time &lhs, const Time &rhs);
friend bool operator != (const Time &lhs, const Time &rhs);
friend bool operator <= (const Time &lhs, const Time &rhs);
friend bool operator >= (const Time &lhs, const Time &rhs);
friend bool operator < (const Time &lhs, const Time &rhs);
friend bool operator > (const Time &lhs, const Time &rhs);
friend Time operator + (const Time &lhs, const Time &rhs);
friend Time operator - (const Time &lhs, const Time &rhs);
friend Time &operator += (Time &lhs, const Time &rhs);
friend Time &operator -= (Time &lhs, const Time &rhs);
friend Time Abs (const Time &time);
friend Time Max (const Time &ta, const Time &tb);
friend Time Min (const Time &ta, const Time &tb);
int64_t m_data;
};
inline bool
operator == (const Time &lhs, const Time &rhs)
{
return lhs.m_data == rhs.m_data;
}
inline bool
operator != (const Time &lhs, const Time &rhs)
{
return lhs.m_data != rhs.m_data;
}
inline bool
operator <= (const Time &lhs, const Time &rhs)
{
return lhs.m_data <= rhs.m_data;
}
inline bool
operator >= (const Time &lhs, const Time &rhs)
{
return lhs.m_data >= rhs.m_data;
}
inline bool
operator < (const Time &lhs, const Time &rhs)
{
return lhs.m_data < rhs.m_data;
}
inline bool
operator > (const Time &lhs, const Time &rhs)
{
return lhs.m_data > rhs.m_data;
}
inline Time operator + (const Time &lhs, const Time &rhs)
{
return Time (lhs.m_data + rhs.m_data);
}
inline Time operator - (const Time &lhs, const Time &rhs)
{
return Time (lhs.m_data - rhs.m_data);
}
inline Time &operator += (Time &lhs, const Time &rhs)
{
lhs.m_data += rhs.m_data;
return lhs;
}
inline Time &operator -= (Time &lhs, const Time &rhs)
{
lhs.m_data -= rhs.m_data;
return lhs;
}
/**
* \anchor ns3-Time-Abs
* \relates ns3::TimeUnit
* \param time the input value
* \returns the absolute value of the input value.
*/
inline Time Abs (const Time &time)
{
return Time ((time.m_data < 0) ? -time.m_data : time.m_data);
}
/**
* \anchor ns3-Time-Max
* \relates ns3::TimeUnit
* \param ta the first value
* \param tb the seconds value
* \returns the max of the two input values.
*/
inline Time Max (const Time &ta, const Time &tb)
{
return Time ((ta.m_data < tb.m_data) ? tb : ta);
}
/**
* \anchor ns3-Time-Min
* \relates ns3::TimeUnit
* \param ta the first value
* \param tb the seconds value
* \returns the min of the two input values.
*/
inline Time Min (const Time &ta, const Time &tb)
{
return Time ((ta.m_data > tb.m_data) ? tb : ta);
}
std::ostream& operator<< (std::ostream& os, const Time & time);
std::istream& operator>> (std::istream& is, Time & time);
/**
* \brief create ns3::Time instances in units of seconds.
*
* For example:
* \code
* Time t = Seconds (2.0);
* Simulator::Schedule (Seconds (5.0), ...);
* \endcode
* \param seconds seconds value
*/
inline Time Seconds (double seconds)
{
return Time::FromDouble (seconds, Time::S);
}
/**
* \brief create ns3::Time instances in units of milliseconds.
*
* For example:
* \code
* Time t = MilliSeconds (2);
* Simulator::Schedule (MilliSeconds (5), ...);
* \endcode
* \param ms milliseconds value
*/
inline Time MilliSeconds (uint64_t ms)
{
return Time::FromInteger (ms, Time::MS);
}
/**
* \brief create ns3::Time instances in units of microseconds.
*
* For example:
* \code
* Time t = MicroSeconds (2);
* Simulator::Schedule (MicroSeconds (5), ...);
* \endcode
* \param us microseconds value
*/
inline Time MicroSeconds (uint64_t us)
{
return Time::FromInteger (us, Time::US);
}
/**
* \brief create ns3::Time instances in units of nanoseconds.
*
* For example:
* \code
* Time t = NanoSeconds (2);
* Simulator::Schedule (NanoSeconds (5), ...);
* \endcode
* \param ns nanoseconds value
*/
inline Time NanoSeconds (uint64_t ns)
{
return Time::FromInteger (ns, Time::NS);
}
/**
* \brief create ns3::Time instances in units of picoseconds.
*
* For example:
* \code
* Time t = PicoSeconds (2);
* Simulator::Schedule (PicoSeconds (5), ...);
* \endcode
* \param ps picoseconds value
*/
inline Time PicoSeconds (uint64_t ps)
{
return Time::FromInteger (ps, Time::PS);
}
/**
* \brief create ns3::Time instances in units of femtoseconds.
*
* For example:
* \code
* Time t = FemtoSeconds (2);
* Simulator::Schedule (FemtoSeconds (5), ...);
* \endcode
* \param fs femtoseconds value
*/
inline Time FemtoSeconds (uint64_t fs)
{
return Time::FromInteger (fs, Time::FS);
}
inline Time Seconds (int64x64_t seconds)
{
return Time::From (seconds, Time::S);
}
inline Time MilliSeconds (int64x64_t ms)
{
return Time::From (ms, Time::MS);
}
inline Time MicroSeconds (int64x64_t us)
{
return Time::From (us, Time::US);
}
inline Time NanoSeconds (int64x64_t ns)
{
return Time::From (ns, Time::NS);
}
inline Time PicoSeconds (int64x64_t ps)
{
return Time::From (ps, Time::PS);
}
inline Time FemtoSeconds (int64x64_t fs)
{
return Time::From (fs, Time::FS);
}
// internal function not publicly documented
inline Time TimeStep (uint64_t ts)
{
return Time (ts);
}
/**
* \class ns3::TimeValue
* \brief hold objects of type ns3::Time
*/
ATTRIBUTE_VALUE_DEFINE (Time);
ATTRIBUTE_ACCESSOR_DEFINE (Time);
ATTRIBUTE_CHECKER_DEFINE (Time);
} // namespace ns3
#endif /* TIME_H */
| zy901002-gpsr | src/core/model/nstime.h | C++ | gpl2 | 18,567 |
#include "ns3/core-config.h"
#if !defined(INT64X64_128_H) && defined (INT64X64_USE_128) && !defined(PYTHON_SCAN)
#define INT64X64_128_H
#include "ns3/core-config.h"
#include <stdint.h>
#include <math.h>
#if defined(HAVE___UINT128_T) && !defined(HAVE_UINT128_T)
typedef __uint128_t uint128_t;
typedef __int128_t int128_t;
#endif
namespace ns3 {
#define HP128_MAX_64 18446744073709551615.0
#define HP128_MASK_LO ((((int128_t)1)<<64)-1)
class int64x64_t
{
public:
inline int64x64_t ()
: _v (0)
{}
inline int64x64_t (double value)
{
bool is_negative = value < 0;
value = is_negative ? -value : value;
double hi = floor (value);
double lo = (value - hi) * HP128_MAX_64;
_v = (int128_t)hi;
_v <<= 64;
_v += (int128_t)lo;
_v = is_negative ? -_v : _v;
}
inline int64x64_t (int v)
: _v (v)
{
_v <<= 64;
}
inline int64x64_t (long int v)
: _v (v)
{
_v <<= 64;
}
inline int64x64_t (long long int v)
: _v (v)
{
_v <<= 64;
}
inline int64x64_t (unsigned int v)
: _v (v)
{
_v <<= 64;
}
inline int64x64_t (unsigned long int v)
: _v (v)
{
_v <<= 64;
}
inline int64x64_t (unsigned long long int v)
: _v (v)
{
_v <<= 64;
}
explicit inline int64x64_t (int64_t hi, uint64_t lo)
{
bool is_negative = hi<0;
_v = is_negative ? -hi : hi;
_v <<= 64;
_v += lo;
_v = is_negative ? -_v : _v;
}
inline int64x64_t (const int64x64_t &o)
: _v (o._v) {}
inline int64x64_t &operator = (const int64x64_t &o)
{
_v = o._v;
return *this;
}
inline double GetDouble (void) const
{
bool is_negative = _v < 0;
uint128_t value = is_negative ? -_v : _v;
uint64_t hi = value >> 64;
uint64_t lo = value;
double flo = lo;
flo /= HP128_MAX_64;
double retval = hi;
retval += flo;
retval = is_negative ? -retval : retval;
return retval;
}
inline int64_t GetHigh (void) const
{
bool negative = _v < 0;
int128_t v = negative ? -_v : _v;
v >>= 64;
int64_t retval = v;
return negative ? -retval : retval;
}
inline uint64_t GetLow (void) const
{
bool negative = _v < 0;
int128_t v = negative ? -_v : _v;
int128_t low = v & HP128_MASK_LO;
uint64_t retval = low;
return retval;
}
#undef HP128_MAX_64
#undef HP128_MASK_LO
void MulByInvert (const int64x64_t &o);
static int64x64_t Invert (uint64_t v);
private:
friend bool operator == (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator != (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator <= (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator >= (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator < (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator > (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator += (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator -= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator *= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator /= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator + (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator - (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator * (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator / (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator + (const int64x64_t &lhs);
friend int64x64_t operator - (const int64x64_t &lhs);
friend int64x64_t operator ! (const int64x64_t &lhs);
void Mul (const int64x64_t &o);
void Div (const int64x64_t &o);
static uint128_t UmulByInvert (uint128_t a, uint128_t b);
static uint128_t Umul (uint128_t a, uint128_t b);
static uint128_t Divu (uint128_t a, uint128_t b);
inline int64x64_t (int128_t v)
: _v (v) {}
int128_t _v;
};
inline bool operator == (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v == rhs._v;
}
inline bool operator != (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v != rhs._v;
}
inline bool operator < (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v < rhs._v;
}
inline bool operator <= (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v <= rhs._v;
}
inline bool operator >= (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v >= rhs._v;
}
inline bool operator > (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v > rhs._v;
}
inline int64x64_t &operator += (int64x64_t &lhs, const int64x64_t &rhs)
{
lhs._v += rhs._v;
return lhs;
}
inline int64x64_t &operator -= (int64x64_t &lhs, const int64x64_t &rhs)
{
lhs._v -= rhs._v;
return lhs;
}
inline int64x64_t &operator *= (int64x64_t &lhs, const int64x64_t &rhs)
{
lhs.Mul (rhs);
return lhs;
}
inline int64x64_t &operator /= (int64x64_t &lhs, const int64x64_t &rhs)
{
lhs.Div (rhs);
return lhs;
}
inline int64x64_t operator + (const int64x64_t &lhs)
{
return lhs;
}
inline int64x64_t operator - (const int64x64_t &lhs)
{
return int64x64_t (-lhs._v);
}
inline int64x64_t operator ! (const int64x64_t &lhs)
{
return int64x64_t (!lhs._v);
}
} // namespace ns3
#endif /* INT64X64_128_H */
| zy901002-gpsr | src/core/model/int64x64-128.h | C++ | gpl2 | 5,313 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA, Mathieu Lacage
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
*/
#ifndef OBJECT_MAP_H
#define OBJECT_MAP_H
#include <vector>
#include "object.h"
#include "ptr.h"
#include "attribute.h"
#include "object-ptr-container.h"
namespace ns3 {
typedef ObjectPtrContainerValue ObjectMapValue;
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (U T::*memberContainer);
template <typename T>
Ptr<const AttributeChecker> MakeObjectMapChecker (void);
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const);
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (INDEX (T::*getN)(void) const,
Ptr<U> (T::*get)(INDEX) const);
} // namespace ns3
namespace ns3 {
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (U T::*memberVector)
{
struct MemberStdContainer : public ObjectPtrContainerAccessor
{
virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const {
const T *obj = dynamic_cast<const T *> (object);
if (obj == 0)
{
return false;
}
*n = (obj->*m_memberVector).size ();
return true;
}
virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i) const {
const T *obj = static_cast<const T *> (object);
typename U::const_iterator begin = (obj->*m_memberVector).begin ();
typename U::const_iterator end = (obj->*m_memberVector).end ();
uint32_t k = 0;
for (typename U::const_iterator j = begin; j != end; j++, k++)
{
if (k == i)
{
return (*j).second;
break;
}
}
NS_ASSERT (false);
// quiet compiler.
return 0;
}
U T::*m_memberVector;
} *spec = new MemberStdContainer ();
spec->m_memberVector = memberVector;
return Ptr<const AttributeAccessor> (spec, false);
}
template <typename T>
Ptr<const AttributeChecker> MakeObjectMapChecker (void)
{
return MakeObjectPtrContainerChecker<T> ();
}
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const)
{
return MakeObjectPtrContainerAccessor<T,U,INDEX>(get, getN);
}
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (INDEX (T::*getN)(void) const,
Ptr<U> (T::*get)(INDEX) const)
{
return MakeObjectPtrContainerAccessor<T,U,INDEX>(get, getN);
}
} // namespace ns3
#endif /* OBJECT_MAP_H */
| zy901002-gpsr | src/core/model/object-map.h | C++ | gpl2 | 3,478 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "simulator.h"
#include "default-simulator-impl.h"
#include "scheduler.h"
#include "event-impl.h"
#include "ptr.h"
#include "pointer.h"
#include "assert.h"
#include "log.h"
#include <math.h>
NS_LOG_COMPONENT_DEFINE ("DefaultSimulatorImpl");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (DefaultSimulatorImpl);
TypeId
DefaultSimulatorImpl::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::DefaultSimulatorImpl")
.SetParent<SimulatorImpl> ()
.AddConstructor<DefaultSimulatorImpl> ()
;
return tid;
}
DefaultSimulatorImpl::DefaultSimulatorImpl ()
{
m_stop = false;
// uids are allocated from 4.
// uid 0 is "invalid" events
// uid 1 is "now" events
// uid 2 is "destroy" events
m_uid = 4;
// before ::Run is entered, the m_currentUid will be zero
m_currentUid = 0;
m_currentTs = 0;
m_currentContext = 0xffffffff;
m_unscheduledEvents = 0;
}
DefaultSimulatorImpl::~DefaultSimulatorImpl ()
{
}
void
DefaultSimulatorImpl::DoDispose (void)
{
while (!m_events->IsEmpty ())
{
Scheduler::Event next = m_events->RemoveNext ();
next.impl->Unref ();
}
m_events = 0;
SimulatorImpl::DoDispose ();
}
void
DefaultSimulatorImpl::Destroy ()
{
while (!m_destroyEvents.empty ())
{
Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl ();
m_destroyEvents.pop_front ();
NS_LOG_LOGIC ("handle destroy " << ev);
if (!ev->IsCancelled ())
{
ev->Invoke ();
}
}
}
void
DefaultSimulatorImpl::SetScheduler (ObjectFactory schedulerFactory)
{
Ptr<Scheduler> scheduler = schedulerFactory.Create<Scheduler> ();
if (m_events != 0)
{
while (!m_events->IsEmpty ())
{
Scheduler::Event next = m_events->RemoveNext ();
scheduler->Insert (next);
}
}
m_events = scheduler;
}
// System ID for non-distributed simulation is always zero
uint32_t
DefaultSimulatorImpl::GetSystemId (void) const
{
return 0;
}
void
DefaultSimulatorImpl::ProcessOneEvent (void)
{
Scheduler::Event next = m_events->RemoveNext ();
NS_ASSERT (next.key.m_ts >= m_currentTs);
m_unscheduledEvents--;
NS_LOG_LOGIC ("handle " << next.key.m_ts);
m_currentTs = next.key.m_ts;
m_currentContext = next.key.m_context;
m_currentUid = next.key.m_uid;
next.impl->Invoke ();
next.impl->Unref ();
}
bool
DefaultSimulatorImpl::IsFinished (void) const
{
return m_events->IsEmpty () || m_stop;
}
uint64_t
DefaultSimulatorImpl::NextTs (void) const
{
NS_ASSERT (!m_events->IsEmpty ());
Scheduler::Event ev = m_events->PeekNext ();
return ev.key.m_ts;
}
Time
DefaultSimulatorImpl::Next (void) const
{
return TimeStep (NextTs ());
}
void
DefaultSimulatorImpl::Run (void)
{
m_stop = false;
while (!m_events->IsEmpty () && !m_stop)
{
ProcessOneEvent ();
}
// If the simulator stopped naturally by lack of events, make a
// consistency test to check that we didn't lose any events along the way.
NS_ASSERT (!m_events->IsEmpty () || m_unscheduledEvents == 0);
}
void
DefaultSimulatorImpl::RunOneEvent (void)
{
ProcessOneEvent ();
}
void
DefaultSimulatorImpl::Stop (void)
{
m_stop = true;
}
void
DefaultSimulatorImpl::Stop (Time const &time)
{
Simulator::Schedule (time, &Simulator::Stop);
}
//
// Schedule an event for a _relative_ time in the future.
//
EventId
DefaultSimulatorImpl::Schedule (Time const &time, EventImpl *event)
{
Time tAbsolute = time + TimeStep (m_currentTs);
NS_ASSERT (tAbsolute.IsPositive ());
NS_ASSERT (tAbsolute >= TimeStep (m_currentTs));
Scheduler::Event ev;
ev.impl = event;
ev.key.m_ts = (uint64_t) tAbsolute.GetTimeStep ();
ev.key.m_context = GetContext ();
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
return EventId (event, ev.key.m_ts, ev.key.m_context, ev.key.m_uid);
}
void
DefaultSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event)
{
NS_LOG_FUNCTION (this << context << time.GetTimeStep () << m_currentTs << event);
Scheduler::Event ev;
ev.impl = event;
ev.key.m_ts = m_currentTs + time.GetTimeStep ();
ev.key.m_context = context;
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
}
EventId
DefaultSimulatorImpl::ScheduleNow (EventImpl *event)
{
Scheduler::Event ev;
ev.impl = event;
ev.key.m_ts = m_currentTs;
ev.key.m_context = GetContext ();
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
return EventId (event, ev.key.m_ts, ev.key.m_context, ev.key.m_uid);
}
EventId
DefaultSimulatorImpl::ScheduleDestroy (EventImpl *event)
{
EventId id (Ptr<EventImpl> (event, false), m_currentTs, 0xffffffff, 2);
m_destroyEvents.push_back (id);
m_uid++;
return id;
}
Time
DefaultSimulatorImpl::Now (void) const
{
return TimeStep (m_currentTs);
}
Time
DefaultSimulatorImpl::GetDelayLeft (const EventId &id) const
{
if (IsExpired (id))
{
return TimeStep (0);
}
else
{
return TimeStep (id.GetTs () - m_currentTs);
}
}
void
DefaultSimulatorImpl::Remove (const EventId &id)
{
if (id.GetUid () == 2)
{
// destroy events.
for (DestroyEvents::iterator i = m_destroyEvents.begin (); i != m_destroyEvents.end (); i++)
{
if (*i == id)
{
m_destroyEvents.erase (i);
break;
}
}
return;
}
if (IsExpired (id))
{
return;
}
Scheduler::Event event;
event.impl = id.PeekEventImpl ();
event.key.m_ts = id.GetTs ();
event.key.m_context = id.GetContext ();
event.key.m_uid = id.GetUid ();
m_events->Remove (event);
event.impl->Cancel ();
// whenever we remove an event from the event list, we have to unref it.
event.impl->Unref ();
m_unscheduledEvents--;
}
void
DefaultSimulatorImpl::Cancel (const EventId &id)
{
if (!IsExpired (id))
{
id.PeekEventImpl ()->Cancel ();
}
}
bool
DefaultSimulatorImpl::IsExpired (const EventId &ev) const
{
if (ev.GetUid () == 2)
{
if (ev.PeekEventImpl () == 0 ||
ev.PeekEventImpl ()->IsCancelled ())
{
return true;
}
// destroy events.
for (DestroyEvents::const_iterator i = m_destroyEvents.begin (); i != m_destroyEvents.end (); i++)
{
if (*i == ev)
{
return false;
}
}
return true;
}
if (ev.PeekEventImpl () == 0 ||
ev.GetTs () < m_currentTs ||
(ev.GetTs () == m_currentTs &&
ev.GetUid () <= m_currentUid) ||
ev.PeekEventImpl ()->IsCancelled ())
{
return true;
}
else
{
return false;
}
}
Time
DefaultSimulatorImpl::GetMaximumSimulationTime (void) const
{
// XXX: I am fairly certain other compilers use other non-standard
// post-fixes to indicate 64 bit constants.
return TimeStep (0x7fffffffffffffffLL);
}
uint32_t
DefaultSimulatorImpl::GetContext (void) const
{
return m_currentContext;
}
} // namespace ns3
| zy901002-gpsr | src/core/model/default-simulator-impl.cc | C++ | gpl2 | 7,861 |
#include "ns3/core-config.h"
#if !defined(INT64X64_CAIRO_H) && defined (INT64X64_USE_CAIRO) && !defined(PYTHON_SCAN)
#define INT64X64_CAIRO_H
#include <stdint.h>
#include <math.h>
#include "cairo-wideint-private.h"
#ifdef __i386__
// this assembly code does not appear to work right yet.
#define noInt64x64_CAIRO_ASM 1
#endif
namespace ns3 {
class int64x64_t
{
public:
inline int64x64_t ()
{
_v.hi = 0;
_v.lo = 0;
}
inline int64x64_t (double value)
{
#define HPCAIRO_MAX_64 18446744073709551615.0
double fhi = floor (value);
int64_t hi = lround (fhi);
uint64_t lo = (uint64_t)((value - fhi) * HPCAIRO_MAX_64);
_v.hi = hi;
_v.lo = lo;
#undef HPCAIRO_MAX_64
}
inline int64x64_t (int v)
{
_v.hi = v;
_v.lo = 0;
}
inline int64x64_t (long int v)
{
_v.hi = v;
_v.lo = 0;
}
inline int64x64_t (long long int v)
{
_v.hi = v;
_v.lo = 0;
}
inline int64x64_t (unsigned int v)
{
_v.hi = v;
_v.lo = 0;
}
inline int64x64_t (unsigned long int v)
{
_v.hi = v;
_v.lo = 0;
}
inline int64x64_t (unsigned long long int v)
{
_v.hi = v;
_v.lo = 0;
}
inline int64x64_t (int64_t hi, uint64_t lo)
{
_v.hi = hi;
_v.lo = lo;
}
inline int64x64_t (const int64x64_t &o)
: _v (o._v) {}
inline int64x64_t &operator = (const int64x64_t &o)
{
_v = o._v;
return *this;
}
inline double GetDouble (void) const
{
#define HPCAIRO_MAX_64 18446744073709551615.0
bool is_negative = IsNegative ();
cairo_int128_t value = is_negative ? _cairo_int128_negate (_v) : _v;
double flo = value.lo;
flo /= HPCAIRO_MAX_64;
double retval = value.hi;
retval += flo;
retval = is_negative ? -retval : retval;
return retval;
#undef HPCAIRO_MAX_64
}
inline int64_t GetHigh (void) const
{
return (int64_t)_v.hi;
}
inline uint64_t GetLow (void) const
{
return _v.lo;
}
void MulByInvert (const int64x64_t &o);
static int64x64_t Invert (uint64_t v);
private:
friend bool operator == (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator != (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator <= (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator >= (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator < (const int64x64_t &lhs, const int64x64_t &rhs);
friend bool operator > (const int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator += (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator -= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator *= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t &operator /= (int64x64_t &lhs, const int64x64_t &rhs);
friend int64x64_t operator + (const int64x64_t &lhs);
friend int64x64_t operator - (const int64x64_t &lhs);
friend int64x64_t operator ! (const int64x64_t &lhs);
void Mul (const int64x64_t &o);
void Div (const int64x64_t &o);
static cairo_uint128_t Umul (cairo_uint128_t a, cairo_uint128_t b);
static cairo_uint128_t Udiv (cairo_uint128_t a, cairo_uint128_t b);
static cairo_uint128_t UmulByInvert (cairo_uint128_t a, cairo_uint128_t b);
inline bool IsNegative (void) const
{
int64_t hi = _v.hi;
return hi < 0;
}
inline void Negate (void)
{
_v.lo = ~_v.lo;
_v.hi = ~_v.hi;
if (++_v.lo == 0)
{
++_v.hi;
}
}
inline int Compare (const int64x64_t &o) const
{
int status;
int64x64_t tmp = *this;
tmp -= o;
status = (((int64_t)(tmp)._v.hi) < 0) ? -1 :
(((tmp)._v.hi == 0 && (tmp)._v.lo == 0)) ? 0 : 1;
return status;
}
cairo_int128_t _v;
};
inline bool operator == (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs._v.hi == rhs._v.hi && lhs._v.lo == lhs._v.lo;
}
inline bool operator != (const int64x64_t &lhs, const int64x64_t &rhs)
{
return !(lhs == rhs);
}
inline bool operator < (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs.Compare (rhs) < 0;
}
inline bool operator <= (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs.Compare (rhs) <= 0;
}
inline bool operator >= (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs.Compare (rhs) >= 0;
}
inline bool operator > (const int64x64_t &lhs, const int64x64_t &rhs)
{
return lhs.Compare (rhs) > 0;
}
inline int64x64_t &operator += (int64x64_t &lhs, const int64x64_t &rhs)
{
#if Int64x64_CAIRO_ASM
asm ("mov 0(%1),%%eax\n\t"
"add %%eax,0(%0)\n\t"
"mov 4(%1),%%eax\n\t"
"adc %%eax,4(%0)\n\t"
"mov 8(%1),%%eax\n\t"
"adc %%eax,8(%0)\n\t"
"mov 12(%1),%%eax\n\t"
"adc %%eax,12(%0)\n\t"
:
: "r" (&lhs._v), "r" (&rhs._v)
: "%eax", "cc");
#else
lhs._v.hi += rhs._v.hi;
lhs._v.lo += rhs._v.lo;
if (lhs._v.lo < rhs._v.lo)
{
lhs._v.hi++;
}
#endif
return lhs;
}
inline int64x64_t &operator -= (int64x64_t &lhs, const int64x64_t &rhs)
{
#if Int64x64_CAIRO_ASM
asm ("mov 0(%1),%%eax\n\t"
"sub %%eax,0(%0)\n\t"
"mov 4(%1),%%eax\n\t"
"sbb %%eax,4(%0)\n\t"
"mov 8(%1),%%eax\n\t"
"sbb %%eax,8(%0)\n\t"
"mov 12(%1),%%eax\n\t"
"sbb %%eax,12(%0)\n\t"
:
: "r" (&lhs._v), "r" (&rhs._v)
: "%eax", "cc");
#else
lhs._v.hi -= rhs._v.hi;
lhs._v.lo -= rhs._v.lo;
if (lhs._v.lo > rhs._v.lo)
{
lhs._v.hi--;
}
#endif
return lhs;
}
inline int64x64_t &operator *= (int64x64_t &lhs, const int64x64_t &rhs)
{
lhs.Mul (rhs);
return lhs;
}
inline int64x64_t &operator /= (int64x64_t &lhs, const int64x64_t &rhs)
{
lhs.Div (rhs);
return lhs;
}
inline int64x64_t operator + (const int64x64_t &lhs)
{
return lhs;
}
inline int64x64_t operator - (const int64x64_t &lhs)
{
int64x64_t tmp = lhs;
tmp.Negate ();
return tmp;
}
inline int64x64_t operator ! (const int64x64_t &lhs)
{
return (lhs._v.hi == 0 && lhs._v.lo == 0) ? int64x64_t (1, 0) : int64x64_t ();
}
} // namespace ns3
#endif /* INT64X64_CAIRO_H */
| zy901002-gpsr | src/core/model/int64x64-cairo.h | C++ | gpl2 | 6,048 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA, Mathieu Lacage
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
*/
#include "object-ptr-container.h"
namespace ns3 {
ObjectPtrContainerValue::ObjectPtrContainerValue ()
{
}
ObjectPtrContainerValue::Iterator
ObjectPtrContainerValue::Begin (void) const
{
return m_objects.begin ();
}
ObjectPtrContainerValue::Iterator
ObjectPtrContainerValue::End (void) const
{
return m_objects.end ();
}
uint32_t
ObjectPtrContainerValue::GetN (void) const
{
return m_objects.size ();
}
Ptr<Object>
ObjectPtrContainerValue::Get (uint32_t i) const
{
return m_objects[i];
}
Ptr<AttributeValue>
ObjectPtrContainerValue::Copy (void) const
{
return ns3::Create<ObjectPtrContainerValue> (*this);
}
std::string
ObjectPtrContainerValue::SerializeToString (Ptr<const AttributeChecker> checker) const
{
std::ostringstream oss;
for (uint32_t i = 0; i < m_objects.size (); ++i)
{
oss << m_objects[i];
if (i != m_objects.size () - 1)
{
oss << " ";
}
}
return oss.str ();
}
bool
ObjectPtrContainerValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
{
NS_FATAL_ERROR ("cannot deserialize a vector of object pointers.");
return true;
}
bool
ObjectPtrContainerAccessor::Set (ObjectBase * object, const AttributeValue & value) const
{
// not allowed.
return false;
}
bool
ObjectPtrContainerAccessor::Get (const ObjectBase * object, AttributeValue &value) const
{
ObjectPtrContainerValue *v = dynamic_cast<ObjectPtrContainerValue *> (&value);
if (v == 0)
{
return false;
}
v->m_objects.clear ();
uint32_t n;
bool ok = DoGetN (object, &n);
if (!ok)
{
return false;
}
for (uint32_t i = 0; i < n; i++)
{
Ptr<Object> o = DoGet (object, i);
v->m_objects.push_back (o);
}
return true;
}
bool
ObjectPtrContainerAccessor::HasGetter (void) const
{
return true;
}
bool
ObjectPtrContainerAccessor::HasSetter (void) const
{
return false;
}
} // name
| zy901002-gpsr | src/core/model/object-ptr-container.cc | C++ | gpl2 | 2,743 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
return True
pybindgen.settings.error_handler = ErrorHandler()
import sys
def module_init():
root_module = Module('ns.core', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
module.add_class('AttributeConstructionList')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
module.add_class('Item', outer_class=root_module['ns3::AttributeConstructionList'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase')
## command-line.h (module 'core'): ns3::CommandLine [class]
module.add_class('CommandLine', allow_subclassing=True)
## system-mutex.h (module 'core'): ns3::CriticalSection [class]
module.add_class('CriticalSection')
## event-id.h (module 'core'): ns3::EventId [class]
module.add_class('EventId')
## global-value.h (module 'core'): ns3::GlobalValue [class]
module.add_class('GlobalValue')
## int-to-type.h (module 'core'): ns3::IntToType<0> [struct]
module.add_class('IntToType', template_parameters=['0'])
## int-to-type.h (module 'core'): ns3::IntToType<0>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 0 >'])
## int-to-type.h (module 'core'): ns3::IntToType<1> [struct]
module.add_class('IntToType', template_parameters=['1'])
## int-to-type.h (module 'core'): ns3::IntToType<1>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 1 >'])
## int-to-type.h (module 'core'): ns3::IntToType<2> [struct]
module.add_class('IntToType', template_parameters=['2'])
## int-to-type.h (module 'core'): ns3::IntToType<2>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 2 >'])
## int-to-type.h (module 'core'): ns3::IntToType<3> [struct]
module.add_class('IntToType', template_parameters=['3'])
## int-to-type.h (module 'core'): ns3::IntToType<3>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 3 >'])
## int-to-type.h (module 'core'): ns3::IntToType<4> [struct]
module.add_class('IntToType', template_parameters=['4'])
## int-to-type.h (module 'core'): ns3::IntToType<4>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 4 >'])
## int-to-type.h (module 'core'): ns3::IntToType<5> [struct]
module.add_class('IntToType', template_parameters=['5'])
## int-to-type.h (module 'core'): ns3::IntToType<5>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 5 >'])
## int-to-type.h (module 'core'): ns3::IntToType<6> [struct]
module.add_class('IntToType', template_parameters=['6'])
## int-to-type.h (module 'core'): ns3::IntToType<6>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 6 >'])
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent')
## names.h (module 'core'): ns3::Names [class]
module.add_class('Names')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', allow_subclassing=True)
## object.h (module 'core'): ns3::ObjectDeleter [struct]
module.add_class('ObjectDeleter')
## object-factory.h (module 'core'): ns3::ObjectFactory [class]
module.add_class('ObjectFactory')
## random-variable.h (module 'core'): ns3::RandomVariable [class]
module.add_class('RandomVariable')
## rng-stream.h (module 'core'): ns3::RngStream [class]
module.add_class('RngStream')
## random-variable.h (module 'core'): ns3::SeedManager [class]
module.add_class('SeedManager')
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
module.add_class('SequentialVariable', parent=root_module['ns3::RandomVariable'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', destructor_visibility='private')
## system-condition.h (module 'core'): ns3::SystemCondition [class]
module.add_class('SystemCondition')
## system-mutex.h (module 'core'): ns3::SystemMutex [class]
module.add_class('SystemMutex')
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs')
## timer.h (module 'core'): ns3::Timer [class]
module.add_class('Timer')
## timer.h (module 'core'): ns3::Timer::DestroyPolicy [enumeration]
module.add_enum('DestroyPolicy', ['CANCEL_ON_DESTROY', 'REMOVE_ON_DESTROY', 'CHECK_ON_DESTROY'], outer_class=root_module['ns3::Timer'])
## timer.h (module 'core'): ns3::Timer::State [enumeration]
module.add_enum('State', ['RUNNING', 'EXPIRED', 'SUSPENDED'], outer_class=root_module['ns3::Timer'])
## timer-impl.h (module 'core'): ns3::TimerImpl [class]
module.add_class('TimerImpl', allow_subclassing=True)
## random-variable.h (module 'core'): ns3::TriangularVariable [class]
module.add_class('TriangularVariable', parent=root_module['ns3::RandomVariable'])
## type-id.h (module 'core'): ns3::TypeId [class]
module.add_class('TypeId')
## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
module.add_class('AttributeInformation', outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
module.add_class('TraceSourceInformation', outer_class=root_module['ns3::TypeId'])
## random-variable.h (module 'core'): ns3::UniformVariable [class]
module.add_class('UniformVariable', parent=root_module['ns3::RandomVariable'])
## vector.h (module 'core'): ns3::Vector2D [class]
module.add_class('Vector2D')
## vector.h (module 'core'): ns3::Vector3D [class]
module.add_class('Vector3D')
## watchdog.h (module 'core'): ns3::Watchdog [class]
module.add_class('Watchdog')
## random-variable.h (module 'core'): ns3::WeibullVariable [class]
module.add_class('WeibullVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ZetaVariable [class]
module.add_class('ZetaVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ZipfVariable [class]
module.add_class('ZipfVariable', parent=root_module['ns3::RandomVariable'])
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty')
## int64x64-double.h (module 'core'): ns3::int64x64_t [class]
module.add_class('int64x64_t')
## random-variable.h (module 'core'): ns3::ConstantVariable [class]
module.add_class('ConstantVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::DeterministicVariable [class]
module.add_class('DeterministicVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::EmpiricalVariable [class]
module.add_class('EmpiricalVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ErlangVariable [class]
module.add_class('ErlangVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ExponentialVariable [class]
module.add_class('ExponentialVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::GammaVariable [class]
module.add_class('GammaVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::IntEmpiricalVariable [class]
module.add_class('IntEmpiricalVariable', parent=root_module['ns3::EmpiricalVariable'])
## random-variable.h (module 'core'): ns3::LogNormalVariable [class]
module.add_class('LogNormalVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::NormalVariable [class]
module.add_class('NormalVariable', parent=root_module['ns3::RandomVariable'])
## object.h (module 'core'): ns3::Object [class]
module.add_class('Object', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
## object.h (module 'core'): ns3::Object::AggregateIterator [class]
module.add_class('AggregateIterator', outer_class=root_module['ns3::Object'])
## random-variable.h (module 'core'): ns3::ParetoVariable [class]
module.add_class('ParetoVariable', parent=root_module['ns3::RandomVariable'])
## scheduler.h (module 'core'): ns3::Scheduler [class]
module.add_class('Scheduler', parent=root_module['ns3::Object'])
## scheduler.h (module 'core'): ns3::Scheduler::Event [struct]
module.add_class('Event', outer_class=root_module['ns3::Scheduler'])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey [struct]
module.add_class('EventKey', outer_class=root_module['ns3::Scheduler'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::FdReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::RefCountBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::RefCountBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator-impl.h (module 'core'): ns3::SimulatorImpl [class]
module.add_class('SimulatorImpl', parent=root_module['ns3::Object'])
## synchronizer.h (module 'core'): ns3::Synchronizer [class]
module.add_class('Synchronizer', parent=root_module['ns3::Object'])
## system-thread.h (module 'core'): ns3::SystemThread [class]
module.add_class('SystemThread', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
## nstime.h (module 'core'): ns3::Time [class]
module.add_class('Time')
## nstime.h (module 'core'): ns3::Time::Unit [enumeration]
module.add_enum('Unit', ['S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'])
## nstime.h (module 'core'): ns3::Time [class]
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
module.add_class('TraceSourceAccessor', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer [class]
module.add_class('WallClockSynchronizer', parent=root_module['ns3::Synchronizer'])
## attribute.h (module 'core'): ns3::AttributeAccessor [class]
module.add_class('AttributeAccessor', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
## attribute.h (module 'core'): ns3::AttributeChecker [class]
module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
## boolean.h (module 'core'): ns3::BooleanChecker [class]
module.add_class('BooleanChecker', parent=root_module['ns3::AttributeChecker'])
## boolean.h (module 'core'): ns3::BooleanValue [class]
module.add_class('BooleanValue', parent=root_module['ns3::AttributeValue'])
## calendar-scheduler.h (module 'core'): ns3::CalendarScheduler [class]
module.add_class('CalendarScheduler', parent=root_module['ns3::Scheduler'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
module.add_class('CallbackImplBase', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
## callback.h (module 'core'): ns3::CallbackValue [class]
module.add_class('CallbackValue', parent=root_module['ns3::AttributeValue'])
## default-simulator-impl.h (module 'core'): ns3::DefaultSimulatorImpl [class]
module.add_class('DefaultSimulatorImpl', parent=root_module['ns3::SimulatorImpl'])
## double.h (module 'core'): ns3::DoubleValue [class]
module.add_class('DoubleValue', parent=root_module['ns3::AttributeValue'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', parent=root_module['ns3::AttributeValue'])
## enum.h (module 'core'): ns3::EnumChecker [class]
module.add_class('EnumChecker', parent=root_module['ns3::AttributeChecker'])
## enum.h (module 'core'): ns3::EnumValue [class]
module.add_class('EnumValue', parent=root_module['ns3::AttributeValue'])
## event-impl.h (module 'core'): ns3::EventImpl [class]
module.add_class('EventImpl', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
## unix-fd-reader.h (module 'core'): ns3::FdReader [class]
module.add_class('FdReader', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >'])
## heap-scheduler.h (module 'core'): ns3::HeapScheduler [class]
module.add_class('HeapScheduler', parent=root_module['ns3::Scheduler'])
## integer.h (module 'core'): ns3::IntegerValue [class]
module.add_class('IntegerValue', parent=root_module['ns3::AttributeValue'])
## list-scheduler.h (module 'core'): ns3::ListScheduler [class]
module.add_class('ListScheduler', parent=root_module['ns3::Scheduler'])
## map-scheduler.h (module 'core'): ns3::MapScheduler [class]
module.add_class('MapScheduler', parent=root_module['ns3::Scheduler'])
## ns2-calendar-scheduler.h (module 'core'): ns3::Ns2CalendarScheduler [class]
module.add_class('Ns2CalendarScheduler', parent=root_module['ns3::Scheduler'])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class]
module.add_class('ObjectFactoryChecker', parent=root_module['ns3::AttributeChecker'])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class]
module.add_class('ObjectFactoryValue', parent=root_module['ns3::AttributeValue'])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerAccessor [class]
module.add_class('ObjectPtrContainerAccessor', parent=root_module['ns3::AttributeAccessor'])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerChecker [class]
module.add_class('ObjectPtrContainerChecker', parent=root_module['ns3::AttributeChecker'])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerValue [class]
module.add_class('ObjectPtrContainerValue', parent=root_module['ns3::AttributeValue'])
## pointer.h (module 'core'): ns3::PointerChecker [class]
module.add_class('PointerChecker', parent=root_module['ns3::AttributeChecker'])
## pointer.h (module 'core'): ns3::PointerValue [class]
module.add_class('PointerValue', parent=root_module['ns3::AttributeValue'])
## random-variable.h (module 'core'): ns3::RandomVariableChecker [class]
module.add_class('RandomVariableChecker', parent=root_module['ns3::AttributeChecker'])
## random-variable.h (module 'core'): ns3::RandomVariableValue [class]
module.add_class('RandomVariableValue', parent=root_module['ns3::AttributeValue'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl [class]
module.add_class('RealtimeSimulatorImpl', parent=root_module['ns3::SimulatorImpl'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration]
module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'])
## ref-count-base.h (module 'core'): ns3::RefCountBase [class]
module.add_class('RefCountBase', parent=root_module['ns3::SimpleRefCount< ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >'])
## string.h (module 'core'): ns3::StringChecker [class]
module.add_class('StringChecker', parent=root_module['ns3::AttributeChecker'])
## string.h (module 'core'): ns3::StringValue [class]
module.add_class('StringValue', parent=root_module['ns3::AttributeValue'])
## nstime.h (module 'core'): ns3::TimeChecker [class]
module.add_class('TimeChecker', parent=root_module['ns3::AttributeChecker'])
## nstime.h (module 'core'): ns3::TimeValue [class]
module.add_class('TimeValue', parent=root_module['ns3::AttributeValue'])
## type-id.h (module 'core'): ns3::TypeIdChecker [class]
module.add_class('TypeIdChecker', parent=root_module['ns3::AttributeChecker'])
## type-id.h (module 'core'): ns3::TypeIdValue [class]
module.add_class('TypeIdValue', parent=root_module['ns3::AttributeValue'])
## uinteger.h (module 'core'): ns3::UintegerValue [class]
module.add_class('UintegerValue', parent=root_module['ns3::AttributeValue'])
## vector.h (module 'core'): ns3::Vector2DChecker [class]
module.add_class('Vector2DChecker', parent=root_module['ns3::AttributeChecker'])
## vector.h (module 'core'): ns3::Vector2DValue [class]
module.add_class('Vector2DValue', parent=root_module['ns3::AttributeValue'])
## vector.h (module 'core'): ns3::Vector3DChecker [class]
module.add_class('Vector3DChecker', parent=root_module['ns3::AttributeChecker'])
## vector.h (module 'core'): ns3::Vector3DValue [class]
module.add_class('Vector3DValue', parent=root_module['ns3::AttributeValue'])
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue', 'ns3::ObjectVectorValue')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue*', 'ns3::ObjectVectorValue*')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue&', 'ns3::ObjectVectorValue&')
module.add_typedef(root_module['ns3::ObjectPtrContainerValue'], 'ObjectVectorValue')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&')
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
module.add_typedef(root_module['ns3::Vector3D'], 'Vector')
typehandlers.add_type_alias('ns3::Vector3DValue', 'ns3::VectorValue')
typehandlers.add_type_alias('ns3::Vector3DValue*', 'ns3::VectorValue*')
typehandlers.add_type_alias('ns3::Vector3DValue&', 'ns3::VectorValue&')
module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue', 'ns3::ObjectMapValue')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue*', 'ns3::ObjectMapValue*')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue&', 'ns3::ObjectMapValue&')
module.add_typedef(root_module['ns3::ObjectPtrContainerValue'], 'ObjectMapValue')
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
module.add_typedef(root_module['ns3::Vector3DChecker'], 'VectorChecker')
## Register a nested module for the namespace Config
nested_module = module.add_cpp_namespace('Config')
register_types_ns3_Config(nested_module)
## Register a nested module for the namespace FatalImpl
nested_module = module.add_cpp_namespace('FatalImpl')
register_types_ns3_FatalImpl(nested_module)
## Register a nested module for the namespace SystemPath
nested_module = module.add_cpp_namespace('SystemPath')
register_types_ns3_SystemPath(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
register_types_ns3_internal(nested_module)
def register_types_ns3_Config(module):
root_module = module.get_root()
## config.h (module 'core'): ns3::Config::MatchContainer [class]
module.add_class('MatchContainer')
module.add_container('std::vector< ns3::Ptr< ns3::Object > >', 'ns3::Ptr< ns3::Object >', container_type='vector')
module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
def register_types_ns3_SystemPath(module):
root_module = module.get_root()
module.add_container('std::list< std::string >', 'std::string', container_type='list')
def register_types_ns3_internal(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3CommandLine_methods(root_module, root_module['ns3::CommandLine'])
register_Ns3CriticalSection_methods(root_module, root_module['ns3::CriticalSection'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3GlobalValue_methods(root_module, root_module['ns3::GlobalValue'])
register_Ns3IntToType__0_methods(root_module, root_module['ns3::IntToType< 0 >'])
register_Ns3IntToType__1_methods(root_module, root_module['ns3::IntToType< 1 >'])
register_Ns3IntToType__2_methods(root_module, root_module['ns3::IntToType< 2 >'])
register_Ns3IntToType__3_methods(root_module, root_module['ns3::IntToType< 3 >'])
register_Ns3IntToType__4_methods(root_module, root_module['ns3::IntToType< 4 >'])
register_Ns3IntToType__5_methods(root_module, root_module['ns3::IntToType< 5 >'])
register_Ns3IntToType__6_methods(root_module, root_module['ns3::IntToType< 6 >'])
register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3Names_methods(root_module, root_module['ns3::Names'])
register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase'])
register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter'])
register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory'])
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
register_Ns3RngStream_methods(root_module, root_module['ns3::RngStream'])
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3SystemCondition_methods(root_module, root_module['ns3::SystemCondition'])
register_Ns3SystemMutex_methods(root_module, root_module['ns3::SystemMutex'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
register_Ns3TimerImpl_methods(root_module, root_module['ns3::TimerImpl'])
register_Ns3TriangularVariable_methods(root_module, root_module['ns3::TriangularVariable'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation'])
register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation'])
register_Ns3UniformVariable_methods(root_module, root_module['ns3::UniformVariable'])
register_Ns3Vector2D_methods(root_module, root_module['ns3::Vector2D'])
register_Ns3Vector3D_methods(root_module, root_module['ns3::Vector3D'])
register_Ns3Watchdog_methods(root_module, root_module['ns3::Watchdog'])
register_Ns3WeibullVariable_methods(root_module, root_module['ns3::WeibullVariable'])
register_Ns3ZetaVariable_methods(root_module, root_module['ns3::ZetaVariable'])
register_Ns3ZipfVariable_methods(root_module, root_module['ns3::ZipfVariable'])
register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t'])
register_Ns3ConstantVariable_methods(root_module, root_module['ns3::ConstantVariable'])
register_Ns3DeterministicVariable_methods(root_module, root_module['ns3::DeterministicVariable'])
register_Ns3EmpiricalVariable_methods(root_module, root_module['ns3::EmpiricalVariable'])
register_Ns3ErlangVariable_methods(root_module, root_module['ns3::ErlangVariable'])
register_Ns3ExponentialVariable_methods(root_module, root_module['ns3::ExponentialVariable'])
register_Ns3GammaVariable_methods(root_module, root_module['ns3::GammaVariable'])
register_Ns3IntEmpiricalVariable_methods(root_module, root_module['ns3::IntEmpiricalVariable'])
register_Ns3LogNormalVariable_methods(root_module, root_module['ns3::LogNormalVariable'])
register_Ns3NormalVariable_methods(root_module, root_module['ns3::NormalVariable'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
register_Ns3Scheduler_methods(root_module, root_module['ns3::Scheduler'])
register_Ns3SchedulerEvent_methods(root_module, root_module['ns3::Scheduler::Event'])
register_Ns3SchedulerEventKey_methods(root_module, root_module['ns3::Scheduler::EventKey'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >'])
register_Ns3SimpleRefCount__Ns3RefCountBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3RefCountBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >'])
register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3SimulatorImpl_methods(root_module, root_module['ns3::SimulatorImpl'])
register_Ns3Synchronizer_methods(root_module, root_module['ns3::Synchronizer'])
register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
register_Ns3WallClockSynchronizer_methods(root_module, root_module['ns3::WallClockSynchronizer'])
register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker'])
register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue'])
register_Ns3CalendarScheduler_methods(root_module, root_module['ns3::CalendarScheduler'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3DefaultSimulatorImpl_methods(root_module, root_module['ns3::DefaultSimulatorImpl'])
register_Ns3DoubleValue_methods(root_module, root_module['ns3::DoubleValue'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker'])
register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue'])
register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl'])
register_Ns3FdReader_methods(root_module, root_module['ns3::FdReader'])
register_Ns3HeapScheduler_methods(root_module, root_module['ns3::HeapScheduler'])
register_Ns3IntegerValue_methods(root_module, root_module['ns3::IntegerValue'])
register_Ns3ListScheduler_methods(root_module, root_module['ns3::ListScheduler'])
register_Ns3MapScheduler_methods(root_module, root_module['ns3::MapScheduler'])
register_Ns3Ns2CalendarScheduler_methods(root_module, root_module['ns3::Ns2CalendarScheduler'])
register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker'])
register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue'])
register_Ns3ObjectPtrContainerAccessor_methods(root_module, root_module['ns3::ObjectPtrContainerAccessor'])
register_Ns3ObjectPtrContainerChecker_methods(root_module, root_module['ns3::ObjectPtrContainerChecker'])
register_Ns3ObjectPtrContainerValue_methods(root_module, root_module['ns3::ObjectPtrContainerValue'])
register_Ns3PointerChecker_methods(root_module, root_module['ns3::PointerChecker'])
register_Ns3PointerValue_methods(root_module, root_module['ns3::PointerValue'])
register_Ns3RandomVariableChecker_methods(root_module, root_module['ns3::RandomVariableChecker'])
register_Ns3RandomVariableValue_methods(root_module, root_module['ns3::RandomVariableValue'])
register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl'])
register_Ns3RefCountBase_methods(root_module, root_module['ns3::RefCountBase'])
register_Ns3StringChecker_methods(root_module, root_module['ns3::StringChecker'])
register_Ns3StringValue_methods(root_module, root_module['ns3::StringValue'])
register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker'])
register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue'])
register_Ns3UintegerValue_methods(root_module, root_module['ns3::UintegerValue'])
register_Ns3Vector2DChecker_methods(root_module, root_module['ns3::Vector2DChecker'])
register_Ns3Vector2DValue_methods(root_module, root_module['ns3::Vector2DValue'])
register_Ns3Vector3DChecker_methods(root_module, root_module['ns3::Vector3DChecker'])
register_Ns3Vector3DValue_methods(root_module, root_module['ns3::Vector3DValue'])
register_Ns3ConfigMatchContainer_methods(root_module, root_module['ns3::Config::MatchContainer'])
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')])
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('Find',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True)
return
def register_Ns3AttributeConstructionListItem_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable]
cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False)
return
def register_Ns3CallbackBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function]
cls.add_method('GetImpl',
'ns3::Ptr< ns3::CallbackImplBase >',
[],
is_const=True)
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
return
def register_Ns3CommandLine_methods(root_module, cls):
## command-line.h (module 'core'): ns3::CommandLine::CommandLine() [constructor]
cls.add_constructor([])
## command-line.h (module 'core'): ns3::CommandLine::CommandLine(ns3::CommandLine const & cmd) [copy constructor]
cls.add_constructor([param('ns3::CommandLine const &', 'cmd')])
## command-line.h (module 'core'): void ns3::CommandLine::AddValue(std::string const & name, std::string const & help, ns3::Callback<bool, std::string, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddValue',
'void',
[param('std::string const &', 'name'), param('std::string const &', 'help'), param('ns3::Callback< bool, std::string, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
return
def register_Ns3CriticalSection_methods(root_module, cls):
## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::CriticalSection const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CriticalSection const &', 'arg0')])
## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::SystemMutex & mutex) [constructor]
cls.add_constructor([param('ns3::SystemMutex &', 'mutex')])
return
def register_Ns3EventId_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('==')
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EventId const &', 'arg0')])
## event-id.h (module 'core'): ns3::EventId::EventId() [constructor]
cls.add_constructor([])
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')])
## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function]
cls.add_method('GetTs',
'uint64_t',
[],
is_const=True)
## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function]
cls.add_method('GetUid',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function]
cls.add_method('IsExpired',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function]
cls.add_method('IsRunning',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function]
cls.add_method('PeekEventImpl',
'ns3::EventImpl *',
[],
is_const=True)
return
def register_Ns3GlobalValue_methods(root_module, cls):
## global-value.h (module 'core'): ns3::GlobalValue::GlobalValue(ns3::GlobalValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::GlobalValue const &', 'arg0')])
## global-value.h (module 'core'): ns3::GlobalValue::GlobalValue(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeChecker const> checker) [constructor]
cls.add_constructor([param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## global-value.h (module 'core'): static __gnu_cxx::__normal_iterator<ns3::GlobalValue* const*,std::vector<ns3::GlobalValue*, std::allocator<ns3::GlobalValue*> > > ns3::GlobalValue::Begin() [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::GlobalValue * const *, std::vector< ns3::GlobalValue * > >',
[],
is_static=True)
## global-value.h (module 'core'): static void ns3::GlobalValue::Bind(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Bind',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')],
is_static=True)
## global-value.h (module 'core'): static bool ns3::GlobalValue::BindFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('BindFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')],
is_static=True)
## global-value.h (module 'core'): static __gnu_cxx::__normal_iterator<ns3::GlobalValue* const*,std::vector<ns3::GlobalValue*, std::allocator<ns3::GlobalValue*> > > ns3::GlobalValue::End() [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::GlobalValue * const *, std::vector< ns3::GlobalValue * > >',
[],
is_static=True)
## global-value.h (module 'core'): ns3::Ptr<ns3::AttributeChecker const> ns3::GlobalValue::GetChecker() const [member function]
cls.add_method('GetChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[],
is_const=True)
## global-value.h (module 'core'): std::string ns3::GlobalValue::GetHelp() const [member function]
cls.add_method('GetHelp',
'std::string',
[],
is_const=True)
## global-value.h (module 'core'): std::string ns3::GlobalValue::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## global-value.h (module 'core'): void ns3::GlobalValue::GetValue(ns3::AttributeValue & value) const [member function]
cls.add_method('GetValue',
'void',
[param('ns3::AttributeValue &', 'value')],
is_const=True)
## global-value.h (module 'core'): static void ns3::GlobalValue::GetValueByName(std::string name, ns3::AttributeValue & value) [member function]
cls.add_method('GetValueByName',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_static=True)
## global-value.h (module 'core'): static bool ns3::GlobalValue::GetValueByNameFailSafe(std::string name, ns3::AttributeValue & value) [member function]
cls.add_method('GetValueByNameFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_static=True)
## global-value.h (module 'core'): void ns3::GlobalValue::ResetInitialValue() [member function]
cls.add_method('ResetInitialValue',
'void',
[])
## global-value.h (module 'core'): bool ns3::GlobalValue::SetValue(ns3::AttributeValue const & value) [member function]
cls.add_method('SetValue',
'bool',
[param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3IntToType__0_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<0>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<0>::IntToType(ns3::IntToType<0> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 0 > const &', 'arg0')])
return
def register_Ns3IntToType__1_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<1>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<1>::IntToType(ns3::IntToType<1> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 1 > const &', 'arg0')])
return
def register_Ns3IntToType__2_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<2>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<2>::IntToType(ns3::IntToType<2> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 2 > const &', 'arg0')])
return
def register_Ns3IntToType__3_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<3>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<3>::IntToType(ns3::IntToType<3> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 3 > const &', 'arg0')])
return
def register_Ns3IntToType__4_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<4>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<4>::IntToType(ns3::IntToType<4> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 4 > const &', 'arg0')])
return
def register_Ns3IntToType__5_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<5>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<5>::IntToType(ns3::IntToType<5> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 5 > const &', 'arg0')])
return
def register_Ns3IntToType__6_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<6>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<6>::IntToType(ns3::IntToType<6> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 6 > const &', 'arg0')])
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
cls.add_method('EnvVarCheck',
'void',
[param('char const *', 'name')])
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
return
def register_Ns3Names_methods(root_module, cls):
## names.h (module 'core'): ns3::Names::Names() [constructor]
cls.add_constructor([])
## names.h (module 'core'): ns3::Names::Names(ns3::Names const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Names const &', 'arg0')])
## names.h (module 'core'): static void ns3::Names::Add(std::string name, ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Add(std::string path, std::string name, ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'path'), param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Add(ns3::Ptr<ns3::Object> context, std::string name, ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Object >', 'context'), param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Clear() [member function]
cls.add_method('Clear',
'void',
[],
is_static=True)
## names.h (module 'core'): static std::string ns3::Names::FindName(ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('FindName',
'std::string',
[param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static std::string ns3::Names::FindPath(ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('FindPath',
'std::string',
[param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Rename(std::string oldpath, std::string newname) [member function]
cls.add_method('Rename',
'void',
[param('std::string', 'oldpath'), param('std::string', 'newname')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Rename(std::string path, std::string oldname, std::string newname) [member function]
cls.add_method('Rename',
'void',
[param('std::string', 'path'), param('std::string', 'oldname'), param('std::string', 'newname')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Rename(ns3::Ptr<ns3::Object> context, std::string oldname, std::string newname) [member function]
cls.add_method('Rename',
'void',
[param('ns3::Ptr< ns3::Object >', 'context'), param('std::string', 'oldname'), param('std::string', 'newname')],
is_static=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor]
cls.add_constructor([])
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')])
## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function]
cls.add_method('GetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')],
is_const=True)
## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function]
cls.add_method('ConstructSelf',
'void',
[param('ns3::AttributeConstructionList const &', 'attributes')],
visibility='protected')
## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectDeleter_methods(root_module, cls):
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor]
cls.add_constructor([])
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')])
## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Object *', 'object')],
is_static=True)
return
def register_Ns3ObjectFactory_methods(root_module, cls):
cls.add_output_stream_operator()
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor]
cls.add_constructor([param('std::string', 'typeId')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::Object >',
[],
is_const=True)
## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('ns3::TypeId', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('char const *', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('std::string', 'tid')])
return
def register_Ns3RandomVariable_methods(root_module, cls):
cls.add_output_stream_operator()
## random-variable.h (module 'core'): ns3::RandomVariable::RandomVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::RandomVariable::RandomVariable(ns3::RandomVariable const & o) [copy constructor]
cls.add_constructor([param('ns3::RandomVariable const &', 'o')])
## random-variable.h (module 'core'): uint32_t ns3::RandomVariable::GetInteger() const [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::RandomVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
return
def register_Ns3RngStream_methods(root_module, cls):
## rng-stream.h (module 'core'): ns3::RngStream::RngStream() [constructor]
cls.add_constructor([])
## rng-stream.h (module 'core'): ns3::RngStream::RngStream(ns3::RngStream const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RngStream const &', 'arg0')])
## rng-stream.h (module 'core'): void ns3::RngStream::AdvanceState(int32_t e, int32_t c) [member function]
cls.add_method('AdvanceState',
'void',
[param('int32_t', 'e'), param('int32_t', 'c')])
## rng-stream.h (module 'core'): static bool ns3::RngStream::CheckSeed(uint32_t const * seed) [member function]
cls.add_method('CheckSeed',
'bool',
[param('uint32_t const *', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): static bool ns3::RngStream::CheckSeed(uint32_t seed) [member function]
cls.add_method('CheckSeed',
'bool',
[param('uint32_t', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): static uint32_t ns3::RngStream::GetPackageRun() [member function]
cls.add_method('GetPackageRun',
'uint32_t',
[],
is_static=True)
## rng-stream.h (module 'core'): static void ns3::RngStream::GetPackageSeed(uint32_t * seed) [member function]
cls.add_method('GetPackageSeed',
'void',
[param('uint32_t *', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): void ns3::RngStream::GetState(uint32_t * seed) const [member function]
cls.add_method('GetState',
'void',
[param('uint32_t *', 'seed')],
is_const=True)
## rng-stream.h (module 'core'): void ns3::RngStream::IncreasedPrecis(bool incp) [member function]
cls.add_method('IncreasedPrecis',
'void',
[param('bool', 'incp')])
## rng-stream.h (module 'core'): void ns3::RngStream::InitializeStream() [member function]
cls.add_method('InitializeStream',
'void',
[])
## rng-stream.h (module 'core'): int32_t ns3::RngStream::RandInt(int32_t i, int32_t j) [member function]
cls.add_method('RandInt',
'int32_t',
[param('int32_t', 'i'), param('int32_t', 'j')])
## rng-stream.h (module 'core'): double ns3::RngStream::RandU01() [member function]
cls.add_method('RandU01',
'double',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetNextSubstream() [member function]
cls.add_method('ResetNextSubstream',
'void',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetNthSubstream(uint32_t N) [member function]
cls.add_method('ResetNthSubstream',
'void',
[param('uint32_t', 'N')])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetStartStream() [member function]
cls.add_method('ResetStartStream',
'void',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetStartSubstream() [member function]
cls.add_method('ResetStartSubstream',
'void',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::SetAntithetic(bool a) [member function]
cls.add_method('SetAntithetic',
'void',
[param('bool', 'a')])
## rng-stream.h (module 'core'): static void ns3::RngStream::SetPackageRun(uint32_t run) [member function]
cls.add_method('SetPackageRun',
'void',
[param('uint32_t', 'run')],
is_static=True)
## rng-stream.h (module 'core'): static bool ns3::RngStream::SetPackageSeed(uint32_t seed) [member function]
cls.add_method('SetPackageSeed',
'bool',
[param('uint32_t', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): static bool ns3::RngStream::SetPackageSeed(uint32_t const * seed) [member function]
cls.add_method('SetPackageSeed',
'bool',
[param('uint32_t const *', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): bool ns3::RngStream::SetSeeds(uint32_t const * seed) [member function]
cls.add_method('SetSeeds',
'bool',
[param('uint32_t const *', 'seed')])
return
def register_Ns3SeedManager_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
cls.add_method('CheckSeed',
'bool',
[param('uint32_t', 'seed')],
is_static=True)
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
cls.add_method('GetRun',
'uint32_t',
[],
is_static=True)
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
cls.add_method('GetSeed',
'uint32_t',
[],
is_static=True)
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
cls.add_method('SetRun',
'void',
[param('uint32_t', 'run')],
is_static=True)
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
cls.add_method('SetSeed',
'void',
[param('uint32_t', 'seed')],
is_static=True)
return
def register_Ns3SequentialVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(ns3::SequentialVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SequentialVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(double f, double l, double i=1, uint32_t c=1) [constructor]
cls.add_constructor([param('double', 'f'), param('double', 'l'), param('double', 'i', default_value='1'), param('uint32_t', 'c', default_value='1')])
## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(double f, double l, ns3::RandomVariable const & i, uint32_t c=1) [constructor]
cls.add_constructor([param('double', 'f'), param('double', 'l'), param('ns3::RandomVariable const &', 'i'), param('uint32_t', 'c', default_value='1')])
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3Simulator_methods(root_module, cls):
## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Simulator const &', 'arg0')])
## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function]
cls.add_method('GetImplementation',
'ns3::Ptr< ns3::SimulatorImpl >',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function]
cls.add_method('IsFinished',
'bool',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Next() [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
cls.add_method('SetImplementation',
'void',
[param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_static=True)
return
def register_Ns3SystemCondition_methods(root_module, cls):
## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition(ns3::SystemCondition const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemCondition const &', 'arg0')])
## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition() [constructor]
cls.add_constructor([])
## system-condition.h (module 'core'): void ns3::SystemCondition::Broadcast() [member function]
cls.add_method('Broadcast',
'void',
[])
## system-condition.h (module 'core'): bool ns3::SystemCondition::GetCondition() [member function]
cls.add_method('GetCondition',
'bool',
[])
## system-condition.h (module 'core'): void ns3::SystemCondition::SetCondition(bool condition) [member function]
cls.add_method('SetCondition',
'void',
[param('bool', 'condition')])
## system-condition.h (module 'core'): void ns3::SystemCondition::Signal() [member function]
cls.add_method('Signal',
'void',
[])
## system-condition.h (module 'core'): bool ns3::SystemCondition::TimedWait(uint64_t ns) [member function]
cls.add_method('TimedWait',
'bool',
[param('uint64_t', 'ns')])
## system-condition.h (module 'core'): void ns3::SystemCondition::Wait() [member function]
cls.add_method('Wait',
'void',
[])
return
def register_Ns3SystemMutex_methods(root_module, cls):
## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex(ns3::SystemMutex const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemMutex const &', 'arg0')])
## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex() [constructor]
cls.add_constructor([])
## system-mutex.h (module 'core'): void ns3::SystemMutex::Lock() [member function]
cls.add_method('Lock',
'void',
[])
## system-mutex.h (module 'core'): void ns3::SystemMutex::Unlock() [member function]
cls.add_method('Unlock',
'void',
[])
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor]
cls.add_constructor([])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function]
cls.add_method('End',
'int64_t',
[])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function]
cls.add_method('GetElapsedReal',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function]
cls.add_method('GetElapsedSystem',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function]
cls.add_method('GetElapsedUser',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Timer_methods(root_module, cls):
## timer.h (module 'core'): ns3::Timer::Timer(ns3::Timer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Timer const &', 'arg0')])
## timer.h (module 'core'): ns3::Timer::Timer() [constructor]
cls.add_constructor([])
## timer.h (module 'core'): ns3::Timer::Timer(ns3::Timer::DestroyPolicy destroyPolicy) [constructor]
cls.add_constructor([param('ns3::Timer::DestroyPolicy', 'destroyPolicy')])
## timer.h (module 'core'): void ns3::Timer::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## timer.h (module 'core'): ns3::Time ns3::Timer::GetDelay() const [member function]
cls.add_method('GetDelay',
'ns3::Time',
[],
is_const=True)
## timer.h (module 'core'): ns3::Time ns3::Timer::GetDelayLeft() const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[],
is_const=True)
## timer.h (module 'core'): ns3::Timer::State ns3::Timer::GetState() const [member function]
cls.add_method('GetState',
'ns3::Timer::State',
[],
is_const=True)
## timer.h (module 'core'): bool ns3::Timer::IsExpired() const [member function]
cls.add_method('IsExpired',
'bool',
[],
is_const=True)
## timer.h (module 'core'): bool ns3::Timer::IsRunning() const [member function]
cls.add_method('IsRunning',
'bool',
[],
is_const=True)
## timer.h (module 'core'): bool ns3::Timer::IsSuspended() const [member function]
cls.add_method('IsSuspended',
'bool',
[],
is_const=True)
## timer.h (module 'core'): void ns3::Timer::Remove() [member function]
cls.add_method('Remove',
'void',
[])
## timer.h (module 'core'): void ns3::Timer::Resume() [member function]
cls.add_method('Resume',
'void',
[])
## timer.h (module 'core'): void ns3::Timer::Schedule() [member function]
cls.add_method('Schedule',
'void',
[])
## timer.h (module 'core'): void ns3::Timer::Schedule(ns3::Time delay) [member function]
cls.add_method('Schedule',
'void',
[param('ns3::Time', 'delay')])
## timer.h (module 'core'): void ns3::Timer::SetDelay(ns3::Time const & delay) [member function]
cls.add_method('SetDelay',
'void',
[param('ns3::Time const &', 'delay')])
## timer.h (module 'core'): void ns3::Timer::Suspend() [member function]
cls.add_method('Suspend',
'void',
[])
return
def register_Ns3TimerImpl_methods(root_module, cls):
## timer-impl.h (module 'core'): ns3::TimerImpl::TimerImpl() [constructor]
cls.add_constructor([])
## timer-impl.h (module 'core'): ns3::TimerImpl::TimerImpl(ns3::TimerImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimerImpl const &', 'arg0')])
## timer-impl.h (module 'core'): void ns3::TimerImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## timer-impl.h (module 'core'): ns3::EventId ns3::TimerImpl::Schedule(ns3::Time const & delay) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'delay')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3TriangularVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable(ns3::TriangularVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TriangularVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable(double s, double l, double mean) [constructor]
cls.add_constructor([param('double', 's'), param('double', 'l'), param('double', 'mean')])
return
def register_Ns3TypeId_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor]
cls.add_constructor([param('ns3::TypeId const &', 'o')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function]
cls.add_method('GetConstructor',
'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function]
cls.add_method('GetGroupName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function]
cls.add_method('GetParent',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint32_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint32_t',
[],
is_static=True)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function]
cls.add_method('GetUid',
'uint16_t',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function]
cls.add_method('HasConstructor',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function]
cls.add_method('HasParent',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function]
cls.add_method('HideFromDocumentation',
'ns3::TypeId',
[])
## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function]
cls.add_method('IsChildOf',
'bool',
[param('ns3::TypeId', 'other')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function]
cls.add_method('LookupAttributeByName',
'bool',
[param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info')],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function]
cls.add_method('LookupByName',
'ns3::TypeId',
[param('std::string', 'name')],
is_static=True)
## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function]
cls.add_method('MustHideFromDocumentation',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function]
cls.add_method('SetGroupName',
'ns3::TypeId',
[param('std::string', 'groupName')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[param('ns3::TypeId', 'tid')])
## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'tid')])
return
def register_Ns3TypeIdAttributeInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable]
cls.add_instance_attribute('flags', 'uint32_t', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable]
cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable]
cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
return
def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
return
def register_Ns3UniformVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable(ns3::UniformVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UniformVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable(double s, double l) [constructor]
cls.add_constructor([param('double', 's'), param('double', 'l')])
## random-variable.h (module 'core'): uint32_t ns3::UniformVariable::GetInteger(uint32_t s, uint32_t l) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 's'), param('uint32_t', 'l')])
## random-variable.h (module 'core'): double ns3::UniformVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::UniformVariable::GetValue(double s, double l) [member function]
cls.add_method('GetValue',
'double',
[param('double', 's'), param('double', 'l')])
return
def register_Ns3Vector2D_methods(root_module, cls):
cls.add_output_stream_operator()
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
cls.add_constructor([param('double', '_x'), param('double', '_y')])
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector2D::x [variable]
cls.add_instance_attribute('x', 'double', is_const=False)
## vector.h (module 'core'): ns3::Vector2D::y [variable]
cls.add_instance_attribute('y', 'double', is_const=False)
return
def register_Ns3Vector3D_methods(root_module, cls):
cls.add_output_stream_operator()
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector3D::x [variable]
cls.add_instance_attribute('x', 'double', is_const=False)
## vector.h (module 'core'): ns3::Vector3D::y [variable]
cls.add_instance_attribute('y', 'double', is_const=False)
## vector.h (module 'core'): ns3::Vector3D::z [variable]
cls.add_instance_attribute('z', 'double', is_const=False)
return
def register_Ns3Watchdog_methods(root_module, cls):
## watchdog.h (module 'core'): ns3::Watchdog::Watchdog(ns3::Watchdog const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Watchdog const &', 'arg0')])
## watchdog.h (module 'core'): ns3::Watchdog::Watchdog() [constructor]
cls.add_constructor([])
## watchdog.h (module 'core'): void ns3::Watchdog::Ping(ns3::Time delay) [member function]
cls.add_method('Ping',
'void',
[param('ns3::Time', 'delay')])
return
def register_Ns3WeibullVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(ns3::WeibullVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::WeibullVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m) [constructor]
cls.add_constructor([param('double', 'm')])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m, double s) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's')])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m, double s, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')])
return
def register_Ns3ZetaVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable(ns3::ZetaVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ZetaVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable(double alpha) [constructor]
cls.add_constructor([param('double', 'alpha')])
## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable() [constructor]
cls.add_constructor([])
return
def register_Ns3ZipfVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable(ns3::ZipfVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ZipfVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable(long int N, double alpha) [constructor]
cls.add_constructor([param('long int', 'N'), param('double', 'alpha')])
## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable() [constructor]
cls.add_constructor([])
return
def register_Ns3Empty_methods(root_module, cls):
## empty.h (module 'core'): ns3::empty::empty() [constructor]
cls.add_constructor([])
## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor]
cls.add_constructor([param('ns3::empty const &', 'arg0')])
return
def register_Ns3Int64x64_t_methods(root_module, cls):
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_unary_numeric_operator('-')
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
cls.add_constructor([])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor]
cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'o')])
## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function]
cls.add_method('GetHigh',
'int64_t',
[],
is_const=True)
## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function]
cls.add_method('GetLow',
'uint64_t',
[],
is_const=True)
## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function]
cls.add_method('Invert',
'ns3::int64x64_t',
[param('uint64_t', 'v')],
is_static=True)
## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function]
cls.add_method('MulByInvert',
'void',
[param('ns3::int64x64_t const &', 'o')])
return
def register_Ns3ConstantVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable(ns3::ConstantVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ConstantVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable(double c) [constructor]
cls.add_constructor([param('double', 'c')])
## random-variable.h (module 'core'): void ns3::ConstantVariable::SetConstant(double c) [member function]
cls.add_method('SetConstant',
'void',
[param('double', 'c')])
return
def register_Ns3DeterministicVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::DeterministicVariable::DeterministicVariable(ns3::DeterministicVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DeterministicVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::DeterministicVariable::DeterministicVariable(double * d, uint32_t c) [constructor]
cls.add_constructor([param('double *', 'd'), param('uint32_t', 'c')])
return
def register_Ns3EmpiricalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::EmpiricalVariable::EmpiricalVariable(ns3::EmpiricalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmpiricalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::EmpiricalVariable::EmpiricalVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): void ns3::EmpiricalVariable::CDF(double v, double c) [member function]
cls.add_method('CDF',
'void',
[param('double', 'v'), param('double', 'c')])
return
def register_Ns3ErlangVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable(ns3::ErlangVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ErlangVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable(unsigned int k, double lambda) [constructor]
cls.add_constructor([param('unsigned int', 'k'), param('double', 'lambda')])
## random-variable.h (module 'core'): double ns3::ErlangVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::ErlangVariable::GetValue(unsigned int k, double lambda) const [member function]
cls.add_method('GetValue',
'double',
[param('unsigned int', 'k'), param('double', 'lambda')],
is_const=True)
return
def register_Ns3ExponentialVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(ns3::ExponentialVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ExponentialVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(double m) [constructor]
cls.add_constructor([param('double', 'm')])
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(double m, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 'b')])
return
def register_Ns3GammaVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable(ns3::GammaVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::GammaVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable(double alpha, double beta) [constructor]
cls.add_constructor([param('double', 'alpha'), param('double', 'beta')])
## random-variable.h (module 'core'): double ns3::GammaVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::GammaVariable::GetValue(double alpha, double beta) const [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha'), param('double', 'beta')],
is_const=True)
return
def register_Ns3IntEmpiricalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::IntEmpiricalVariable::IntEmpiricalVariable(ns3::IntEmpiricalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntEmpiricalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::IntEmpiricalVariable::IntEmpiricalVariable() [constructor]
cls.add_constructor([])
return
def register_Ns3LogNormalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::LogNormalVariable::LogNormalVariable(ns3::LogNormalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogNormalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::LogNormalVariable::LogNormalVariable(double mu, double sigma) [constructor]
cls.add_constructor([param('double', 'mu'), param('double', 'sigma')])
return
def register_Ns3NormalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(ns3::NormalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NormalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(double m, double v) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 'v')])
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(double m, double v, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 'v'), param('double', 'b')])
return
def register_Ns3Object_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::Object() [constructor]
cls.add_constructor([])
## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function]
cls.add_method('AggregateObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'other')])
## object.h (module 'core'): void ns3::Object::Dispose() [member function]
cls.add_method('Dispose',
'void',
[])
## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function]
cls.add_method('GetAggregateIterator',
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object> ns3::Object::GetObject(ns3::TypeId tid) const [member function]
cls.add_method('GetObject',
'ns3::Ptr< ns3::Object >',
[param('ns3::TypeId', 'tid')],
is_const=True, template_parameters=['ns3::Object'], custom_template_method_name='GetObject')
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object.h (module 'core'): void ns3::Object::Start() [member function]
cls.add_method('Start',
'void',
[])
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor]
cls.add_constructor([param('ns3::Object const &', 'o')],
visibility='protected')
## object.h (module 'core'): void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::DoStart() [member function]
cls.add_method('DoStart',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectAggregateIterator_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')])
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor]
cls.add_constructor([])
## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3ParetoVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(ns3::ParetoVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ParetoVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m) [constructor]
cls.add_constructor([param('double', 'm')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m, double s) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m, double s, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(std::pair<double,double> params) [constructor]
cls.add_constructor([param('std::pair< double, double >', 'params')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(std::pair<double,double> params, double b) [constructor]
cls.add_constructor([param('std::pair< double, double >', 'params'), param('double', 'b')])
return
def register_Ns3Scheduler_methods(root_module, cls):
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler(ns3::Scheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler const &', 'arg0')])
## scheduler.h (module 'core'): static ns3::TypeId ns3::Scheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): bool ns3::Scheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3SchedulerEvent_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event(ns3::Scheduler::Event const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::Event const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::Event::impl [variable]
cls.add_instance_attribute('impl', 'ns3::EventImpl *', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::Event::key [variable]
cls.add_instance_attribute('key', 'ns3::Scheduler::EventKey', is_const=False)
return
def register_Ns3SchedulerEventKey_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::EventKey const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_context [variable]
cls.add_instance_attribute('m_context', 'uint32_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_ts [variable]
cls.add_instance_attribute('m_ts', 'uint64_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_uid [variable]
cls.add_instance_attribute('m_uid', 'uint32_t', is_const=False)
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter< ns3::FdReader > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3RefCountBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3RefCountBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter< ns3::RefCountBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount(ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter< ns3::SystemThread > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimulatorImpl_methods(root_module, cls):
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl() [constructor]
cls.add_constructor([])
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl(ns3::SimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimulatorImpl const &', 'arg0')])
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): static ns3::TypeId ns3::SimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Synchronizer_methods(root_module, cls):
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer(ns3::Synchronizer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Synchronizer const &', 'arg0')])
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer() [constructor]
cls.add_constructor([])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::EventEnd() [member function]
cls.add_method('EventEnd',
'uint64_t',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::EventStart() [member function]
cls.add_method('EventStart',
'void',
[])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetCurrentRealtime() [member function]
cls.add_method('GetCurrentRealtime',
'uint64_t',
[])
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::GetDrift(uint64_t ts) [member function]
cls.add_method('GetDrift',
'int64_t',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetOrigin() [member function]
cls.add_method('GetOrigin',
'uint64_t',
[])
## synchronizer.h (module 'core'): static ns3::TypeId ns3::Synchronizer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Realtime() [member function]
cls.add_method('Realtime',
'bool',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetCondition(bool arg0) [member function]
cls.add_method('SetCondition',
'void',
[param('bool', 'arg0')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetOrigin(uint64_t ts) [member function]
cls.add_method('SetOrigin',
'void',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::Signal() [member function]
cls.add_method('Signal',
'void',
[])
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Synchronize(uint64_t tsCurrent, uint64_t tsDelay) [member function]
cls.add_method('Synchronize',
'bool',
[param('uint64_t', 'tsCurrent'), param('uint64_t', 'tsDelay')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoEventEnd() [member function]
cls.add_method('DoEventEnd',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoEventStart() [member function]
cls.add_method('DoEventStart',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoGetCurrentRealtime() [member function]
cls.add_method('DoGetCurrentRealtime',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::DoGetDrift(uint64_t ns) [member function]
cls.add_method('DoGetDrift',
'int64_t',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoRealtime() [member function]
cls.add_method('DoRealtime',
'bool',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetCondition(bool arg0) [member function]
cls.add_method('DoSetCondition',
'void',
[param('bool', 'arg0')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetOrigin(uint64_t ns) [member function]
cls.add_method('DoSetOrigin',
'void',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSignal() [member function]
cls.add_method('DoSignal',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function]
cls.add_method('DoSynchronize',
'bool',
[param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3SystemThread_methods(root_module, cls):
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemThread const &', 'arg0')])
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor]
cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function]
cls.add_method('Break',
'bool',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function]
cls.add_method('Join',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function]
cls.add_method('Shutdown',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor]
cls.add_constructor([param('ns3::Time const &', 'o')])
## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor]
cls.add_constructor([param('std::string const &', 's')])
## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'value')])
## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function]
cls.add_method('Compare',
'int',
[param('ns3::Time const &', 'o')],
is_const=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & from, ns3::Time::Unit timeUnit) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'from'), param('ns3::Time::Unit', 'timeUnit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'value')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit timeUnit) [member function]
cls.add_method('FromDouble',
'ns3::Time',
[param('double', 'value'), param('ns3::Time::Unit', 'timeUnit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit timeUnit) [member function]
cls.add_method('FromInteger',
'ns3::Time',
[param('uint64_t', 'value'), param('ns3::Time::Unit', 'timeUnit')],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function]
cls.add_method('GetFemtoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function]
cls.add_method('GetInteger',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function]
cls.add_method('GetMicroSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function]
cls.add_method('GetMilliSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function]
cls.add_method('GetNanoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function]
cls.add_method('GetPicoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function]
cls.add_method('GetResolution',
'ns3::Time::Unit',
[],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function]
cls.add_method('GetSeconds',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function]
cls.add_method('GetTimeStep',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function]
cls.add_method('IsNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function]
cls.add_method('IsPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function]
cls.add_method('IsStrictlyNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function]
cls.add_method('IsStrictlyPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function]
cls.add_method('IsZero',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function]
cls.add_method('SetResolution',
'void',
[param('ns3::Time::Unit', 'resolution')],
is_static=True)
## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit timeUnit) const [member function]
cls.add_method('To',
'ns3::int64x64_t',
[param('ns3::Time::Unit', 'timeUnit')],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit timeUnit) const [member function]
cls.add_method('ToDouble',
'double',
[param('ns3::Time::Unit', 'timeUnit')],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit timeUnit) const [member function]
cls.add_method('ToInteger',
'int64_t',
[param('ns3::Time::Unit', 'timeUnit')],
is_const=True)
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor]
cls.add_constructor([])
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Connect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('ConnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Disconnect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('DisconnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3WallClockSynchronizer_methods(root_module, cls):
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::WallClockSynchronizer(ns3::WallClockSynchronizer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::WallClockSynchronizer const &', 'arg0')])
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::WallClockSynchronizer() [constructor]
cls.add_constructor([])
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::NS_PER_SEC [variable]
cls.add_static_attribute('NS_PER_SEC', 'uint64_t const', is_const=True)
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::US_PER_NS [variable]
cls.add_static_attribute('US_PER_NS', 'uint64_t const', is_const=True)
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::US_PER_SEC [variable]
cls.add_static_attribute('US_PER_SEC', 'uint64_t const', is_const=True)
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::DoEventEnd() [member function]
cls.add_method('DoEventEnd',
'uint64_t',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoEventStart() [member function]
cls.add_method('DoEventStart',
'void',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::DoGetCurrentRealtime() [member function]
cls.add_method('DoGetCurrentRealtime',
'uint64_t',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): int64_t ns3::WallClockSynchronizer::DoGetDrift(uint64_t ns) [member function]
cls.add_method('DoGetDrift',
'int64_t',
[param('uint64_t', 'ns')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::DoRealtime() [member function]
cls.add_method('DoRealtime',
'bool',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoSetCondition(bool cond) [member function]
cls.add_method('DoSetCondition',
'void',
[param('bool', 'cond')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoSetOrigin(uint64_t ns) [member function]
cls.add_method('DoSetOrigin',
'void',
[param('uint64_t', 'ns')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoSignal() [member function]
cls.add_method('DoSignal',
'void',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function]
cls.add_method('DoSynchronize',
'bool',
[param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::DriftCorrect(uint64_t nsNow, uint64_t nsDelay) [member function]
cls.add_method('DriftCorrect',
'uint64_t',
[param('uint64_t', 'nsNow'), param('uint64_t', 'nsDelay')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::GetNormalizedRealtime() [member function]
cls.add_method('GetNormalizedRealtime',
'uint64_t',
[],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::GetRealtime() [member function]
cls.add_method('GetRealtime',
'uint64_t',
[],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::NsToTimeval(int64_t ns, timeval * tv) [member function]
cls.add_method('NsToTimeval',
'void',
[param('int64_t', 'ns'), param('timeval *', 'tv')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::SleepWait(uint64_t arg0) [member function]
cls.add_method('SleepWait',
'bool',
[param('uint64_t', 'arg0')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::SpinWait(uint64_t arg0) [member function]
cls.add_method('SpinWait',
'bool',
[param('uint64_t', 'arg0')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::TimevalAdd(timeval * tv1, timeval * tv2, timeval * result) [member function]
cls.add_method('TimevalAdd',
'void',
[param('timeval *', 'tv1'), param('timeval *', 'tv2'), param('timeval *', 'result')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::TimevalToNs(timeval * tv) [member function]
cls.add_method('TimevalToNs',
'uint64_t',
[param('timeval *', 'tv')],
visibility='protected')
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3BooleanChecker_methods(root_module, cls):
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BooleanChecker const &', 'arg0')])
return
def register_Ns3BooleanValue_methods(root_module, cls):
cls.add_output_stream_operator()
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(ns3::BooleanValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BooleanValue const &', 'arg0')])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(bool value) [constructor]
cls.add_constructor([param('bool', 'value')])
## boolean.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::BooleanValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::Get() const [member function]
cls.add_method('Get',
'bool',
[],
is_const=True)
## boolean.h (module 'core'): std::string ns3::BooleanValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): void ns3::BooleanValue::Set(bool value) [member function]
cls.add_method('Set',
'void',
[param('bool', 'value')])
return
def register_Ns3CalendarScheduler_methods(root_module, cls):
## calendar-scheduler.h (module 'core'): ns3::CalendarScheduler::CalendarScheduler(ns3::CalendarScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CalendarScheduler const &', 'arg0')])
## calendar-scheduler.h (module 'core'): ns3::CalendarScheduler::CalendarScheduler() [constructor]
cls.add_constructor([])
## calendar-scheduler.h (module 'core'): static ns3::TypeId ns3::CalendarScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## calendar-scheduler.h (module 'core'): void ns3::CalendarScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## calendar-scheduler.h (module 'core'): bool ns3::CalendarScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::CalendarScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## calendar-scheduler.h (module 'core'): void ns3::CalendarScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::CalendarScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3DefaultSimulatorImpl_methods(root_module, cls):
## default-simulator-impl.h (module 'core'): ns3::DefaultSimulatorImpl::DefaultSimulatorImpl(ns3::DefaultSimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DefaultSimulatorImpl const &', 'arg0')])
## default-simulator-impl.h (module 'core'): ns3::DefaultSimulatorImpl::DefaultSimulatorImpl() [constructor]
cls.add_constructor([])
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): uint32_t ns3::DefaultSimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): uint32_t ns3::DefaultSimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): static ns3::TypeId ns3::DefaultSimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## default-simulator-impl.h (module 'core'): bool ns3::DefaultSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): bool ns3::DefaultSimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3DoubleValue_methods(root_module, cls):
## double.h (module 'core'): ns3::DoubleValue::DoubleValue() [constructor]
cls.add_constructor([])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(ns3::DoubleValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DoubleValue const &', 'arg0')])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(double const & value) [constructor]
cls.add_constructor([param('double const &', 'value')])
## double.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::DoubleValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## double.h (module 'core'): bool ns3::DoubleValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## double.h (module 'core'): double ns3::DoubleValue::Get() const [member function]
cls.add_method('Get',
'double',
[],
is_const=True)
## double.h (module 'core'): std::string ns3::DoubleValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## double.h (module 'core'): void ns3::DoubleValue::Set(double const & value) [member function]
cls.add_method('Set',
'void',
[param('double const &', 'value')])
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3EnumChecker_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker(ns3::EnumChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EnumChecker const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): void ns3::EnumChecker::Add(int v, std::string name) [member function]
cls.add_method('Add',
'void',
[param('int', 'v'), param('std::string', 'name')])
## enum.h (module 'core'): void ns3::EnumChecker::AddDefault(int v, std::string name) [member function]
cls.add_method('AddDefault',
'void',
[param('int', 'v'), param('std::string', 'name')])
## enum.h (module 'core'): bool ns3::EnumChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::Copy(ns3::AttributeValue const & src, ns3::AttributeValue & dst) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'src'), param('ns3::AttributeValue &', 'dst')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EnumValue_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumValue::EnumValue(ns3::EnumValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EnumValue const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumValue::EnumValue() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): ns3::EnumValue::EnumValue(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## enum.h (module 'core'): int ns3::EnumValue::Get() const [member function]
cls.add_method('Get',
'int',
[],
is_const=True)
## enum.h (module 'core'): std::string ns3::EnumValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): void ns3::EnumValue::Set(int v) [member function]
cls.add_method('Set',
'void',
[param('int', 'v')])
return
def register_Ns3EventImpl_methods(root_module, cls):
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EventImpl const &', 'arg0')])
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor]
cls.add_constructor([])
## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[])
## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function]
cls.add_method('IsCancelled',
'bool',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function]
cls.add_method('Notify',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3FdReader_methods(root_module, cls):
## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader(ns3::FdReader const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FdReader const &', 'arg0')])
## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader() [constructor]
cls.add_constructor([])
## unix-fd-reader.h (module 'core'): void ns3::FdReader::Start(int fd, ns3::Callback<void, unsigned char*, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> readCallback) [member function]
cls.add_method('Start',
'void',
[param('int', 'fd'), param('ns3::Callback< void, unsigned char *, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'readCallback')])
## unix-fd-reader.h (module 'core'): void ns3::FdReader::Stop() [member function]
cls.add_method('Stop',
'void',
[])
## unix-fd-reader.h (module 'core'): ns3::FdReader::Data ns3::FdReader::DoRead() [member function]
cls.add_method('DoRead',
'ns3::FdReader::Data',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3HeapScheduler_methods(root_module, cls):
## heap-scheduler.h (module 'core'): ns3::HeapScheduler::HeapScheduler(ns3::HeapScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::HeapScheduler const &', 'arg0')])
## heap-scheduler.h (module 'core'): ns3::HeapScheduler::HeapScheduler() [constructor]
cls.add_constructor([])
## heap-scheduler.h (module 'core'): static ns3::TypeId ns3::HeapScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## heap-scheduler.h (module 'core'): void ns3::HeapScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## heap-scheduler.h (module 'core'): bool ns3::HeapScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## heap-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::HeapScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## heap-scheduler.h (module 'core'): void ns3::HeapScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## heap-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::HeapScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3IntegerValue_methods(root_module, cls):
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue() [constructor]
cls.add_constructor([])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(ns3::IntegerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntegerValue const &', 'arg0')])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(int64_t const & value) [constructor]
cls.add_constructor([param('int64_t const &', 'value')])
## integer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::IntegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## integer.h (module 'core'): bool ns3::IntegerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## integer.h (module 'core'): int64_t ns3::IntegerValue::Get() const [member function]
cls.add_method('Get',
'int64_t',
[],
is_const=True)
## integer.h (module 'core'): std::string ns3::IntegerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## integer.h (module 'core'): void ns3::IntegerValue::Set(int64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('int64_t const &', 'value')])
return
def register_Ns3ListScheduler_methods(root_module, cls):
## list-scheduler.h (module 'core'): ns3::ListScheduler::ListScheduler(ns3::ListScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ListScheduler const &', 'arg0')])
## list-scheduler.h (module 'core'): ns3::ListScheduler::ListScheduler() [constructor]
cls.add_constructor([])
## list-scheduler.h (module 'core'): static ns3::TypeId ns3::ListScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## list-scheduler.h (module 'core'): void ns3::ListScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## list-scheduler.h (module 'core'): bool ns3::ListScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## list-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::ListScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## list-scheduler.h (module 'core'): void ns3::ListScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## list-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::ListScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3MapScheduler_methods(root_module, cls):
## map-scheduler.h (module 'core'): ns3::MapScheduler::MapScheduler(ns3::MapScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MapScheduler const &', 'arg0')])
## map-scheduler.h (module 'core'): ns3::MapScheduler::MapScheduler() [constructor]
cls.add_constructor([])
## map-scheduler.h (module 'core'): static ns3::TypeId ns3::MapScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## map-scheduler.h (module 'core'): void ns3::MapScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## map-scheduler.h (module 'core'): bool ns3::MapScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## map-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::MapScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## map-scheduler.h (module 'core'): void ns3::MapScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## map-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::MapScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3Ns2CalendarScheduler_methods(root_module, cls):
## ns2-calendar-scheduler.h (module 'core'): ns3::Ns2CalendarScheduler::Ns2CalendarScheduler(ns3::Ns2CalendarScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ns2CalendarScheduler const &', 'arg0')])
## ns2-calendar-scheduler.h (module 'core'): ns3::Ns2CalendarScheduler::Ns2CalendarScheduler() [constructor]
cls.add_constructor([])
## ns2-calendar-scheduler.h (module 'core'): static ns3::TypeId ns3::Ns2CalendarScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ns2-calendar-scheduler.h (module 'core'): void ns3::Ns2CalendarScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): bool ns3::Ns2CalendarScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Ns2CalendarScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): void ns3::Ns2CalendarScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Ns2CalendarScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3ObjectFactoryChecker_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')])
return
def register_Ns3ObjectFactoryValue_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'value')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function]
cls.add_method('Get',
'ns3::ObjectFactory',
[],
is_const=True)
## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ObjectFactory const &', 'value')])
return
def register_Ns3ObjectPtrContainerAccessor_methods(root_module, cls):
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerAccessor::ObjectPtrContainerAccessor() [constructor]
cls.add_constructor([])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerAccessor::ObjectPtrContainerAccessor(ns3::ObjectPtrContainerAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectPtrContainerAccessor const &', 'arg0')])
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & value) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'value')],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object'), param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectPtrContainerAccessor::DoGet(ns3::ObjectBase const * object, uint32_t i) const [member function]
cls.add_method('DoGet',
'ns3::Ptr< ns3::Object >',
[param('ns3::ObjectBase const *', 'object'), param('uint32_t', 'i')],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::DoGetN(ns3::ObjectBase const * object, uint32_t * n) const [member function]
cls.add_method('DoGetN',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('uint32_t *', 'n')],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3ObjectPtrContainerChecker_methods(root_module, cls):
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerChecker::ObjectPtrContainerChecker() [constructor]
cls.add_constructor([])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerChecker::ObjectPtrContainerChecker(ns3::ObjectPtrContainerChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectPtrContainerChecker const &', 'arg0')])
## object-ptr-container.h (module 'core'): ns3::TypeId ns3::ObjectPtrContainerChecker::GetItemTypeId() const [member function]
cls.add_method('GetItemTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3ObjectPtrContainerValue_methods(root_module, cls):
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerValue::ObjectPtrContainerValue(ns3::ObjectPtrContainerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectPtrContainerValue const &', 'arg0')])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerValue::ObjectPtrContainerValue() [constructor]
cls.add_constructor([])
## object-ptr-container.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::ObjectPtrContainerValue::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## object-ptr-container.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectPtrContainerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-ptr-container.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::ObjectPtrContainerValue::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## object-ptr-container.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectPtrContainerValue::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Object >',
[param('uint32_t', 'i')],
is_const=True)
## object-ptr-container.h (module 'core'): uint32_t ns3::ObjectPtrContainerValue::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## object-ptr-container.h (module 'core'): std::string ns3::ObjectPtrContainerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
return
def register_Ns3PointerChecker_methods(root_module, cls):
## pointer.h (module 'core'): ns3::PointerChecker::PointerChecker() [constructor]
cls.add_constructor([])
## pointer.h (module 'core'): ns3::PointerChecker::PointerChecker(ns3::PointerChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PointerChecker const &', 'arg0')])
## pointer.h (module 'core'): ns3::TypeId ns3::PointerChecker::GetPointeeTypeId() const [member function]
cls.add_method('GetPointeeTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3PointerValue_methods(root_module, cls):
## pointer.h (module 'core'): ns3::PointerValue::PointerValue(ns3::PointerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PointerValue const &', 'arg0')])
## pointer.h (module 'core'): ns3::PointerValue::PointerValue() [constructor]
cls.add_constructor([])
## pointer.h (module 'core'): ns3::PointerValue::PointerValue(ns3::Ptr<ns3::Object> object) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Object >', 'object')])
## pointer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::PointerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## pointer.h (module 'core'): bool ns3::PointerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## pointer.h (module 'core'): ns3::Ptr<ns3::Object> ns3::PointerValue::GetObject() const [member function]
cls.add_method('GetObject',
'ns3::Ptr< ns3::Object >',
[],
is_const=True)
## pointer.h (module 'core'): std::string ns3::PointerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## pointer.h (module 'core'): void ns3::PointerValue::SetObject(ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('SetObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'object')])
return
def register_Ns3RandomVariableChecker_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::RandomVariableChecker::RandomVariableChecker() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::RandomVariableChecker::RandomVariableChecker(ns3::RandomVariableChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RandomVariableChecker const &', 'arg0')])
return
def register_Ns3RandomVariableValue_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue(ns3::RandomVariableValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RandomVariableValue const &', 'arg0')])
## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue(ns3::RandomVariable const & value) [constructor]
cls.add_constructor([param('ns3::RandomVariable const &', 'value')])
## random-variable.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::RandomVariableValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## random-variable.h (module 'core'): bool ns3::RandomVariableValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## random-variable.h (module 'core'): ns3::RandomVariable ns3::RandomVariableValue::Get() const [member function]
cls.add_method('Get',
'ns3::RandomVariable',
[],
is_const=True)
## random-variable.h (module 'core'): std::string ns3::RandomVariableValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## random-variable.h (module 'core'): void ns3::RandomVariableValue::Set(ns3::RandomVariable const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::RandomVariable const &', 'value')])
return
def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl() [constructor]
cls.add_constructor([])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetHardLimit() const [member function]
cls.add_method('GetHardLimit',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode ns3::RealtimeSimulatorImpl::GetSynchronizationMode() const [member function]
cls.add_method('GetSynchronizationMode',
'ns3::RealtimeSimulatorImpl::SynchronizationMode',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): static ns3::TypeId ns3::RealtimeSimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::RealtimeNow() const [member function]
cls.add_method('RealtimeNow',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtime(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtime',
'void',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNow',
'void',
[param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(uint32_t context, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNowWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetHardLimit(ns3::Time limit) [member function]
cls.add_method('SetHardLimit',
'void',
[param('ns3::Time', 'limit')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetSynchronizationMode(ns3::RealtimeSimulatorImpl::SynchronizationMode mode) [member function]
cls.add_method('SetSynchronizationMode',
'void',
[param('ns3::RealtimeSimulatorImpl::SynchronizationMode', 'mode')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3RefCountBase_methods(root_module, cls):
## ref-count-base.h (module 'core'): ns3::RefCountBase::RefCountBase() [constructor]
cls.add_constructor([])
## ref-count-base.h (module 'core'): ns3::RefCountBase::RefCountBase(ns3::RefCountBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RefCountBase const &', 'arg0')])
return
def register_Ns3StringChecker_methods(root_module, cls):
## string.h (module 'core'): ns3::StringChecker::StringChecker() [constructor]
cls.add_constructor([])
## string.h (module 'core'): ns3::StringChecker::StringChecker(ns3::StringChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StringChecker const &', 'arg0')])
return
def register_Ns3StringValue_methods(root_module, cls):
## string.h (module 'core'): ns3::StringValue::StringValue() [constructor]
cls.add_constructor([])
## string.h (module 'core'): ns3::StringValue::StringValue(ns3::StringValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StringValue const &', 'arg0')])
## string.h (module 'core'): ns3::StringValue::StringValue(std::string const & value) [constructor]
cls.add_constructor([param('std::string const &', 'value')])
## string.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::StringValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## string.h (module 'core'): bool ns3::StringValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## string.h (module 'core'): std::string ns3::StringValue::Get() const [member function]
cls.add_method('Get',
'std::string',
[],
is_const=True)
## string.h (module 'core'): std::string ns3::StringValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## string.h (module 'core'): void ns3::StringValue::Set(std::string const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string const &', 'value')])
return
def register_Ns3TimeChecker_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker(ns3::TimeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimeChecker const &', 'arg0')])
return
def register_Ns3TimeValue_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimeValue const &', 'arg0')])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor]
cls.add_constructor([param('ns3::Time const &', 'value')])
## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function]
cls.add_method('Get',
'ns3::Time',
[],
is_const=True)
## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Time const &', 'value')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3UintegerValue_methods(root_module, cls):
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue() [constructor]
cls.add_constructor([])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(ns3::UintegerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UintegerValue const &', 'arg0')])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(uint64_t const & value) [constructor]
cls.add_constructor([param('uint64_t const &', 'value')])
## uinteger.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::UintegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): bool ns3::UintegerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## uinteger.h (module 'core'): uint64_t ns3::UintegerValue::Get() const [member function]
cls.add_method('Get',
'uint64_t',
[],
is_const=True)
## uinteger.h (module 'core'): std::string ns3::UintegerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): void ns3::UintegerValue::Set(uint64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('uint64_t const &', 'value')])
return
def register_Ns3Vector2DChecker_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector2DChecker::Vector2DChecker() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector2DChecker::Vector2DChecker(ns3::Vector2DChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector2DChecker const &', 'arg0')])
return
def register_Ns3Vector2DValue_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector2DValue::Vector2DValue() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector2DValue::Vector2DValue(ns3::Vector2DValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector2DValue const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector2DValue::Vector2DValue(ns3::Vector2D const & value) [constructor]
cls.add_constructor([param('ns3::Vector2D const &', 'value')])
## vector.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::Vector2DValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## vector.h (module 'core'): bool ns3::Vector2DValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## vector.h (module 'core'): ns3::Vector2D ns3::Vector2DValue::Get() const [member function]
cls.add_method('Get',
'ns3::Vector2D',
[],
is_const=True)
## vector.h (module 'core'): std::string ns3::Vector2DValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## vector.h (module 'core'): void ns3::Vector2DValue::Set(ns3::Vector2D const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Vector2D const &', 'value')])
return
def register_Ns3Vector3DChecker_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector3DChecker::Vector3DChecker() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector3DChecker::Vector3DChecker(ns3::Vector3DChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector3DChecker const &', 'arg0')])
return
def register_Ns3Vector3DValue_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector3DValue::Vector3DValue() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector3DValue::Vector3DValue(ns3::Vector3DValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector3DValue const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector3DValue::Vector3DValue(ns3::Vector3D const & value) [constructor]
cls.add_constructor([param('ns3::Vector3D const &', 'value')])
## vector.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::Vector3DValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## vector.h (module 'core'): bool ns3::Vector3DValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## vector.h (module 'core'): ns3::Vector3D ns3::Vector3DValue::Get() const [member function]
cls.add_method('Get',
'ns3::Vector3D',
[],
is_const=True)
## vector.h (module 'core'): std::string ns3::Vector3DValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## vector.h (module 'core'): void ns3::Vector3DValue::Set(ns3::Vector3D const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Vector3D const &', 'value')])
return
def register_Ns3ConfigMatchContainer_methods(root_module, cls):
## config.h (module 'core'): ns3::Config::MatchContainer::MatchContainer(ns3::Config::MatchContainer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Config::MatchContainer const &', 'arg0')])
## config.h (module 'core'): ns3::Config::MatchContainer::MatchContainer() [constructor]
cls.add_constructor([])
## config.h (module 'core'): ns3::Config::MatchContainer::MatchContainer(std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > const & objects, std::vector<std::string, std::allocator<std::string> > const & contexts, std::string path) [constructor]
cls.add_constructor([param('std::vector< ns3::Ptr< ns3::Object > > const &', 'objects'), param('std::vector< std::string > const &', 'contexts'), param('std::string', 'path')])
## config.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::Config::MatchContainer::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## config.h (module 'core'): void ns3::Config::MatchContainer::Connect(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('Connect',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): void ns3::Config::MatchContainer::ConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('ConnectWithoutContext',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): void ns3::Config::MatchContainer::Disconnect(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('Disconnect',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): void ns3::Config::MatchContainer::DisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('DisconnectWithoutContext',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::Config::MatchContainer::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## config.h (module 'core'): ns3::Ptr<ns3::Object> ns3::Config::MatchContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Object >',
[param('uint32_t', 'i')],
is_const=True)
## config.h (module 'core'): std::string ns3::Config::MatchContainer::GetMatchedPath(uint32_t i) const [member function]
cls.add_method('GetMatchedPath',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## config.h (module 'core'): uint32_t ns3::Config::MatchContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## config.h (module 'core'): std::string ns3::Config::MatchContainer::GetPath() const [member function]
cls.add_method('GetPath',
'std::string',
[],
is_const=True)
## config.h (module 'core'): void ns3::Config::MatchContainer::Set(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_functions(root_module):
module = root_module
## nstime.h (module 'core'): ns3::Time ns3::Abs(ns3::Time const & time) [free function]
module.add_function('Abs',
'ns3::Time',
[param('ns3::Time const &', 'time')])
## int64x64.h (module 'core'): ns3::int64x64_t ns3::Abs(ns3::int64x64_t const & value) [free function]
module.add_function('Abs',
'ns3::int64x64_t',
[param('ns3::int64x64_t const &', 'value')])
## breakpoint.h (module 'core'): extern void ns3::BreakpointFallback() [free function]
module.add_function('BreakpointFallback',
'void',
[])
## vector.h (module 'core'): extern double ns3::CalculateDistance(ns3::Vector2D const & a, ns3::Vector2D const & b) [free function]
module.add_function('CalculateDistance',
'double',
[param('ns3::Vector2D const &', 'a'), param('ns3::Vector2D const &', 'b')])
## vector.h (module 'core'): extern double ns3::CalculateDistance(ns3::Vector3D const & a, ns3::Vector3D const & b) [free function]
module.add_function('CalculateDistance',
'double',
[param('ns3::Vector3D const &', 'a'), param('ns3::Vector3D const &', 'b')])
## ptr.h (module 'core'): extern ns3::Ptr<ns3::ObjectPtrContainerValue> ns3::Create() [free function]
module.add_function('Create',
'ns3::Ptr< ns3::ObjectPtrContainerValue >',
[],
template_parameters=['ns3::ObjectPtrContainerValue'])
## ptr.h (module 'core'): extern ns3::Ptr<ns3::PointerValue> ns3::Create() [free function]
module.add_function('Create',
'ns3::Ptr< ns3::PointerValue >',
[],
template_parameters=['ns3::PointerValue'])
## nstime.h (module 'core'): ns3::Time ns3::FemtoSeconds(ns3::int64x64_t fs) [free function]
module.add_function('FemtoSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'fs')])
## nstime.h (module 'core'): ns3::Time ns3::FemtoSeconds(uint64_t fs) [free function]
module.add_function('FemtoSeconds',
'ns3::Time',
[param('uint64_t', 'fs')])
## log.h (module 'core'): extern void ns3::LogComponentDisable(char const * name, ns3::LogLevel level) [free function]
module.add_function('LogComponentDisable',
'void',
[param('char const *', 'name'), param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentDisableAll(ns3::LogLevel level) [free function]
module.add_function('LogComponentDisableAll',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentEnable(char const * name, ns3::LogLevel level) [free function]
module.add_function('LogComponentEnable',
'void',
[param('char const *', 'name'), param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentEnableAll(ns3::LogLevel level) [free function]
module.add_function('LogComponentEnableAll',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentPrintList() [free function]
module.add_function('LogComponentPrintList',
'void',
[])
## log.h (module 'core'): extern ns3::LogNodePrinter ns3::LogGetNodePrinter() [free function]
module.add_function('LogGetNodePrinter',
'ns3::LogNodePrinter',
[])
## log.h (module 'core'): extern ns3::LogTimePrinter ns3::LogGetTimePrinter() [free function]
module.add_function('LogGetTimePrinter',
'ns3::LogTimePrinter',
[])
## log.h (module 'core'): extern void ns3::LogSetNodePrinter(ns3::LogNodePrinter arg0) [free function]
module.add_function('LogSetNodePrinter',
'void',
[param('ns3::LogNodePrinter', 'arg0')])
## log.h (module 'core'): extern void ns3::LogSetTimePrinter(ns3::LogTimePrinter arg0) [free function]
module.add_function('LogSetTimePrinter',
'void',
[param('ns3::LogTimePrinter', 'arg0')])
## boolean.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeBooleanChecker() [free function]
module.add_function('MakeBooleanChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## callback.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeCallbackChecker() [free function]
module.add_function('MakeCallbackChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## enum.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeEnumChecker(int v1, std::string n1, int v2=0, std::string n2="", int v3=0, std::string n3="", int v4=0, std::string n4="", int v5=0, std::string n5="", int v6=0, std::string n6="", int v7=0, std::string n7="", int v8=0, std::string n8="", int v9=0, std::string n9="", int v10=0, std::string n10="", int v11=0, std::string n11="", int v12=0, std::string n12="", int v13=0, std::string n13="", int v14=0, std::string n14="", int v15=0, std::string n15="", int v16=0, std::string n16="", int v17=0, std::string n17="", int v18=0, std::string n18="", int v19=0, std::string n19="", int v20=0, std::string n20="", int v21=0, std::string n21="", int v22=0, std::string n22="") [free function]
module.add_function('MakeEnumChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('int', 'v1'), param('std::string', 'n1'), param('int', 'v2', default_value='0'), param('std::string', 'n2', default_value='""'), param('int', 'v3', default_value='0'), param('std::string', 'n3', default_value='""'), param('int', 'v4', default_value='0'), param('std::string', 'n4', default_value='""'), param('int', 'v5', default_value='0'), param('std::string', 'n5', default_value='""'), param('int', 'v6', default_value='0'), param('std::string', 'n6', default_value='""'), param('int', 'v7', default_value='0'), param('std::string', 'n7', default_value='""'), param('int', 'v8', default_value='0'), param('std::string', 'n8', default_value='""'), param('int', 'v9', default_value='0'), param('std::string', 'n9', default_value='""'), param('int', 'v10', default_value='0'), param('std::string', 'n10', default_value='""'), param('int', 'v11', default_value='0'), param('std::string', 'n11', default_value='""'), param('int', 'v12', default_value='0'), param('std::string', 'n12', default_value='""'), param('int', 'v13', default_value='0'), param('std::string', 'n13', default_value='""'), param('int', 'v14', default_value='0'), param('std::string', 'n14', default_value='""'), param('int', 'v15', default_value='0'), param('std::string', 'n15', default_value='""'), param('int', 'v16', default_value='0'), param('std::string', 'n16', default_value='""'), param('int', 'v17', default_value='0'), param('std::string', 'n17', default_value='""'), param('int', 'v18', default_value='0'), param('std::string', 'n18', default_value='""'), param('int', 'v19', default_value='0'), param('std::string', 'n19', default_value='""'), param('int', 'v20', default_value='0'), param('std::string', 'n20', default_value='""'), param('int', 'v21', default_value='0'), param('std::string', 'n21', default_value='""'), param('int', 'v22', default_value='0'), param('std::string', 'n22', default_value='""')])
## make-event.h (module 'core'): extern ns3::EventImpl * ns3::MakeEvent(void (*)( ) * f) [free function]
module.add_function('MakeEvent',
'ns3::EventImpl *',
[param('void ( * ) ( ) *', 'f')])
## object-factory.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeObjectFactoryChecker() [free function]
module.add_function('MakeObjectFactoryChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## random-variable.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeRandomVariableChecker() [free function]
module.add_function('MakeRandomVariableChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## string.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeStringChecker() [free function]
module.add_function('MakeStringChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## nstime.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeTimeChecker() [free function]
module.add_function('MakeTimeChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## type-id.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeTypeIdChecker() [free function]
module.add_function('MakeTypeIdChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## vector.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVector2DChecker() [free function]
module.add_function('MakeVector2DChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## vector.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVector3DChecker() [free function]
module.add_function('MakeVector3DChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## vector.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVectorChecker() [free function]
module.add_function('MakeVectorChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## nstime.h (module 'core'): ns3::Time ns3::Max(ns3::Time const & ta, ns3::Time const & tb) [free function]
module.add_function('Max',
'ns3::Time',
[param('ns3::Time const &', 'ta'), param('ns3::Time const &', 'tb')])
## int64x64.h (module 'core'): ns3::int64x64_t ns3::Max(ns3::int64x64_t const & a, ns3::int64x64_t const & b) [free function]
module.add_function('Max',
'ns3::int64x64_t',
[param('ns3::int64x64_t const &', 'a'), param('ns3::int64x64_t const &', 'b')])
## nstime.h (module 'core'): ns3::Time ns3::MicroSeconds(ns3::int64x64_t us) [free function]
module.add_function('MicroSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'us')])
## nstime.h (module 'core'): ns3::Time ns3::MicroSeconds(uint64_t us) [free function]
module.add_function('MicroSeconds',
'ns3::Time',
[param('uint64_t', 'us')])
## nstime.h (module 'core'): ns3::Time ns3::MilliSeconds(ns3::int64x64_t ms) [free function]
module.add_function('MilliSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'ms')])
## nstime.h (module 'core'): ns3::Time ns3::MilliSeconds(uint64_t ms) [free function]
module.add_function('MilliSeconds',
'ns3::Time',
[param('uint64_t', 'ms')])
## nstime.h (module 'core'): ns3::Time ns3::Min(ns3::Time const & ta, ns3::Time const & tb) [free function]
module.add_function('Min',
'ns3::Time',
[param('ns3::Time const &', 'ta'), param('ns3::Time const &', 'tb')])
## int64x64.h (module 'core'): ns3::int64x64_t ns3::Min(ns3::int64x64_t const & a, ns3::int64x64_t const & b) [free function]
module.add_function('Min',
'ns3::int64x64_t',
[param('ns3::int64x64_t const &', 'a'), param('ns3::int64x64_t const &', 'b')])
## nstime.h (module 'core'): ns3::Time ns3::NanoSeconds(ns3::int64x64_t ns) [free function]
module.add_function('NanoSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'ns')])
## nstime.h (module 'core'): ns3::Time ns3::NanoSeconds(uint64_t ns) [free function]
module.add_function('NanoSeconds',
'ns3::Time',
[param('uint64_t', 'ns')])
## simulator.h (module 'core'): extern ns3::Time ns3::Now() [free function]
module.add_function('Now',
'ns3::Time',
[])
## nstime.h (module 'core'): ns3::Time ns3::PicoSeconds(ns3::int64x64_t ps) [free function]
module.add_function('PicoSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'ps')])
## nstime.h (module 'core'): ns3::Time ns3::PicoSeconds(uint64_t ps) [free function]
module.add_function('PicoSeconds',
'ns3::Time',
[param('uint64_t', 'ps')])
## nstime.h (module 'core'): ns3::Time ns3::Seconds(ns3::int64x64_t seconds) [free function]
module.add_function('Seconds',
'ns3::Time',
[param('ns3::int64x64_t', 'seconds')])
## nstime.h (module 'core'): ns3::Time ns3::Seconds(double seconds) [free function]
module.add_function('Seconds',
'ns3::Time',
[param('double', 'seconds')])
## test.h (module 'core'): extern bool ns3::TestDoubleIsEqual(double const a, double const b, double const epsilon=std::numeric_limits<double>::epsilon()) [free function]
module.add_function('TestDoubleIsEqual',
'bool',
[param('double const', 'a'), param('double const', 'b'), param('double const', 'epsilon', default_value='std::numeric_limits<double>::epsilon()')])
## nstime.h (module 'core'): ns3::Time ns3::TimeStep(uint64_t ts) [free function]
module.add_function('TimeStep',
'ns3::Time',
[param('uint64_t', 'ts')])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['double'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['float'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['long'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['int'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['short'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['signed char'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned long long'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned int'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned short'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned char'])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
register_functions_ns3_SystemPath(module.get_submodule('SystemPath'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
return
def register_functions_ns3_Config(module, root_module):
## config.h (module 'core'): extern void ns3::Config::Connect(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('Connect',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern void ns3::Config::ConnectWithoutContext(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('ConnectWithoutContext',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern void ns3::Config::Disconnect(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('Disconnect',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern void ns3::Config::DisconnectWithoutContext(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('DisconnectWithoutContext',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern ns3::Ptr<ns3::Object> ns3::Config::GetRootNamespaceObject(uint32_t i) [free function]
module.add_function('GetRootNamespaceObject',
'ns3::Ptr< ns3::Object >',
[param('uint32_t', 'i')])
## config.h (module 'core'): extern uint32_t ns3::Config::GetRootNamespaceObjectN() [free function]
module.add_function('GetRootNamespaceObjectN',
'uint32_t',
[])
## config.h (module 'core'): extern ns3::Config::MatchContainer ns3::Config::LookupMatches(std::string path) [free function]
module.add_function('LookupMatches',
'ns3::Config::MatchContainer',
[param('std::string', 'path')])
## config.h (module 'core'): extern void ns3::Config::RegisterRootNamespaceObject(ns3::Ptr<ns3::Object> obj) [free function]
module.add_function('RegisterRootNamespaceObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'obj')])
## config.h (module 'core'): extern void ns3::Config::Reset() [free function]
module.add_function('Reset',
'void',
[])
## config.h (module 'core'): extern void ns3::Config::Set(std::string path, ns3::AttributeValue const & value) [free function]
module.add_function('Set',
'void',
[param('std::string', 'path'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern void ns3::Config::SetDefault(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetDefault',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern bool ns3::Config::SetDefaultFailSafe(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetDefaultFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern void ns3::Config::SetGlobal(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetGlobal',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern bool ns3::Config::SetGlobalFailSafe(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetGlobalFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern void ns3::Config::UnregisterRootNamespaceObject(ns3::Ptr<ns3::Object> obj) [free function]
module.add_function('UnregisterRootNamespaceObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'obj')])
return
def register_functions_ns3_FatalImpl(module, root_module):
## fatal-impl.h (module 'core'): extern void ns3::FatalImpl::FlushStreams() [free function]
module.add_function('FlushStreams',
'void',
[])
## fatal-impl.h (module 'core'): extern void ns3::FatalImpl::RegisterStream(std::ostream * stream) [free function]
module.add_function('RegisterStream',
'void',
[param('std::ostream *', 'stream')])
## fatal-impl.h (module 'core'): extern void ns3::FatalImpl::UnregisterStream(std::ostream * stream) [free function]
module.add_function('UnregisterStream',
'void',
[param('std::ostream *', 'stream')])
return
def register_functions_ns3_SystemPath(module, root_module):
## system-path.h (module 'core'): extern std::string ns3::SystemPath::Append(std::string left, std::string right) [free function]
module.add_function('Append',
'std::string',
[param('std::string', 'left'), param('std::string', 'right')])
## system-path.h (module 'core'): extern std::string ns3::SystemPath::FindSelfDirectory() [free function]
module.add_function('FindSelfDirectory',
'std::string',
[])
## system-path.h (module 'core'): extern std::string ns3::SystemPath::Join(std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > begin, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > end) [free function]
module.add_function('Join',
'std::string',
[param('std::_List_const_iterator< std::basic_string< char, std::char_traits< char >, std::allocator< char > > >', 'begin'), param('std::_List_const_iterator< std::basic_string< char, std::char_traits< char >, std::allocator< char > > >', 'end')])
## system-path.h (module 'core'): extern void ns3::SystemPath::MakeDirectories(std::string path) [free function]
module.add_function('MakeDirectories',
'void',
[param('std::string', 'path')])
## system-path.h (module 'core'): extern std::string ns3::SystemPath::MakeTemporaryDirectoryName() [free function]
module.add_function('MakeTemporaryDirectoryName',
'std::string',
[])
## system-path.h (module 'core'): extern std::list<std::string, std::allocator<std::string> > ns3::SystemPath::ReadFiles(std::string path) [free function]
module.add_function('ReadFiles',
'std::list< std::string >',
[param('std::string', 'path')])
## system-path.h (module 'core'): extern std::list<std::string, std::allocator<std::string> > ns3::SystemPath::Split(std::string path) [free function]
module.add_function('Split',
'std::list< std::string >',
[param('std::string', 'path')])
return
def register_functions_ns3_internal(module, root_module):
## double.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeDoubleChecker(double min, double max, std::string name) [free function]
module.add_function('MakeDoubleChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('double', 'min'), param('double', 'max'), param('std::string', 'name')])
## integer.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeIntegerChecker(int64_t min, int64_t max, std::string name) [free function]
module.add_function('MakeIntegerChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('int64_t', 'min'), param('int64_t', 'max'), param('std::string', 'name')])
## uinteger.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeUintegerChecker(uint64_t min, uint64_t max, std::string name) [free function]
module.add_function('MakeUintegerChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('uint64_t', 'min'), param('uint64_t', 'max'), param('std::string', 'name')])
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
| zy901002-gpsr | src/core/bindings/modulegen__gcc_ILP32.py | Python | gpl2 | 278,190 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
return True
pybindgen.settings.error_handler = ErrorHandler()
import sys
def module_init():
root_module = Module('ns.core', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
module.add_class('AttributeConstructionList')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
module.add_class('Item', outer_class=root_module['ns3::AttributeConstructionList'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase')
## command-line.h (module 'core'): ns3::CommandLine [class]
module.add_class('CommandLine', allow_subclassing=True)
## system-mutex.h (module 'core'): ns3::CriticalSection [class]
module.add_class('CriticalSection')
## event-id.h (module 'core'): ns3::EventId [class]
module.add_class('EventId')
## global-value.h (module 'core'): ns3::GlobalValue [class]
module.add_class('GlobalValue')
## int-to-type.h (module 'core'): ns3::IntToType<0> [struct]
module.add_class('IntToType', template_parameters=['0'])
## int-to-type.h (module 'core'): ns3::IntToType<0>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 0 >'])
## int-to-type.h (module 'core'): ns3::IntToType<1> [struct]
module.add_class('IntToType', template_parameters=['1'])
## int-to-type.h (module 'core'): ns3::IntToType<1>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 1 >'])
## int-to-type.h (module 'core'): ns3::IntToType<2> [struct]
module.add_class('IntToType', template_parameters=['2'])
## int-to-type.h (module 'core'): ns3::IntToType<2>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 2 >'])
## int-to-type.h (module 'core'): ns3::IntToType<3> [struct]
module.add_class('IntToType', template_parameters=['3'])
## int-to-type.h (module 'core'): ns3::IntToType<3>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 3 >'])
## int-to-type.h (module 'core'): ns3::IntToType<4> [struct]
module.add_class('IntToType', template_parameters=['4'])
## int-to-type.h (module 'core'): ns3::IntToType<4>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 4 >'])
## int-to-type.h (module 'core'): ns3::IntToType<5> [struct]
module.add_class('IntToType', template_parameters=['5'])
## int-to-type.h (module 'core'): ns3::IntToType<5>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 5 >'])
## int-to-type.h (module 'core'): ns3::IntToType<6> [struct]
module.add_class('IntToType', template_parameters=['6'])
## int-to-type.h (module 'core'): ns3::IntToType<6>::v_e [enumeration]
module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 6 >'])
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent')
## names.h (module 'core'): ns3::Names [class]
module.add_class('Names')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', allow_subclassing=True)
## object.h (module 'core'): ns3::ObjectDeleter [struct]
module.add_class('ObjectDeleter')
## object-factory.h (module 'core'): ns3::ObjectFactory [class]
module.add_class('ObjectFactory')
## random-variable.h (module 'core'): ns3::RandomVariable [class]
module.add_class('RandomVariable')
## rng-stream.h (module 'core'): ns3::RngStream [class]
module.add_class('RngStream')
## random-variable.h (module 'core'): ns3::SeedManager [class]
module.add_class('SeedManager')
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
module.add_class('SequentialVariable', parent=root_module['ns3::RandomVariable'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', destructor_visibility='private')
## system-condition.h (module 'core'): ns3::SystemCondition [class]
module.add_class('SystemCondition')
## system-mutex.h (module 'core'): ns3::SystemMutex [class]
module.add_class('SystemMutex')
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs')
## timer.h (module 'core'): ns3::Timer [class]
module.add_class('Timer')
## timer.h (module 'core'): ns3::Timer::DestroyPolicy [enumeration]
module.add_enum('DestroyPolicy', ['CANCEL_ON_DESTROY', 'REMOVE_ON_DESTROY', 'CHECK_ON_DESTROY'], outer_class=root_module['ns3::Timer'])
## timer.h (module 'core'): ns3::Timer::State [enumeration]
module.add_enum('State', ['RUNNING', 'EXPIRED', 'SUSPENDED'], outer_class=root_module['ns3::Timer'])
## timer-impl.h (module 'core'): ns3::TimerImpl [class]
module.add_class('TimerImpl', allow_subclassing=True)
## random-variable.h (module 'core'): ns3::TriangularVariable [class]
module.add_class('TriangularVariable', parent=root_module['ns3::RandomVariable'])
## type-id.h (module 'core'): ns3::TypeId [class]
module.add_class('TypeId')
## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
module.add_class('AttributeInformation', outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
module.add_class('TraceSourceInformation', outer_class=root_module['ns3::TypeId'])
## random-variable.h (module 'core'): ns3::UniformVariable [class]
module.add_class('UniformVariable', parent=root_module['ns3::RandomVariable'])
## vector.h (module 'core'): ns3::Vector2D [class]
module.add_class('Vector2D')
## vector.h (module 'core'): ns3::Vector3D [class]
module.add_class('Vector3D')
## watchdog.h (module 'core'): ns3::Watchdog [class]
module.add_class('Watchdog')
## random-variable.h (module 'core'): ns3::WeibullVariable [class]
module.add_class('WeibullVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ZetaVariable [class]
module.add_class('ZetaVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ZipfVariable [class]
module.add_class('ZipfVariable', parent=root_module['ns3::RandomVariable'])
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty')
## int64x64-double.h (module 'core'): ns3::int64x64_t [class]
module.add_class('int64x64_t')
## random-variable.h (module 'core'): ns3::ConstantVariable [class]
module.add_class('ConstantVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::DeterministicVariable [class]
module.add_class('DeterministicVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::EmpiricalVariable [class]
module.add_class('EmpiricalVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ErlangVariable [class]
module.add_class('ErlangVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::ExponentialVariable [class]
module.add_class('ExponentialVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::GammaVariable [class]
module.add_class('GammaVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::IntEmpiricalVariable [class]
module.add_class('IntEmpiricalVariable', parent=root_module['ns3::EmpiricalVariable'])
## random-variable.h (module 'core'): ns3::LogNormalVariable [class]
module.add_class('LogNormalVariable', parent=root_module['ns3::RandomVariable'])
## random-variable.h (module 'core'): ns3::NormalVariable [class]
module.add_class('NormalVariable', parent=root_module['ns3::RandomVariable'])
## object.h (module 'core'): ns3::Object [class]
module.add_class('Object', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
## object.h (module 'core'): ns3::Object::AggregateIterator [class]
module.add_class('AggregateIterator', outer_class=root_module['ns3::Object'])
## random-variable.h (module 'core'): ns3::ParetoVariable [class]
module.add_class('ParetoVariable', parent=root_module['ns3::RandomVariable'])
## scheduler.h (module 'core'): ns3::Scheduler [class]
module.add_class('Scheduler', parent=root_module['ns3::Object'])
## scheduler.h (module 'core'): ns3::Scheduler::Event [struct]
module.add_class('Event', outer_class=root_module['ns3::Scheduler'])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey [struct]
module.add_class('EventKey', outer_class=root_module['ns3::Scheduler'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::FdReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::RefCountBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::RefCountBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator-impl.h (module 'core'): ns3::SimulatorImpl [class]
module.add_class('SimulatorImpl', parent=root_module['ns3::Object'])
## synchronizer.h (module 'core'): ns3::Synchronizer [class]
module.add_class('Synchronizer', parent=root_module['ns3::Object'])
## system-thread.h (module 'core'): ns3::SystemThread [class]
module.add_class('SystemThread', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
## nstime.h (module 'core'): ns3::Time [class]
module.add_class('Time')
## nstime.h (module 'core'): ns3::Time::Unit [enumeration]
module.add_enum('Unit', ['S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'])
## nstime.h (module 'core'): ns3::Time [class]
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
module.add_class('TraceSourceAccessor', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer [class]
module.add_class('WallClockSynchronizer', parent=root_module['ns3::Synchronizer'])
## attribute.h (module 'core'): ns3::AttributeAccessor [class]
module.add_class('AttributeAccessor', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
## attribute.h (module 'core'): ns3::AttributeChecker [class]
module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
## boolean.h (module 'core'): ns3::BooleanChecker [class]
module.add_class('BooleanChecker', parent=root_module['ns3::AttributeChecker'])
## boolean.h (module 'core'): ns3::BooleanValue [class]
module.add_class('BooleanValue', parent=root_module['ns3::AttributeValue'])
## calendar-scheduler.h (module 'core'): ns3::CalendarScheduler [class]
module.add_class('CalendarScheduler', parent=root_module['ns3::Scheduler'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
module.add_class('CallbackImplBase', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
## callback.h (module 'core'): ns3::CallbackValue [class]
module.add_class('CallbackValue', parent=root_module['ns3::AttributeValue'])
## default-simulator-impl.h (module 'core'): ns3::DefaultSimulatorImpl [class]
module.add_class('DefaultSimulatorImpl', parent=root_module['ns3::SimulatorImpl'])
## double.h (module 'core'): ns3::DoubleValue [class]
module.add_class('DoubleValue', parent=root_module['ns3::AttributeValue'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', parent=root_module['ns3::AttributeValue'])
## enum.h (module 'core'): ns3::EnumChecker [class]
module.add_class('EnumChecker', parent=root_module['ns3::AttributeChecker'])
## enum.h (module 'core'): ns3::EnumValue [class]
module.add_class('EnumValue', parent=root_module['ns3::AttributeValue'])
## event-impl.h (module 'core'): ns3::EventImpl [class]
module.add_class('EventImpl', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
## unix-fd-reader.h (module 'core'): ns3::FdReader [class]
module.add_class('FdReader', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >'])
## heap-scheduler.h (module 'core'): ns3::HeapScheduler [class]
module.add_class('HeapScheduler', parent=root_module['ns3::Scheduler'])
## integer.h (module 'core'): ns3::IntegerValue [class]
module.add_class('IntegerValue', parent=root_module['ns3::AttributeValue'])
## list-scheduler.h (module 'core'): ns3::ListScheduler [class]
module.add_class('ListScheduler', parent=root_module['ns3::Scheduler'])
## map-scheduler.h (module 'core'): ns3::MapScheduler [class]
module.add_class('MapScheduler', parent=root_module['ns3::Scheduler'])
## ns2-calendar-scheduler.h (module 'core'): ns3::Ns2CalendarScheduler [class]
module.add_class('Ns2CalendarScheduler', parent=root_module['ns3::Scheduler'])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class]
module.add_class('ObjectFactoryChecker', parent=root_module['ns3::AttributeChecker'])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class]
module.add_class('ObjectFactoryValue', parent=root_module['ns3::AttributeValue'])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerAccessor [class]
module.add_class('ObjectPtrContainerAccessor', parent=root_module['ns3::AttributeAccessor'])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerChecker [class]
module.add_class('ObjectPtrContainerChecker', parent=root_module['ns3::AttributeChecker'])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerValue [class]
module.add_class('ObjectPtrContainerValue', parent=root_module['ns3::AttributeValue'])
## pointer.h (module 'core'): ns3::PointerChecker [class]
module.add_class('PointerChecker', parent=root_module['ns3::AttributeChecker'])
## pointer.h (module 'core'): ns3::PointerValue [class]
module.add_class('PointerValue', parent=root_module['ns3::AttributeValue'])
## random-variable.h (module 'core'): ns3::RandomVariableChecker [class]
module.add_class('RandomVariableChecker', parent=root_module['ns3::AttributeChecker'])
## random-variable.h (module 'core'): ns3::RandomVariableValue [class]
module.add_class('RandomVariableValue', parent=root_module['ns3::AttributeValue'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl [class]
module.add_class('RealtimeSimulatorImpl', parent=root_module['ns3::SimulatorImpl'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration]
module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'])
## ref-count-base.h (module 'core'): ns3::RefCountBase [class]
module.add_class('RefCountBase', parent=root_module['ns3::SimpleRefCount< ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >'])
## string.h (module 'core'): ns3::StringChecker [class]
module.add_class('StringChecker', parent=root_module['ns3::AttributeChecker'])
## string.h (module 'core'): ns3::StringValue [class]
module.add_class('StringValue', parent=root_module['ns3::AttributeValue'])
## nstime.h (module 'core'): ns3::TimeChecker [class]
module.add_class('TimeChecker', parent=root_module['ns3::AttributeChecker'])
## nstime.h (module 'core'): ns3::TimeValue [class]
module.add_class('TimeValue', parent=root_module['ns3::AttributeValue'])
## type-id.h (module 'core'): ns3::TypeIdChecker [class]
module.add_class('TypeIdChecker', parent=root_module['ns3::AttributeChecker'])
## type-id.h (module 'core'): ns3::TypeIdValue [class]
module.add_class('TypeIdValue', parent=root_module['ns3::AttributeValue'])
## uinteger.h (module 'core'): ns3::UintegerValue [class]
module.add_class('UintegerValue', parent=root_module['ns3::AttributeValue'])
## vector.h (module 'core'): ns3::Vector2DChecker [class]
module.add_class('Vector2DChecker', parent=root_module['ns3::AttributeChecker'])
## vector.h (module 'core'): ns3::Vector2DValue [class]
module.add_class('Vector2DValue', parent=root_module['ns3::AttributeValue'])
## vector.h (module 'core'): ns3::Vector3DChecker [class]
module.add_class('Vector3DChecker', parent=root_module['ns3::AttributeChecker'])
## vector.h (module 'core'): ns3::Vector3DValue [class]
module.add_class('Vector3DValue', parent=root_module['ns3::AttributeValue'])
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue', 'ns3::ObjectVectorValue')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue*', 'ns3::ObjectVectorValue*')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue&', 'ns3::ObjectVectorValue&')
module.add_typedef(root_module['ns3::ObjectPtrContainerValue'], 'ObjectVectorValue')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&')
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
module.add_typedef(root_module['ns3::Vector3D'], 'Vector')
typehandlers.add_type_alias('ns3::Vector3DValue', 'ns3::VectorValue')
typehandlers.add_type_alias('ns3::Vector3DValue*', 'ns3::VectorValue*')
typehandlers.add_type_alias('ns3::Vector3DValue&', 'ns3::VectorValue&')
module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue', 'ns3::ObjectMapValue')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue*', 'ns3::ObjectMapValue*')
typehandlers.add_type_alias('ns3::ObjectPtrContainerValue&', 'ns3::ObjectMapValue&')
module.add_typedef(root_module['ns3::ObjectPtrContainerValue'], 'ObjectMapValue')
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
module.add_typedef(root_module['ns3::Vector3DChecker'], 'VectorChecker')
## Register a nested module for the namespace Config
nested_module = module.add_cpp_namespace('Config')
register_types_ns3_Config(nested_module)
## Register a nested module for the namespace FatalImpl
nested_module = module.add_cpp_namespace('FatalImpl')
register_types_ns3_FatalImpl(nested_module)
## Register a nested module for the namespace SystemPath
nested_module = module.add_cpp_namespace('SystemPath')
register_types_ns3_SystemPath(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
register_types_ns3_internal(nested_module)
def register_types_ns3_Config(module):
root_module = module.get_root()
## config.h (module 'core'): ns3::Config::MatchContainer [class]
module.add_class('MatchContainer')
module.add_container('std::vector< ns3::Ptr< ns3::Object > >', 'ns3::Ptr< ns3::Object >', container_type='vector')
module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
def register_types_ns3_SystemPath(module):
root_module = module.get_root()
module.add_container('std::list< std::string >', 'std::string', container_type='list')
def register_types_ns3_internal(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3CommandLine_methods(root_module, root_module['ns3::CommandLine'])
register_Ns3CriticalSection_methods(root_module, root_module['ns3::CriticalSection'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3GlobalValue_methods(root_module, root_module['ns3::GlobalValue'])
register_Ns3IntToType__0_methods(root_module, root_module['ns3::IntToType< 0 >'])
register_Ns3IntToType__1_methods(root_module, root_module['ns3::IntToType< 1 >'])
register_Ns3IntToType__2_methods(root_module, root_module['ns3::IntToType< 2 >'])
register_Ns3IntToType__3_methods(root_module, root_module['ns3::IntToType< 3 >'])
register_Ns3IntToType__4_methods(root_module, root_module['ns3::IntToType< 4 >'])
register_Ns3IntToType__5_methods(root_module, root_module['ns3::IntToType< 5 >'])
register_Ns3IntToType__6_methods(root_module, root_module['ns3::IntToType< 6 >'])
register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3Names_methods(root_module, root_module['ns3::Names'])
register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase'])
register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter'])
register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory'])
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
register_Ns3RngStream_methods(root_module, root_module['ns3::RngStream'])
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3SystemCondition_methods(root_module, root_module['ns3::SystemCondition'])
register_Ns3SystemMutex_methods(root_module, root_module['ns3::SystemMutex'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
register_Ns3TimerImpl_methods(root_module, root_module['ns3::TimerImpl'])
register_Ns3TriangularVariable_methods(root_module, root_module['ns3::TriangularVariable'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation'])
register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation'])
register_Ns3UniformVariable_methods(root_module, root_module['ns3::UniformVariable'])
register_Ns3Vector2D_methods(root_module, root_module['ns3::Vector2D'])
register_Ns3Vector3D_methods(root_module, root_module['ns3::Vector3D'])
register_Ns3Watchdog_methods(root_module, root_module['ns3::Watchdog'])
register_Ns3WeibullVariable_methods(root_module, root_module['ns3::WeibullVariable'])
register_Ns3ZetaVariable_methods(root_module, root_module['ns3::ZetaVariable'])
register_Ns3ZipfVariable_methods(root_module, root_module['ns3::ZipfVariable'])
register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t'])
register_Ns3ConstantVariable_methods(root_module, root_module['ns3::ConstantVariable'])
register_Ns3DeterministicVariable_methods(root_module, root_module['ns3::DeterministicVariable'])
register_Ns3EmpiricalVariable_methods(root_module, root_module['ns3::EmpiricalVariable'])
register_Ns3ErlangVariable_methods(root_module, root_module['ns3::ErlangVariable'])
register_Ns3ExponentialVariable_methods(root_module, root_module['ns3::ExponentialVariable'])
register_Ns3GammaVariable_methods(root_module, root_module['ns3::GammaVariable'])
register_Ns3IntEmpiricalVariable_methods(root_module, root_module['ns3::IntEmpiricalVariable'])
register_Ns3LogNormalVariable_methods(root_module, root_module['ns3::LogNormalVariable'])
register_Ns3NormalVariable_methods(root_module, root_module['ns3::NormalVariable'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
register_Ns3Scheduler_methods(root_module, root_module['ns3::Scheduler'])
register_Ns3SchedulerEvent_methods(root_module, root_module['ns3::Scheduler::Event'])
register_Ns3SchedulerEventKey_methods(root_module, root_module['ns3::Scheduler::EventKey'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >'])
register_Ns3SimpleRefCount__Ns3RefCountBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3RefCountBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >'])
register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3SimulatorImpl_methods(root_module, root_module['ns3::SimulatorImpl'])
register_Ns3Synchronizer_methods(root_module, root_module['ns3::Synchronizer'])
register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
register_Ns3WallClockSynchronizer_methods(root_module, root_module['ns3::WallClockSynchronizer'])
register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker'])
register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue'])
register_Ns3CalendarScheduler_methods(root_module, root_module['ns3::CalendarScheduler'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3DefaultSimulatorImpl_methods(root_module, root_module['ns3::DefaultSimulatorImpl'])
register_Ns3DoubleValue_methods(root_module, root_module['ns3::DoubleValue'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker'])
register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue'])
register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl'])
register_Ns3FdReader_methods(root_module, root_module['ns3::FdReader'])
register_Ns3HeapScheduler_methods(root_module, root_module['ns3::HeapScheduler'])
register_Ns3IntegerValue_methods(root_module, root_module['ns3::IntegerValue'])
register_Ns3ListScheduler_methods(root_module, root_module['ns3::ListScheduler'])
register_Ns3MapScheduler_methods(root_module, root_module['ns3::MapScheduler'])
register_Ns3Ns2CalendarScheduler_methods(root_module, root_module['ns3::Ns2CalendarScheduler'])
register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker'])
register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue'])
register_Ns3ObjectPtrContainerAccessor_methods(root_module, root_module['ns3::ObjectPtrContainerAccessor'])
register_Ns3ObjectPtrContainerChecker_methods(root_module, root_module['ns3::ObjectPtrContainerChecker'])
register_Ns3ObjectPtrContainerValue_methods(root_module, root_module['ns3::ObjectPtrContainerValue'])
register_Ns3PointerChecker_methods(root_module, root_module['ns3::PointerChecker'])
register_Ns3PointerValue_methods(root_module, root_module['ns3::PointerValue'])
register_Ns3RandomVariableChecker_methods(root_module, root_module['ns3::RandomVariableChecker'])
register_Ns3RandomVariableValue_methods(root_module, root_module['ns3::RandomVariableValue'])
register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl'])
register_Ns3RefCountBase_methods(root_module, root_module['ns3::RefCountBase'])
register_Ns3StringChecker_methods(root_module, root_module['ns3::StringChecker'])
register_Ns3StringValue_methods(root_module, root_module['ns3::StringValue'])
register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker'])
register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue'])
register_Ns3UintegerValue_methods(root_module, root_module['ns3::UintegerValue'])
register_Ns3Vector2DChecker_methods(root_module, root_module['ns3::Vector2DChecker'])
register_Ns3Vector2DValue_methods(root_module, root_module['ns3::Vector2DValue'])
register_Ns3Vector3DChecker_methods(root_module, root_module['ns3::Vector3DChecker'])
register_Ns3Vector3DValue_methods(root_module, root_module['ns3::Vector3DValue'])
register_Ns3ConfigMatchContainer_methods(root_module, root_module['ns3::Config::MatchContainer'])
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')])
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('Find',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True)
return
def register_Ns3AttributeConstructionListItem_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable]
cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False)
return
def register_Ns3CallbackBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function]
cls.add_method('GetImpl',
'ns3::Ptr< ns3::CallbackImplBase >',
[],
is_const=True)
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
return
def register_Ns3CommandLine_methods(root_module, cls):
## command-line.h (module 'core'): ns3::CommandLine::CommandLine() [constructor]
cls.add_constructor([])
## command-line.h (module 'core'): ns3::CommandLine::CommandLine(ns3::CommandLine const & cmd) [copy constructor]
cls.add_constructor([param('ns3::CommandLine const &', 'cmd')])
## command-line.h (module 'core'): void ns3::CommandLine::AddValue(std::string const & name, std::string const & help, ns3::Callback<bool, std::string, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddValue',
'void',
[param('std::string const &', 'name'), param('std::string const &', 'help'), param('ns3::Callback< bool, std::string, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
return
def register_Ns3CriticalSection_methods(root_module, cls):
## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::CriticalSection const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CriticalSection const &', 'arg0')])
## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::SystemMutex & mutex) [constructor]
cls.add_constructor([param('ns3::SystemMutex &', 'mutex')])
return
def register_Ns3EventId_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('==')
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EventId const &', 'arg0')])
## event-id.h (module 'core'): ns3::EventId::EventId() [constructor]
cls.add_constructor([])
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')])
## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function]
cls.add_method('GetTs',
'uint64_t',
[],
is_const=True)
## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function]
cls.add_method('GetUid',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function]
cls.add_method('IsExpired',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function]
cls.add_method('IsRunning',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function]
cls.add_method('PeekEventImpl',
'ns3::EventImpl *',
[],
is_const=True)
return
def register_Ns3GlobalValue_methods(root_module, cls):
## global-value.h (module 'core'): ns3::GlobalValue::GlobalValue(ns3::GlobalValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::GlobalValue const &', 'arg0')])
## global-value.h (module 'core'): ns3::GlobalValue::GlobalValue(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeChecker const> checker) [constructor]
cls.add_constructor([param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## global-value.h (module 'core'): static __gnu_cxx::__normal_iterator<ns3::GlobalValue* const*,std::vector<ns3::GlobalValue*, std::allocator<ns3::GlobalValue*> > > ns3::GlobalValue::Begin() [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::GlobalValue * const *, std::vector< ns3::GlobalValue * > >',
[],
is_static=True)
## global-value.h (module 'core'): static void ns3::GlobalValue::Bind(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Bind',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')],
is_static=True)
## global-value.h (module 'core'): static bool ns3::GlobalValue::BindFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('BindFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')],
is_static=True)
## global-value.h (module 'core'): static __gnu_cxx::__normal_iterator<ns3::GlobalValue* const*,std::vector<ns3::GlobalValue*, std::allocator<ns3::GlobalValue*> > > ns3::GlobalValue::End() [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::GlobalValue * const *, std::vector< ns3::GlobalValue * > >',
[],
is_static=True)
## global-value.h (module 'core'): ns3::Ptr<ns3::AttributeChecker const> ns3::GlobalValue::GetChecker() const [member function]
cls.add_method('GetChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[],
is_const=True)
## global-value.h (module 'core'): std::string ns3::GlobalValue::GetHelp() const [member function]
cls.add_method('GetHelp',
'std::string',
[],
is_const=True)
## global-value.h (module 'core'): std::string ns3::GlobalValue::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## global-value.h (module 'core'): void ns3::GlobalValue::GetValue(ns3::AttributeValue & value) const [member function]
cls.add_method('GetValue',
'void',
[param('ns3::AttributeValue &', 'value')],
is_const=True)
## global-value.h (module 'core'): static void ns3::GlobalValue::GetValueByName(std::string name, ns3::AttributeValue & value) [member function]
cls.add_method('GetValueByName',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_static=True)
## global-value.h (module 'core'): static bool ns3::GlobalValue::GetValueByNameFailSafe(std::string name, ns3::AttributeValue & value) [member function]
cls.add_method('GetValueByNameFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_static=True)
## global-value.h (module 'core'): void ns3::GlobalValue::ResetInitialValue() [member function]
cls.add_method('ResetInitialValue',
'void',
[])
## global-value.h (module 'core'): bool ns3::GlobalValue::SetValue(ns3::AttributeValue const & value) [member function]
cls.add_method('SetValue',
'bool',
[param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3IntToType__0_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<0>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<0>::IntToType(ns3::IntToType<0> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 0 > const &', 'arg0')])
return
def register_Ns3IntToType__1_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<1>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<1>::IntToType(ns3::IntToType<1> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 1 > const &', 'arg0')])
return
def register_Ns3IntToType__2_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<2>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<2>::IntToType(ns3::IntToType<2> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 2 > const &', 'arg0')])
return
def register_Ns3IntToType__3_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<3>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<3>::IntToType(ns3::IntToType<3> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 3 > const &', 'arg0')])
return
def register_Ns3IntToType__4_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<4>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<4>::IntToType(ns3::IntToType<4> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 4 > const &', 'arg0')])
return
def register_Ns3IntToType__5_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<5>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<5>::IntToType(ns3::IntToType<5> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 5 > const &', 'arg0')])
return
def register_Ns3IntToType__6_methods(root_module, cls):
## int-to-type.h (module 'core'): ns3::IntToType<6>::IntToType() [constructor]
cls.add_constructor([])
## int-to-type.h (module 'core'): ns3::IntToType<6>::IntToType(ns3::IntToType<6> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntToType< 6 > const &', 'arg0')])
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
cls.add_method('EnvVarCheck',
'void',
[param('char const *', 'name')])
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
return
def register_Ns3Names_methods(root_module, cls):
## names.h (module 'core'): ns3::Names::Names() [constructor]
cls.add_constructor([])
## names.h (module 'core'): ns3::Names::Names(ns3::Names const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Names const &', 'arg0')])
## names.h (module 'core'): static void ns3::Names::Add(std::string name, ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Add(std::string path, std::string name, ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'path'), param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Add(ns3::Ptr<ns3::Object> context, std::string name, ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Object >', 'context'), param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Clear() [member function]
cls.add_method('Clear',
'void',
[],
is_static=True)
## names.h (module 'core'): static std::string ns3::Names::FindName(ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('FindName',
'std::string',
[param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static std::string ns3::Names::FindPath(ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('FindPath',
'std::string',
[param('ns3::Ptr< ns3::Object >', 'object')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Rename(std::string oldpath, std::string newname) [member function]
cls.add_method('Rename',
'void',
[param('std::string', 'oldpath'), param('std::string', 'newname')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Rename(std::string path, std::string oldname, std::string newname) [member function]
cls.add_method('Rename',
'void',
[param('std::string', 'path'), param('std::string', 'oldname'), param('std::string', 'newname')],
is_static=True)
## names.h (module 'core'): static void ns3::Names::Rename(ns3::Ptr<ns3::Object> context, std::string oldname, std::string newname) [member function]
cls.add_method('Rename',
'void',
[param('ns3::Ptr< ns3::Object >', 'context'), param('std::string', 'oldname'), param('std::string', 'newname')],
is_static=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor]
cls.add_constructor([])
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')])
## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function]
cls.add_method('GetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')],
is_const=True)
## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function]
cls.add_method('ConstructSelf',
'void',
[param('ns3::AttributeConstructionList const &', 'attributes')],
visibility='protected')
## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectDeleter_methods(root_module, cls):
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor]
cls.add_constructor([])
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')])
## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Object *', 'object')],
is_static=True)
return
def register_Ns3ObjectFactory_methods(root_module, cls):
cls.add_output_stream_operator()
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor]
cls.add_constructor([param('std::string', 'typeId')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::Object >',
[],
is_const=True)
## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('ns3::TypeId', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('char const *', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('std::string', 'tid')])
return
def register_Ns3RandomVariable_methods(root_module, cls):
cls.add_output_stream_operator()
## random-variable.h (module 'core'): ns3::RandomVariable::RandomVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::RandomVariable::RandomVariable(ns3::RandomVariable const & o) [copy constructor]
cls.add_constructor([param('ns3::RandomVariable const &', 'o')])
## random-variable.h (module 'core'): uint32_t ns3::RandomVariable::GetInteger() const [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::RandomVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
return
def register_Ns3RngStream_methods(root_module, cls):
## rng-stream.h (module 'core'): ns3::RngStream::RngStream() [constructor]
cls.add_constructor([])
## rng-stream.h (module 'core'): ns3::RngStream::RngStream(ns3::RngStream const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RngStream const &', 'arg0')])
## rng-stream.h (module 'core'): void ns3::RngStream::AdvanceState(int32_t e, int32_t c) [member function]
cls.add_method('AdvanceState',
'void',
[param('int32_t', 'e'), param('int32_t', 'c')])
## rng-stream.h (module 'core'): static bool ns3::RngStream::CheckSeed(uint32_t const * seed) [member function]
cls.add_method('CheckSeed',
'bool',
[param('uint32_t const *', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): static bool ns3::RngStream::CheckSeed(uint32_t seed) [member function]
cls.add_method('CheckSeed',
'bool',
[param('uint32_t', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): static uint32_t ns3::RngStream::GetPackageRun() [member function]
cls.add_method('GetPackageRun',
'uint32_t',
[],
is_static=True)
## rng-stream.h (module 'core'): static void ns3::RngStream::GetPackageSeed(uint32_t * seed) [member function]
cls.add_method('GetPackageSeed',
'void',
[param('uint32_t *', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): void ns3::RngStream::GetState(uint32_t * seed) const [member function]
cls.add_method('GetState',
'void',
[param('uint32_t *', 'seed')],
is_const=True)
## rng-stream.h (module 'core'): void ns3::RngStream::IncreasedPrecis(bool incp) [member function]
cls.add_method('IncreasedPrecis',
'void',
[param('bool', 'incp')])
## rng-stream.h (module 'core'): void ns3::RngStream::InitializeStream() [member function]
cls.add_method('InitializeStream',
'void',
[])
## rng-stream.h (module 'core'): int32_t ns3::RngStream::RandInt(int32_t i, int32_t j) [member function]
cls.add_method('RandInt',
'int32_t',
[param('int32_t', 'i'), param('int32_t', 'j')])
## rng-stream.h (module 'core'): double ns3::RngStream::RandU01() [member function]
cls.add_method('RandU01',
'double',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetNextSubstream() [member function]
cls.add_method('ResetNextSubstream',
'void',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetNthSubstream(uint32_t N) [member function]
cls.add_method('ResetNthSubstream',
'void',
[param('uint32_t', 'N')])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetStartStream() [member function]
cls.add_method('ResetStartStream',
'void',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::ResetStartSubstream() [member function]
cls.add_method('ResetStartSubstream',
'void',
[])
## rng-stream.h (module 'core'): void ns3::RngStream::SetAntithetic(bool a) [member function]
cls.add_method('SetAntithetic',
'void',
[param('bool', 'a')])
## rng-stream.h (module 'core'): static void ns3::RngStream::SetPackageRun(uint32_t run) [member function]
cls.add_method('SetPackageRun',
'void',
[param('uint32_t', 'run')],
is_static=True)
## rng-stream.h (module 'core'): static bool ns3::RngStream::SetPackageSeed(uint32_t seed) [member function]
cls.add_method('SetPackageSeed',
'bool',
[param('uint32_t', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): static bool ns3::RngStream::SetPackageSeed(uint32_t const * seed) [member function]
cls.add_method('SetPackageSeed',
'bool',
[param('uint32_t const *', 'seed')],
is_static=True)
## rng-stream.h (module 'core'): bool ns3::RngStream::SetSeeds(uint32_t const * seed) [member function]
cls.add_method('SetSeeds',
'bool',
[param('uint32_t const *', 'seed')])
return
def register_Ns3SeedManager_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
cls.add_method('CheckSeed',
'bool',
[param('uint32_t', 'seed')],
is_static=True)
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
cls.add_method('GetRun',
'uint32_t',
[],
is_static=True)
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
cls.add_method('GetSeed',
'uint32_t',
[],
is_static=True)
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
cls.add_method('SetRun',
'void',
[param('uint32_t', 'run')],
is_static=True)
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
cls.add_method('SetSeed',
'void',
[param('uint32_t', 'seed')],
is_static=True)
return
def register_Ns3SequentialVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(ns3::SequentialVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SequentialVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(double f, double l, double i=1, uint32_t c=1) [constructor]
cls.add_constructor([param('double', 'f'), param('double', 'l'), param('double', 'i', default_value='1'), param('uint32_t', 'c', default_value='1')])
## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(double f, double l, ns3::RandomVariable const & i, uint32_t c=1) [constructor]
cls.add_constructor([param('double', 'f'), param('double', 'l'), param('ns3::RandomVariable const &', 'i'), param('uint32_t', 'c', default_value='1')])
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3Simulator_methods(root_module, cls):
## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Simulator const &', 'arg0')])
## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function]
cls.add_method('GetImplementation',
'ns3::Ptr< ns3::SimulatorImpl >',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function]
cls.add_method('IsFinished',
'bool',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Next() [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
cls.add_method('SetImplementation',
'void',
[param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_static=True)
return
def register_Ns3SystemCondition_methods(root_module, cls):
## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition(ns3::SystemCondition const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemCondition const &', 'arg0')])
## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition() [constructor]
cls.add_constructor([])
## system-condition.h (module 'core'): void ns3::SystemCondition::Broadcast() [member function]
cls.add_method('Broadcast',
'void',
[])
## system-condition.h (module 'core'): bool ns3::SystemCondition::GetCondition() [member function]
cls.add_method('GetCondition',
'bool',
[])
## system-condition.h (module 'core'): void ns3::SystemCondition::SetCondition(bool condition) [member function]
cls.add_method('SetCondition',
'void',
[param('bool', 'condition')])
## system-condition.h (module 'core'): void ns3::SystemCondition::Signal() [member function]
cls.add_method('Signal',
'void',
[])
## system-condition.h (module 'core'): bool ns3::SystemCondition::TimedWait(uint64_t ns) [member function]
cls.add_method('TimedWait',
'bool',
[param('uint64_t', 'ns')])
## system-condition.h (module 'core'): void ns3::SystemCondition::Wait() [member function]
cls.add_method('Wait',
'void',
[])
return
def register_Ns3SystemMutex_methods(root_module, cls):
## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex(ns3::SystemMutex const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemMutex const &', 'arg0')])
## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex() [constructor]
cls.add_constructor([])
## system-mutex.h (module 'core'): void ns3::SystemMutex::Lock() [member function]
cls.add_method('Lock',
'void',
[])
## system-mutex.h (module 'core'): void ns3::SystemMutex::Unlock() [member function]
cls.add_method('Unlock',
'void',
[])
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor]
cls.add_constructor([])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function]
cls.add_method('End',
'int64_t',
[])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function]
cls.add_method('GetElapsedReal',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function]
cls.add_method('GetElapsedSystem',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function]
cls.add_method('GetElapsedUser',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Timer_methods(root_module, cls):
## timer.h (module 'core'): ns3::Timer::Timer(ns3::Timer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Timer const &', 'arg0')])
## timer.h (module 'core'): ns3::Timer::Timer() [constructor]
cls.add_constructor([])
## timer.h (module 'core'): ns3::Timer::Timer(ns3::Timer::DestroyPolicy destroyPolicy) [constructor]
cls.add_constructor([param('ns3::Timer::DestroyPolicy', 'destroyPolicy')])
## timer.h (module 'core'): void ns3::Timer::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## timer.h (module 'core'): ns3::Time ns3::Timer::GetDelay() const [member function]
cls.add_method('GetDelay',
'ns3::Time',
[],
is_const=True)
## timer.h (module 'core'): ns3::Time ns3::Timer::GetDelayLeft() const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[],
is_const=True)
## timer.h (module 'core'): ns3::Timer::State ns3::Timer::GetState() const [member function]
cls.add_method('GetState',
'ns3::Timer::State',
[],
is_const=True)
## timer.h (module 'core'): bool ns3::Timer::IsExpired() const [member function]
cls.add_method('IsExpired',
'bool',
[],
is_const=True)
## timer.h (module 'core'): bool ns3::Timer::IsRunning() const [member function]
cls.add_method('IsRunning',
'bool',
[],
is_const=True)
## timer.h (module 'core'): bool ns3::Timer::IsSuspended() const [member function]
cls.add_method('IsSuspended',
'bool',
[],
is_const=True)
## timer.h (module 'core'): void ns3::Timer::Remove() [member function]
cls.add_method('Remove',
'void',
[])
## timer.h (module 'core'): void ns3::Timer::Resume() [member function]
cls.add_method('Resume',
'void',
[])
## timer.h (module 'core'): void ns3::Timer::Schedule() [member function]
cls.add_method('Schedule',
'void',
[])
## timer.h (module 'core'): void ns3::Timer::Schedule(ns3::Time delay) [member function]
cls.add_method('Schedule',
'void',
[param('ns3::Time', 'delay')])
## timer.h (module 'core'): void ns3::Timer::SetDelay(ns3::Time const & delay) [member function]
cls.add_method('SetDelay',
'void',
[param('ns3::Time const &', 'delay')])
## timer.h (module 'core'): void ns3::Timer::Suspend() [member function]
cls.add_method('Suspend',
'void',
[])
return
def register_Ns3TimerImpl_methods(root_module, cls):
## timer-impl.h (module 'core'): ns3::TimerImpl::TimerImpl() [constructor]
cls.add_constructor([])
## timer-impl.h (module 'core'): ns3::TimerImpl::TimerImpl(ns3::TimerImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimerImpl const &', 'arg0')])
## timer-impl.h (module 'core'): void ns3::TimerImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## timer-impl.h (module 'core'): ns3::EventId ns3::TimerImpl::Schedule(ns3::Time const & delay) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'delay')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3TriangularVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable(ns3::TriangularVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TriangularVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable(double s, double l, double mean) [constructor]
cls.add_constructor([param('double', 's'), param('double', 'l'), param('double', 'mean')])
return
def register_Ns3TypeId_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor]
cls.add_constructor([param('ns3::TypeId const &', 'o')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function]
cls.add_method('GetConstructor',
'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function]
cls.add_method('GetGroupName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function]
cls.add_method('GetParent',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint32_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint32_t',
[],
is_static=True)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function]
cls.add_method('GetUid',
'uint16_t',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function]
cls.add_method('HasConstructor',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function]
cls.add_method('HasParent',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function]
cls.add_method('HideFromDocumentation',
'ns3::TypeId',
[])
## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function]
cls.add_method('IsChildOf',
'bool',
[param('ns3::TypeId', 'other')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function]
cls.add_method('LookupAttributeByName',
'bool',
[param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info')],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function]
cls.add_method('LookupByName',
'ns3::TypeId',
[param('std::string', 'name')],
is_static=True)
## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function]
cls.add_method('MustHideFromDocumentation',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function]
cls.add_method('SetGroupName',
'ns3::TypeId',
[param('std::string', 'groupName')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[param('ns3::TypeId', 'tid')])
## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'tid')])
return
def register_Ns3TypeIdAttributeInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable]
cls.add_instance_attribute('flags', 'uint32_t', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable]
cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable]
cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
return
def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
return
def register_Ns3UniformVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable(ns3::UniformVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UniformVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable(double s, double l) [constructor]
cls.add_constructor([param('double', 's'), param('double', 'l')])
## random-variable.h (module 'core'): uint32_t ns3::UniformVariable::GetInteger(uint32_t s, uint32_t l) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 's'), param('uint32_t', 'l')])
## random-variable.h (module 'core'): double ns3::UniformVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::UniformVariable::GetValue(double s, double l) [member function]
cls.add_method('GetValue',
'double',
[param('double', 's'), param('double', 'l')])
return
def register_Ns3Vector2D_methods(root_module, cls):
cls.add_output_stream_operator()
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
cls.add_constructor([param('double', '_x'), param('double', '_y')])
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector2D::x [variable]
cls.add_instance_attribute('x', 'double', is_const=False)
## vector.h (module 'core'): ns3::Vector2D::y [variable]
cls.add_instance_attribute('y', 'double', is_const=False)
return
def register_Ns3Vector3D_methods(root_module, cls):
cls.add_output_stream_operator()
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector3D::x [variable]
cls.add_instance_attribute('x', 'double', is_const=False)
## vector.h (module 'core'): ns3::Vector3D::y [variable]
cls.add_instance_attribute('y', 'double', is_const=False)
## vector.h (module 'core'): ns3::Vector3D::z [variable]
cls.add_instance_attribute('z', 'double', is_const=False)
return
def register_Ns3Watchdog_methods(root_module, cls):
## watchdog.h (module 'core'): ns3::Watchdog::Watchdog(ns3::Watchdog const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Watchdog const &', 'arg0')])
## watchdog.h (module 'core'): ns3::Watchdog::Watchdog() [constructor]
cls.add_constructor([])
## watchdog.h (module 'core'): void ns3::Watchdog::Ping(ns3::Time delay) [member function]
cls.add_method('Ping',
'void',
[param('ns3::Time', 'delay')])
return
def register_Ns3WeibullVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(ns3::WeibullVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::WeibullVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m) [constructor]
cls.add_constructor([param('double', 'm')])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m, double s) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's')])
## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m, double s, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')])
return
def register_Ns3ZetaVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable(ns3::ZetaVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ZetaVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable(double alpha) [constructor]
cls.add_constructor([param('double', 'alpha')])
## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable() [constructor]
cls.add_constructor([])
return
def register_Ns3ZipfVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable(ns3::ZipfVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ZipfVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable(long int N, double alpha) [constructor]
cls.add_constructor([param('long int', 'N'), param('double', 'alpha')])
## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable() [constructor]
cls.add_constructor([])
return
def register_Ns3Empty_methods(root_module, cls):
## empty.h (module 'core'): ns3::empty::empty() [constructor]
cls.add_constructor([])
## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor]
cls.add_constructor([param('ns3::empty const &', 'arg0')])
return
def register_Ns3Int64x64_t_methods(root_module, cls):
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_unary_numeric_operator('-')
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
cls.add_constructor([])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor]
cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'o')])
## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function]
cls.add_method('GetHigh',
'int64_t',
[],
is_const=True)
## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function]
cls.add_method('GetLow',
'uint64_t',
[],
is_const=True)
## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function]
cls.add_method('Invert',
'ns3::int64x64_t',
[param('uint64_t', 'v')],
is_static=True)
## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function]
cls.add_method('MulByInvert',
'void',
[param('ns3::int64x64_t const &', 'o')])
return
def register_Ns3ConstantVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable(ns3::ConstantVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ConstantVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable(double c) [constructor]
cls.add_constructor([param('double', 'c')])
## random-variable.h (module 'core'): void ns3::ConstantVariable::SetConstant(double c) [member function]
cls.add_method('SetConstant',
'void',
[param('double', 'c')])
return
def register_Ns3DeterministicVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::DeterministicVariable::DeterministicVariable(ns3::DeterministicVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DeterministicVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::DeterministicVariable::DeterministicVariable(double * d, uint32_t c) [constructor]
cls.add_constructor([param('double *', 'd'), param('uint32_t', 'c')])
return
def register_Ns3EmpiricalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::EmpiricalVariable::EmpiricalVariable(ns3::EmpiricalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmpiricalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::EmpiricalVariable::EmpiricalVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): void ns3::EmpiricalVariable::CDF(double v, double c) [member function]
cls.add_method('CDF',
'void',
[param('double', 'v'), param('double', 'c')])
return
def register_Ns3ErlangVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable(ns3::ErlangVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ErlangVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable(unsigned int k, double lambda) [constructor]
cls.add_constructor([param('unsigned int', 'k'), param('double', 'lambda')])
## random-variable.h (module 'core'): double ns3::ErlangVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::ErlangVariable::GetValue(unsigned int k, double lambda) const [member function]
cls.add_method('GetValue',
'double',
[param('unsigned int', 'k'), param('double', 'lambda')],
is_const=True)
return
def register_Ns3ExponentialVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(ns3::ExponentialVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ExponentialVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(double m) [constructor]
cls.add_constructor([param('double', 'm')])
## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(double m, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 'b')])
return
def register_Ns3GammaVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable(ns3::GammaVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::GammaVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable(double alpha, double beta) [constructor]
cls.add_constructor([param('double', 'alpha'), param('double', 'beta')])
## random-variable.h (module 'core'): double ns3::GammaVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
[],
is_const=True)
## random-variable.h (module 'core'): double ns3::GammaVariable::GetValue(double alpha, double beta) const [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha'), param('double', 'beta')],
is_const=True)
return
def register_Ns3IntEmpiricalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::IntEmpiricalVariable::IntEmpiricalVariable(ns3::IntEmpiricalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntEmpiricalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::IntEmpiricalVariable::IntEmpiricalVariable() [constructor]
cls.add_constructor([])
return
def register_Ns3LogNormalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::LogNormalVariable::LogNormalVariable(ns3::LogNormalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogNormalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::LogNormalVariable::LogNormalVariable(double mu, double sigma) [constructor]
cls.add_constructor([param('double', 'mu'), param('double', 'sigma')])
return
def register_Ns3NormalVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(ns3::NormalVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NormalVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(double m, double v) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 'v')])
## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(double m, double v, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 'v'), param('double', 'b')])
return
def register_Ns3Object_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::Object() [constructor]
cls.add_constructor([])
## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function]
cls.add_method('AggregateObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'other')])
## object.h (module 'core'): void ns3::Object::Dispose() [member function]
cls.add_method('Dispose',
'void',
[])
## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function]
cls.add_method('GetAggregateIterator',
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object> ns3::Object::GetObject(ns3::TypeId tid) const [member function]
cls.add_method('GetObject',
'ns3::Ptr< ns3::Object >',
[param('ns3::TypeId', 'tid')],
is_const=True, template_parameters=['ns3::Object'], custom_template_method_name='GetObject')
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object.h (module 'core'): void ns3::Object::Start() [member function]
cls.add_method('Start',
'void',
[])
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor]
cls.add_constructor([param('ns3::Object const &', 'o')],
visibility='protected')
## object.h (module 'core'): void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::DoStart() [member function]
cls.add_method('DoStart',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectAggregateIterator_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')])
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor]
cls.add_constructor([])
## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3ParetoVariable_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(ns3::ParetoVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ParetoVariable const &', 'arg0')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m) [constructor]
cls.add_constructor([param('double', 'm')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m, double s) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m, double s, double b) [constructor]
cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(std::pair<double,double> params) [constructor]
cls.add_constructor([param('std::pair< double, double >', 'params')])
## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(std::pair<double,double> params, double b) [constructor]
cls.add_constructor([param('std::pair< double, double >', 'params'), param('double', 'b')])
return
def register_Ns3Scheduler_methods(root_module, cls):
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler(ns3::Scheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler const &', 'arg0')])
## scheduler.h (module 'core'): static ns3::TypeId ns3::Scheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): bool ns3::Scheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3SchedulerEvent_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event(ns3::Scheduler::Event const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::Event const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::Event::impl [variable]
cls.add_instance_attribute('impl', 'ns3::EventImpl *', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::Event::key [variable]
cls.add_instance_attribute('key', 'ns3::Scheduler::EventKey', is_const=False)
return
def register_Ns3SchedulerEventKey_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::EventKey const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_context [variable]
cls.add_instance_attribute('m_context', 'uint32_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_ts [variable]
cls.add_instance_attribute('m_ts', 'uint64_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_uid [variable]
cls.add_instance_attribute('m_uid', 'uint32_t', is_const=False)
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter< ns3::FdReader > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3RefCountBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3RefCountBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter< ns3::RefCountBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::RefCountBase, ns3::empty, ns3::DefaultDeleter<ns3::RefCountBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount(ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter< ns3::SystemThread > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimulatorImpl_methods(root_module, cls):
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl() [constructor]
cls.add_constructor([])
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl(ns3::SimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimulatorImpl const &', 'arg0')])
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): static ns3::TypeId ns3::SimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Synchronizer_methods(root_module, cls):
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer(ns3::Synchronizer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Synchronizer const &', 'arg0')])
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer() [constructor]
cls.add_constructor([])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::EventEnd() [member function]
cls.add_method('EventEnd',
'uint64_t',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::EventStart() [member function]
cls.add_method('EventStart',
'void',
[])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetCurrentRealtime() [member function]
cls.add_method('GetCurrentRealtime',
'uint64_t',
[])
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::GetDrift(uint64_t ts) [member function]
cls.add_method('GetDrift',
'int64_t',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetOrigin() [member function]
cls.add_method('GetOrigin',
'uint64_t',
[])
## synchronizer.h (module 'core'): static ns3::TypeId ns3::Synchronizer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Realtime() [member function]
cls.add_method('Realtime',
'bool',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetCondition(bool arg0) [member function]
cls.add_method('SetCondition',
'void',
[param('bool', 'arg0')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetOrigin(uint64_t ts) [member function]
cls.add_method('SetOrigin',
'void',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::Signal() [member function]
cls.add_method('Signal',
'void',
[])
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Synchronize(uint64_t tsCurrent, uint64_t tsDelay) [member function]
cls.add_method('Synchronize',
'bool',
[param('uint64_t', 'tsCurrent'), param('uint64_t', 'tsDelay')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoEventEnd() [member function]
cls.add_method('DoEventEnd',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoEventStart() [member function]
cls.add_method('DoEventStart',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoGetCurrentRealtime() [member function]
cls.add_method('DoGetCurrentRealtime',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::DoGetDrift(uint64_t ns) [member function]
cls.add_method('DoGetDrift',
'int64_t',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoRealtime() [member function]
cls.add_method('DoRealtime',
'bool',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetCondition(bool arg0) [member function]
cls.add_method('DoSetCondition',
'void',
[param('bool', 'arg0')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetOrigin(uint64_t ns) [member function]
cls.add_method('DoSetOrigin',
'void',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSignal() [member function]
cls.add_method('DoSignal',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function]
cls.add_method('DoSynchronize',
'bool',
[param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3SystemThread_methods(root_module, cls):
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemThread const &', 'arg0')])
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor]
cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function]
cls.add_method('Break',
'bool',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function]
cls.add_method('Join',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function]
cls.add_method('Shutdown',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor]
cls.add_constructor([param('ns3::Time const &', 'o')])
## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor]
cls.add_constructor([param('std::string const &', 's')])
## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'value')])
## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function]
cls.add_method('Compare',
'int',
[param('ns3::Time const &', 'o')],
is_const=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & from, ns3::Time::Unit timeUnit) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'from'), param('ns3::Time::Unit', 'timeUnit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'value')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit timeUnit) [member function]
cls.add_method('FromDouble',
'ns3::Time',
[param('double', 'value'), param('ns3::Time::Unit', 'timeUnit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit timeUnit) [member function]
cls.add_method('FromInteger',
'ns3::Time',
[param('uint64_t', 'value'), param('ns3::Time::Unit', 'timeUnit')],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function]
cls.add_method('GetFemtoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function]
cls.add_method('GetInteger',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function]
cls.add_method('GetMicroSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function]
cls.add_method('GetMilliSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function]
cls.add_method('GetNanoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function]
cls.add_method('GetPicoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function]
cls.add_method('GetResolution',
'ns3::Time::Unit',
[],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function]
cls.add_method('GetSeconds',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function]
cls.add_method('GetTimeStep',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function]
cls.add_method('IsNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function]
cls.add_method('IsPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function]
cls.add_method('IsStrictlyNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function]
cls.add_method('IsStrictlyPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function]
cls.add_method('IsZero',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function]
cls.add_method('SetResolution',
'void',
[param('ns3::Time::Unit', 'resolution')],
is_static=True)
## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit timeUnit) const [member function]
cls.add_method('To',
'ns3::int64x64_t',
[param('ns3::Time::Unit', 'timeUnit')],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit timeUnit) const [member function]
cls.add_method('ToDouble',
'double',
[param('ns3::Time::Unit', 'timeUnit')],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit timeUnit) const [member function]
cls.add_method('ToInteger',
'int64_t',
[param('ns3::Time::Unit', 'timeUnit')],
is_const=True)
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor]
cls.add_constructor([])
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Connect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('ConnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Disconnect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('DisconnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3WallClockSynchronizer_methods(root_module, cls):
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::WallClockSynchronizer(ns3::WallClockSynchronizer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::WallClockSynchronizer const &', 'arg0')])
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::WallClockSynchronizer() [constructor]
cls.add_constructor([])
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::NS_PER_SEC [variable]
cls.add_static_attribute('NS_PER_SEC', 'uint64_t const', is_const=True)
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::US_PER_NS [variable]
cls.add_static_attribute('US_PER_NS', 'uint64_t const', is_const=True)
## wall-clock-synchronizer.h (module 'core'): ns3::WallClockSynchronizer::US_PER_SEC [variable]
cls.add_static_attribute('US_PER_SEC', 'uint64_t const', is_const=True)
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::DoEventEnd() [member function]
cls.add_method('DoEventEnd',
'uint64_t',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoEventStart() [member function]
cls.add_method('DoEventStart',
'void',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::DoGetCurrentRealtime() [member function]
cls.add_method('DoGetCurrentRealtime',
'uint64_t',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): int64_t ns3::WallClockSynchronizer::DoGetDrift(uint64_t ns) [member function]
cls.add_method('DoGetDrift',
'int64_t',
[param('uint64_t', 'ns')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::DoRealtime() [member function]
cls.add_method('DoRealtime',
'bool',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoSetCondition(bool cond) [member function]
cls.add_method('DoSetCondition',
'void',
[param('bool', 'cond')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoSetOrigin(uint64_t ns) [member function]
cls.add_method('DoSetOrigin',
'void',
[param('uint64_t', 'ns')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::DoSignal() [member function]
cls.add_method('DoSignal',
'void',
[],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function]
cls.add_method('DoSynchronize',
'bool',
[param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')],
visibility='protected', is_virtual=True)
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::DriftCorrect(uint64_t nsNow, uint64_t nsDelay) [member function]
cls.add_method('DriftCorrect',
'uint64_t',
[param('uint64_t', 'nsNow'), param('uint64_t', 'nsDelay')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::GetNormalizedRealtime() [member function]
cls.add_method('GetNormalizedRealtime',
'uint64_t',
[],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::GetRealtime() [member function]
cls.add_method('GetRealtime',
'uint64_t',
[],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::NsToTimeval(int64_t ns, timeval * tv) [member function]
cls.add_method('NsToTimeval',
'void',
[param('int64_t', 'ns'), param('timeval *', 'tv')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::SleepWait(uint64_t arg0) [member function]
cls.add_method('SleepWait',
'bool',
[param('uint64_t', 'arg0')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): bool ns3::WallClockSynchronizer::SpinWait(uint64_t arg0) [member function]
cls.add_method('SpinWait',
'bool',
[param('uint64_t', 'arg0')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): void ns3::WallClockSynchronizer::TimevalAdd(timeval * tv1, timeval * tv2, timeval * result) [member function]
cls.add_method('TimevalAdd',
'void',
[param('timeval *', 'tv1'), param('timeval *', 'tv2'), param('timeval *', 'result')],
visibility='protected')
## wall-clock-synchronizer.h (module 'core'): uint64_t ns3::WallClockSynchronizer::TimevalToNs(timeval * tv) [member function]
cls.add_method('TimevalToNs',
'uint64_t',
[param('timeval *', 'tv')],
visibility='protected')
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3BooleanChecker_methods(root_module, cls):
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BooleanChecker const &', 'arg0')])
return
def register_Ns3BooleanValue_methods(root_module, cls):
cls.add_output_stream_operator()
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(ns3::BooleanValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BooleanValue const &', 'arg0')])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(bool value) [constructor]
cls.add_constructor([param('bool', 'value')])
## boolean.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::BooleanValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::Get() const [member function]
cls.add_method('Get',
'bool',
[],
is_const=True)
## boolean.h (module 'core'): std::string ns3::BooleanValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): void ns3::BooleanValue::Set(bool value) [member function]
cls.add_method('Set',
'void',
[param('bool', 'value')])
return
def register_Ns3CalendarScheduler_methods(root_module, cls):
## calendar-scheduler.h (module 'core'): ns3::CalendarScheduler::CalendarScheduler(ns3::CalendarScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CalendarScheduler const &', 'arg0')])
## calendar-scheduler.h (module 'core'): ns3::CalendarScheduler::CalendarScheduler() [constructor]
cls.add_constructor([])
## calendar-scheduler.h (module 'core'): static ns3::TypeId ns3::CalendarScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## calendar-scheduler.h (module 'core'): void ns3::CalendarScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## calendar-scheduler.h (module 'core'): bool ns3::CalendarScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::CalendarScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## calendar-scheduler.h (module 'core'): void ns3::CalendarScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::CalendarScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3DefaultSimulatorImpl_methods(root_module, cls):
## default-simulator-impl.h (module 'core'): ns3::DefaultSimulatorImpl::DefaultSimulatorImpl(ns3::DefaultSimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DefaultSimulatorImpl const &', 'arg0')])
## default-simulator-impl.h (module 'core'): ns3::DefaultSimulatorImpl::DefaultSimulatorImpl() [constructor]
cls.add_constructor([])
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): uint32_t ns3::DefaultSimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): uint32_t ns3::DefaultSimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): static ns3::TypeId ns3::DefaultSimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## default-simulator-impl.h (module 'core'): bool ns3::DefaultSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): bool ns3::DefaultSimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3DoubleValue_methods(root_module, cls):
## double.h (module 'core'): ns3::DoubleValue::DoubleValue() [constructor]
cls.add_constructor([])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(ns3::DoubleValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DoubleValue const &', 'arg0')])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(double const & value) [constructor]
cls.add_constructor([param('double const &', 'value')])
## double.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::DoubleValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## double.h (module 'core'): bool ns3::DoubleValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## double.h (module 'core'): double ns3::DoubleValue::Get() const [member function]
cls.add_method('Get',
'double',
[],
is_const=True)
## double.h (module 'core'): std::string ns3::DoubleValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## double.h (module 'core'): void ns3::DoubleValue::Set(double const & value) [member function]
cls.add_method('Set',
'void',
[param('double const &', 'value')])
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3EnumChecker_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker(ns3::EnumChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EnumChecker const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): void ns3::EnumChecker::Add(int v, std::string name) [member function]
cls.add_method('Add',
'void',
[param('int', 'v'), param('std::string', 'name')])
## enum.h (module 'core'): void ns3::EnumChecker::AddDefault(int v, std::string name) [member function]
cls.add_method('AddDefault',
'void',
[param('int', 'v'), param('std::string', 'name')])
## enum.h (module 'core'): bool ns3::EnumChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::Copy(ns3::AttributeValue const & src, ns3::AttributeValue & dst) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'src'), param('ns3::AttributeValue &', 'dst')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EnumValue_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumValue::EnumValue(ns3::EnumValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EnumValue const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumValue::EnumValue() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): ns3::EnumValue::EnumValue(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## enum.h (module 'core'): int ns3::EnumValue::Get() const [member function]
cls.add_method('Get',
'int',
[],
is_const=True)
## enum.h (module 'core'): std::string ns3::EnumValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): void ns3::EnumValue::Set(int v) [member function]
cls.add_method('Set',
'void',
[param('int', 'v')])
return
def register_Ns3EventImpl_methods(root_module, cls):
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EventImpl const &', 'arg0')])
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor]
cls.add_constructor([])
## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[])
## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function]
cls.add_method('IsCancelled',
'bool',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function]
cls.add_method('Notify',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3FdReader_methods(root_module, cls):
## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader(ns3::FdReader const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FdReader const &', 'arg0')])
## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader() [constructor]
cls.add_constructor([])
## unix-fd-reader.h (module 'core'): void ns3::FdReader::Start(int fd, ns3::Callback<void, unsigned char*, long, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> readCallback) [member function]
cls.add_method('Start',
'void',
[param('int', 'fd'), param('ns3::Callback< void, unsigned char *, long, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'readCallback')])
## unix-fd-reader.h (module 'core'): void ns3::FdReader::Stop() [member function]
cls.add_method('Stop',
'void',
[])
## unix-fd-reader.h (module 'core'): ns3::FdReader::Data ns3::FdReader::DoRead() [member function]
cls.add_method('DoRead',
'ns3::FdReader::Data',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3HeapScheduler_methods(root_module, cls):
## heap-scheduler.h (module 'core'): ns3::HeapScheduler::HeapScheduler(ns3::HeapScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::HeapScheduler const &', 'arg0')])
## heap-scheduler.h (module 'core'): ns3::HeapScheduler::HeapScheduler() [constructor]
cls.add_constructor([])
## heap-scheduler.h (module 'core'): static ns3::TypeId ns3::HeapScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## heap-scheduler.h (module 'core'): void ns3::HeapScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## heap-scheduler.h (module 'core'): bool ns3::HeapScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## heap-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::HeapScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## heap-scheduler.h (module 'core'): void ns3::HeapScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## heap-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::HeapScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3IntegerValue_methods(root_module, cls):
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue() [constructor]
cls.add_constructor([])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(ns3::IntegerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntegerValue const &', 'arg0')])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(int64_t const & value) [constructor]
cls.add_constructor([param('int64_t const &', 'value')])
## integer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::IntegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## integer.h (module 'core'): bool ns3::IntegerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## integer.h (module 'core'): int64_t ns3::IntegerValue::Get() const [member function]
cls.add_method('Get',
'int64_t',
[],
is_const=True)
## integer.h (module 'core'): std::string ns3::IntegerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## integer.h (module 'core'): void ns3::IntegerValue::Set(int64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('int64_t const &', 'value')])
return
def register_Ns3ListScheduler_methods(root_module, cls):
## list-scheduler.h (module 'core'): ns3::ListScheduler::ListScheduler(ns3::ListScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ListScheduler const &', 'arg0')])
## list-scheduler.h (module 'core'): ns3::ListScheduler::ListScheduler() [constructor]
cls.add_constructor([])
## list-scheduler.h (module 'core'): static ns3::TypeId ns3::ListScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## list-scheduler.h (module 'core'): void ns3::ListScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## list-scheduler.h (module 'core'): bool ns3::ListScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## list-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::ListScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## list-scheduler.h (module 'core'): void ns3::ListScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## list-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::ListScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3MapScheduler_methods(root_module, cls):
## map-scheduler.h (module 'core'): ns3::MapScheduler::MapScheduler(ns3::MapScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MapScheduler const &', 'arg0')])
## map-scheduler.h (module 'core'): ns3::MapScheduler::MapScheduler() [constructor]
cls.add_constructor([])
## map-scheduler.h (module 'core'): static ns3::TypeId ns3::MapScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## map-scheduler.h (module 'core'): void ns3::MapScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## map-scheduler.h (module 'core'): bool ns3::MapScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## map-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::MapScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## map-scheduler.h (module 'core'): void ns3::MapScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## map-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::MapScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3Ns2CalendarScheduler_methods(root_module, cls):
## ns2-calendar-scheduler.h (module 'core'): ns3::Ns2CalendarScheduler::Ns2CalendarScheduler(ns3::Ns2CalendarScheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ns2CalendarScheduler const &', 'arg0')])
## ns2-calendar-scheduler.h (module 'core'): ns3::Ns2CalendarScheduler::Ns2CalendarScheduler() [constructor]
cls.add_constructor([])
## ns2-calendar-scheduler.h (module 'core'): static ns3::TypeId ns3::Ns2CalendarScheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ns2-calendar-scheduler.h (module 'core'): void ns3::Ns2CalendarScheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): bool ns3::Ns2CalendarScheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True, is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Ns2CalendarScheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_const=True, is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): void ns3::Ns2CalendarScheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_virtual=True)
## ns2-calendar-scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Ns2CalendarScheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_virtual=True)
return
def register_Ns3ObjectFactoryChecker_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')])
return
def register_Ns3ObjectFactoryValue_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'value')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function]
cls.add_method('Get',
'ns3::ObjectFactory',
[],
is_const=True)
## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ObjectFactory const &', 'value')])
return
def register_Ns3ObjectPtrContainerAccessor_methods(root_module, cls):
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerAccessor::ObjectPtrContainerAccessor() [constructor]
cls.add_constructor([])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerAccessor::ObjectPtrContainerAccessor(ns3::ObjectPtrContainerAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectPtrContainerAccessor const &', 'arg0')])
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & value) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'value')],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object'), param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectPtrContainerAccessor::DoGet(ns3::ObjectBase const * object, uint32_t i) const [member function]
cls.add_method('DoGet',
'ns3::Ptr< ns3::Object >',
[param('ns3::ObjectBase const *', 'object'), param('uint32_t', 'i')],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerAccessor::DoGetN(ns3::ObjectBase const * object, uint32_t * n) const [member function]
cls.add_method('DoGetN',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('uint32_t *', 'n')],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3ObjectPtrContainerChecker_methods(root_module, cls):
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerChecker::ObjectPtrContainerChecker() [constructor]
cls.add_constructor([])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerChecker::ObjectPtrContainerChecker(ns3::ObjectPtrContainerChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectPtrContainerChecker const &', 'arg0')])
## object-ptr-container.h (module 'core'): ns3::TypeId ns3::ObjectPtrContainerChecker::GetItemTypeId() const [member function]
cls.add_method('GetItemTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3ObjectPtrContainerValue_methods(root_module, cls):
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerValue::ObjectPtrContainerValue(ns3::ObjectPtrContainerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectPtrContainerValue const &', 'arg0')])
## object-ptr-container.h (module 'core'): ns3::ObjectPtrContainerValue::ObjectPtrContainerValue() [constructor]
cls.add_constructor([])
## object-ptr-container.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::ObjectPtrContainerValue::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## object-ptr-container.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectPtrContainerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-ptr-container.h (module 'core'): bool ns3::ObjectPtrContainerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-ptr-container.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::ObjectPtrContainerValue::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## object-ptr-container.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectPtrContainerValue::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Object >',
[param('uint32_t', 'i')],
is_const=True)
## object-ptr-container.h (module 'core'): uint32_t ns3::ObjectPtrContainerValue::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## object-ptr-container.h (module 'core'): std::string ns3::ObjectPtrContainerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
return
def register_Ns3PointerChecker_methods(root_module, cls):
## pointer.h (module 'core'): ns3::PointerChecker::PointerChecker() [constructor]
cls.add_constructor([])
## pointer.h (module 'core'): ns3::PointerChecker::PointerChecker(ns3::PointerChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PointerChecker const &', 'arg0')])
## pointer.h (module 'core'): ns3::TypeId ns3::PointerChecker::GetPointeeTypeId() const [member function]
cls.add_method('GetPointeeTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3PointerValue_methods(root_module, cls):
## pointer.h (module 'core'): ns3::PointerValue::PointerValue(ns3::PointerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PointerValue const &', 'arg0')])
## pointer.h (module 'core'): ns3::PointerValue::PointerValue() [constructor]
cls.add_constructor([])
## pointer.h (module 'core'): ns3::PointerValue::PointerValue(ns3::Ptr<ns3::Object> object) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Object >', 'object')])
## pointer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::PointerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## pointer.h (module 'core'): bool ns3::PointerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## pointer.h (module 'core'): ns3::Ptr<ns3::Object> ns3::PointerValue::GetObject() const [member function]
cls.add_method('GetObject',
'ns3::Ptr< ns3::Object >',
[],
is_const=True)
## pointer.h (module 'core'): std::string ns3::PointerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## pointer.h (module 'core'): void ns3::PointerValue::SetObject(ns3::Ptr<ns3::Object> object) [member function]
cls.add_method('SetObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'object')])
return
def register_Ns3RandomVariableChecker_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::RandomVariableChecker::RandomVariableChecker() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::RandomVariableChecker::RandomVariableChecker(ns3::RandomVariableChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RandomVariableChecker const &', 'arg0')])
return
def register_Ns3RandomVariableValue_methods(root_module, cls):
## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue() [constructor]
cls.add_constructor([])
## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue(ns3::RandomVariableValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RandomVariableValue const &', 'arg0')])
## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue(ns3::RandomVariable const & value) [constructor]
cls.add_constructor([param('ns3::RandomVariable const &', 'value')])
## random-variable.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::RandomVariableValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## random-variable.h (module 'core'): bool ns3::RandomVariableValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## random-variable.h (module 'core'): ns3::RandomVariable ns3::RandomVariableValue::Get() const [member function]
cls.add_method('Get',
'ns3::RandomVariable',
[],
is_const=True)
## random-variable.h (module 'core'): std::string ns3::RandomVariableValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## random-variable.h (module 'core'): void ns3::RandomVariableValue::Set(ns3::RandomVariable const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::RandomVariable const &', 'value')])
return
def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl() [constructor]
cls.add_constructor([])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetHardLimit() const [member function]
cls.add_method('GetHardLimit',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode ns3::RealtimeSimulatorImpl::GetSynchronizationMode() const [member function]
cls.add_method('GetSynchronizationMode',
'ns3::RealtimeSimulatorImpl::SynchronizationMode',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): static ns3::TypeId ns3::RealtimeSimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::RealtimeNow() const [member function]
cls.add_method('RealtimeNow',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtime(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtime',
'void',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNow',
'void',
[param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(uint32_t context, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNowWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetHardLimit(ns3::Time limit) [member function]
cls.add_method('SetHardLimit',
'void',
[param('ns3::Time', 'limit')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetSynchronizationMode(ns3::RealtimeSimulatorImpl::SynchronizationMode mode) [member function]
cls.add_method('SetSynchronizationMode',
'void',
[param('ns3::RealtimeSimulatorImpl::SynchronizationMode', 'mode')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3RefCountBase_methods(root_module, cls):
## ref-count-base.h (module 'core'): ns3::RefCountBase::RefCountBase() [constructor]
cls.add_constructor([])
## ref-count-base.h (module 'core'): ns3::RefCountBase::RefCountBase(ns3::RefCountBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RefCountBase const &', 'arg0')])
return
def register_Ns3StringChecker_methods(root_module, cls):
## string.h (module 'core'): ns3::StringChecker::StringChecker() [constructor]
cls.add_constructor([])
## string.h (module 'core'): ns3::StringChecker::StringChecker(ns3::StringChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StringChecker const &', 'arg0')])
return
def register_Ns3StringValue_methods(root_module, cls):
## string.h (module 'core'): ns3::StringValue::StringValue() [constructor]
cls.add_constructor([])
## string.h (module 'core'): ns3::StringValue::StringValue(ns3::StringValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StringValue const &', 'arg0')])
## string.h (module 'core'): ns3::StringValue::StringValue(std::string const & value) [constructor]
cls.add_constructor([param('std::string const &', 'value')])
## string.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::StringValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## string.h (module 'core'): bool ns3::StringValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## string.h (module 'core'): std::string ns3::StringValue::Get() const [member function]
cls.add_method('Get',
'std::string',
[],
is_const=True)
## string.h (module 'core'): std::string ns3::StringValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## string.h (module 'core'): void ns3::StringValue::Set(std::string const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string const &', 'value')])
return
def register_Ns3TimeChecker_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker(ns3::TimeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimeChecker const &', 'arg0')])
return
def register_Ns3TimeValue_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimeValue const &', 'arg0')])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor]
cls.add_constructor([param('ns3::Time const &', 'value')])
## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function]
cls.add_method('Get',
'ns3::Time',
[],
is_const=True)
## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Time const &', 'value')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3UintegerValue_methods(root_module, cls):
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue() [constructor]
cls.add_constructor([])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(ns3::UintegerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UintegerValue const &', 'arg0')])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(uint64_t const & value) [constructor]
cls.add_constructor([param('uint64_t const &', 'value')])
## uinteger.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::UintegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): bool ns3::UintegerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## uinteger.h (module 'core'): uint64_t ns3::UintegerValue::Get() const [member function]
cls.add_method('Get',
'uint64_t',
[],
is_const=True)
## uinteger.h (module 'core'): std::string ns3::UintegerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): void ns3::UintegerValue::Set(uint64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('uint64_t const &', 'value')])
return
def register_Ns3Vector2DChecker_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector2DChecker::Vector2DChecker() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector2DChecker::Vector2DChecker(ns3::Vector2DChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector2DChecker const &', 'arg0')])
return
def register_Ns3Vector2DValue_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector2DValue::Vector2DValue() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector2DValue::Vector2DValue(ns3::Vector2DValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector2DValue const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector2DValue::Vector2DValue(ns3::Vector2D const & value) [constructor]
cls.add_constructor([param('ns3::Vector2D const &', 'value')])
## vector.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::Vector2DValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## vector.h (module 'core'): bool ns3::Vector2DValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## vector.h (module 'core'): ns3::Vector2D ns3::Vector2DValue::Get() const [member function]
cls.add_method('Get',
'ns3::Vector2D',
[],
is_const=True)
## vector.h (module 'core'): std::string ns3::Vector2DValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## vector.h (module 'core'): void ns3::Vector2DValue::Set(ns3::Vector2D const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Vector2D const &', 'value')])
return
def register_Ns3Vector3DChecker_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector3DChecker::Vector3DChecker() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector3DChecker::Vector3DChecker(ns3::Vector3DChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector3DChecker const &', 'arg0')])
return
def register_Ns3Vector3DValue_methods(root_module, cls):
## vector.h (module 'core'): ns3::Vector3DValue::Vector3DValue() [constructor]
cls.add_constructor([])
## vector.h (module 'core'): ns3::Vector3DValue::Vector3DValue(ns3::Vector3DValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Vector3DValue const &', 'arg0')])
## vector.h (module 'core'): ns3::Vector3DValue::Vector3DValue(ns3::Vector3D const & value) [constructor]
cls.add_constructor([param('ns3::Vector3D const &', 'value')])
## vector.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::Vector3DValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## vector.h (module 'core'): bool ns3::Vector3DValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## vector.h (module 'core'): ns3::Vector3D ns3::Vector3DValue::Get() const [member function]
cls.add_method('Get',
'ns3::Vector3D',
[],
is_const=True)
## vector.h (module 'core'): std::string ns3::Vector3DValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## vector.h (module 'core'): void ns3::Vector3DValue::Set(ns3::Vector3D const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Vector3D const &', 'value')])
return
def register_Ns3ConfigMatchContainer_methods(root_module, cls):
## config.h (module 'core'): ns3::Config::MatchContainer::MatchContainer(ns3::Config::MatchContainer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Config::MatchContainer const &', 'arg0')])
## config.h (module 'core'): ns3::Config::MatchContainer::MatchContainer() [constructor]
cls.add_constructor([])
## config.h (module 'core'): ns3::Config::MatchContainer::MatchContainer(std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > const & objects, std::vector<std::string, std::allocator<std::string> > const & contexts, std::string path) [constructor]
cls.add_constructor([param('std::vector< ns3::Ptr< ns3::Object > > const &', 'objects'), param('std::vector< std::string > const &', 'contexts'), param('std::string', 'path')])
## config.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::Config::MatchContainer::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## config.h (module 'core'): void ns3::Config::MatchContainer::Connect(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('Connect',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): void ns3::Config::MatchContainer::ConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('ConnectWithoutContext',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): void ns3::Config::MatchContainer::Disconnect(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('Disconnect',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): void ns3::Config::MatchContainer::DisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('DisconnectWithoutContext',
'void',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Object>*,std::vector<ns3::Ptr<ns3::Object>, std::allocator<ns3::Ptr<ns3::Object> > > > ns3::Config::MatchContainer::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Object > const, std::vector< ns3::Ptr< ns3::Object > > >',
[],
is_const=True)
## config.h (module 'core'): ns3::Ptr<ns3::Object> ns3::Config::MatchContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Object >',
[param('uint32_t', 'i')],
is_const=True)
## config.h (module 'core'): std::string ns3::Config::MatchContainer::GetMatchedPath(uint32_t i) const [member function]
cls.add_method('GetMatchedPath',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## config.h (module 'core'): uint32_t ns3::Config::MatchContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## config.h (module 'core'): std::string ns3::Config::MatchContainer::GetPath() const [member function]
cls.add_method('GetPath',
'std::string',
[],
is_const=True)
## config.h (module 'core'): void ns3::Config::MatchContainer::Set(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_functions(root_module):
module = root_module
## nstime.h (module 'core'): ns3::Time ns3::Abs(ns3::Time const & time) [free function]
module.add_function('Abs',
'ns3::Time',
[param('ns3::Time const &', 'time')])
## int64x64.h (module 'core'): ns3::int64x64_t ns3::Abs(ns3::int64x64_t const & value) [free function]
module.add_function('Abs',
'ns3::int64x64_t',
[param('ns3::int64x64_t const &', 'value')])
## breakpoint.h (module 'core'): extern void ns3::BreakpointFallback() [free function]
module.add_function('BreakpointFallback',
'void',
[])
## vector.h (module 'core'): extern double ns3::CalculateDistance(ns3::Vector2D const & a, ns3::Vector2D const & b) [free function]
module.add_function('CalculateDistance',
'double',
[param('ns3::Vector2D const &', 'a'), param('ns3::Vector2D const &', 'b')])
## vector.h (module 'core'): extern double ns3::CalculateDistance(ns3::Vector3D const & a, ns3::Vector3D const & b) [free function]
module.add_function('CalculateDistance',
'double',
[param('ns3::Vector3D const &', 'a'), param('ns3::Vector3D const &', 'b')])
## ptr.h (module 'core'): extern ns3::Ptr<ns3::ObjectPtrContainerValue> ns3::Create() [free function]
module.add_function('Create',
'ns3::Ptr< ns3::ObjectPtrContainerValue >',
[],
template_parameters=['ns3::ObjectPtrContainerValue'])
## ptr.h (module 'core'): extern ns3::Ptr<ns3::PointerValue> ns3::Create() [free function]
module.add_function('Create',
'ns3::Ptr< ns3::PointerValue >',
[],
template_parameters=['ns3::PointerValue'])
## nstime.h (module 'core'): ns3::Time ns3::FemtoSeconds(ns3::int64x64_t fs) [free function]
module.add_function('FemtoSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'fs')])
## nstime.h (module 'core'): ns3::Time ns3::FemtoSeconds(uint64_t fs) [free function]
module.add_function('FemtoSeconds',
'ns3::Time',
[param('uint64_t', 'fs')])
## log.h (module 'core'): extern void ns3::LogComponentDisable(char const * name, ns3::LogLevel level) [free function]
module.add_function('LogComponentDisable',
'void',
[param('char const *', 'name'), param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentDisableAll(ns3::LogLevel level) [free function]
module.add_function('LogComponentDisableAll',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentEnable(char const * name, ns3::LogLevel level) [free function]
module.add_function('LogComponentEnable',
'void',
[param('char const *', 'name'), param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentEnableAll(ns3::LogLevel level) [free function]
module.add_function('LogComponentEnableAll',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): extern void ns3::LogComponentPrintList() [free function]
module.add_function('LogComponentPrintList',
'void',
[])
## log.h (module 'core'): extern ns3::LogNodePrinter ns3::LogGetNodePrinter() [free function]
module.add_function('LogGetNodePrinter',
'ns3::LogNodePrinter',
[])
## log.h (module 'core'): extern ns3::LogTimePrinter ns3::LogGetTimePrinter() [free function]
module.add_function('LogGetTimePrinter',
'ns3::LogTimePrinter',
[])
## log.h (module 'core'): extern void ns3::LogSetNodePrinter(ns3::LogNodePrinter arg0) [free function]
module.add_function('LogSetNodePrinter',
'void',
[param('ns3::LogNodePrinter', 'arg0')])
## log.h (module 'core'): extern void ns3::LogSetTimePrinter(ns3::LogTimePrinter arg0) [free function]
module.add_function('LogSetTimePrinter',
'void',
[param('ns3::LogTimePrinter', 'arg0')])
## boolean.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeBooleanChecker() [free function]
module.add_function('MakeBooleanChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## callback.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeCallbackChecker() [free function]
module.add_function('MakeCallbackChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## enum.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeEnumChecker(int v1, std::string n1, int v2=0, std::string n2="", int v3=0, std::string n3="", int v4=0, std::string n4="", int v5=0, std::string n5="", int v6=0, std::string n6="", int v7=0, std::string n7="", int v8=0, std::string n8="", int v9=0, std::string n9="", int v10=0, std::string n10="", int v11=0, std::string n11="", int v12=0, std::string n12="", int v13=0, std::string n13="", int v14=0, std::string n14="", int v15=0, std::string n15="", int v16=0, std::string n16="", int v17=0, std::string n17="", int v18=0, std::string n18="", int v19=0, std::string n19="", int v20=0, std::string n20="", int v21=0, std::string n21="", int v22=0, std::string n22="") [free function]
module.add_function('MakeEnumChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('int', 'v1'), param('std::string', 'n1'), param('int', 'v2', default_value='0'), param('std::string', 'n2', default_value='""'), param('int', 'v3', default_value='0'), param('std::string', 'n3', default_value='""'), param('int', 'v4', default_value='0'), param('std::string', 'n4', default_value='""'), param('int', 'v5', default_value='0'), param('std::string', 'n5', default_value='""'), param('int', 'v6', default_value='0'), param('std::string', 'n6', default_value='""'), param('int', 'v7', default_value='0'), param('std::string', 'n7', default_value='""'), param('int', 'v8', default_value='0'), param('std::string', 'n8', default_value='""'), param('int', 'v9', default_value='0'), param('std::string', 'n9', default_value='""'), param('int', 'v10', default_value='0'), param('std::string', 'n10', default_value='""'), param('int', 'v11', default_value='0'), param('std::string', 'n11', default_value='""'), param('int', 'v12', default_value='0'), param('std::string', 'n12', default_value='""'), param('int', 'v13', default_value='0'), param('std::string', 'n13', default_value='""'), param('int', 'v14', default_value='0'), param('std::string', 'n14', default_value='""'), param('int', 'v15', default_value='0'), param('std::string', 'n15', default_value='""'), param('int', 'v16', default_value='0'), param('std::string', 'n16', default_value='""'), param('int', 'v17', default_value='0'), param('std::string', 'n17', default_value='""'), param('int', 'v18', default_value='0'), param('std::string', 'n18', default_value='""'), param('int', 'v19', default_value='0'), param('std::string', 'n19', default_value='""'), param('int', 'v20', default_value='0'), param('std::string', 'n20', default_value='""'), param('int', 'v21', default_value='0'), param('std::string', 'n21', default_value='""'), param('int', 'v22', default_value='0'), param('std::string', 'n22', default_value='""')])
## make-event.h (module 'core'): extern ns3::EventImpl * ns3::MakeEvent(void (*)( ) * f) [free function]
module.add_function('MakeEvent',
'ns3::EventImpl *',
[param('void ( * ) ( ) *', 'f')])
## object-factory.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeObjectFactoryChecker() [free function]
module.add_function('MakeObjectFactoryChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## random-variable.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeRandomVariableChecker() [free function]
module.add_function('MakeRandomVariableChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## string.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeStringChecker() [free function]
module.add_function('MakeStringChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## nstime.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeTimeChecker() [free function]
module.add_function('MakeTimeChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## type-id.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeTypeIdChecker() [free function]
module.add_function('MakeTypeIdChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## vector.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVector2DChecker() [free function]
module.add_function('MakeVector2DChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## vector.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVector3DChecker() [free function]
module.add_function('MakeVector3DChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## vector.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVectorChecker() [free function]
module.add_function('MakeVectorChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## nstime.h (module 'core'): ns3::Time ns3::Max(ns3::Time const & ta, ns3::Time const & tb) [free function]
module.add_function('Max',
'ns3::Time',
[param('ns3::Time const &', 'ta'), param('ns3::Time const &', 'tb')])
## int64x64.h (module 'core'): ns3::int64x64_t ns3::Max(ns3::int64x64_t const & a, ns3::int64x64_t const & b) [free function]
module.add_function('Max',
'ns3::int64x64_t',
[param('ns3::int64x64_t const &', 'a'), param('ns3::int64x64_t const &', 'b')])
## nstime.h (module 'core'): ns3::Time ns3::MicroSeconds(ns3::int64x64_t us) [free function]
module.add_function('MicroSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'us')])
## nstime.h (module 'core'): ns3::Time ns3::MicroSeconds(uint64_t us) [free function]
module.add_function('MicroSeconds',
'ns3::Time',
[param('uint64_t', 'us')])
## nstime.h (module 'core'): ns3::Time ns3::MilliSeconds(ns3::int64x64_t ms) [free function]
module.add_function('MilliSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'ms')])
## nstime.h (module 'core'): ns3::Time ns3::MilliSeconds(uint64_t ms) [free function]
module.add_function('MilliSeconds',
'ns3::Time',
[param('uint64_t', 'ms')])
## nstime.h (module 'core'): ns3::Time ns3::Min(ns3::Time const & ta, ns3::Time const & tb) [free function]
module.add_function('Min',
'ns3::Time',
[param('ns3::Time const &', 'ta'), param('ns3::Time const &', 'tb')])
## int64x64.h (module 'core'): ns3::int64x64_t ns3::Min(ns3::int64x64_t const & a, ns3::int64x64_t const & b) [free function]
module.add_function('Min',
'ns3::int64x64_t',
[param('ns3::int64x64_t const &', 'a'), param('ns3::int64x64_t const &', 'b')])
## nstime.h (module 'core'): ns3::Time ns3::NanoSeconds(ns3::int64x64_t ns) [free function]
module.add_function('NanoSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'ns')])
## nstime.h (module 'core'): ns3::Time ns3::NanoSeconds(uint64_t ns) [free function]
module.add_function('NanoSeconds',
'ns3::Time',
[param('uint64_t', 'ns')])
## simulator.h (module 'core'): extern ns3::Time ns3::Now() [free function]
module.add_function('Now',
'ns3::Time',
[])
## nstime.h (module 'core'): ns3::Time ns3::PicoSeconds(ns3::int64x64_t ps) [free function]
module.add_function('PicoSeconds',
'ns3::Time',
[param('ns3::int64x64_t', 'ps')])
## nstime.h (module 'core'): ns3::Time ns3::PicoSeconds(uint64_t ps) [free function]
module.add_function('PicoSeconds',
'ns3::Time',
[param('uint64_t', 'ps')])
## nstime.h (module 'core'): ns3::Time ns3::Seconds(ns3::int64x64_t seconds) [free function]
module.add_function('Seconds',
'ns3::Time',
[param('ns3::int64x64_t', 'seconds')])
## nstime.h (module 'core'): ns3::Time ns3::Seconds(double seconds) [free function]
module.add_function('Seconds',
'ns3::Time',
[param('double', 'seconds')])
## test.h (module 'core'): extern bool ns3::TestDoubleIsEqual(double const a, double const b, double const epsilon=std::numeric_limits<double>::epsilon()) [free function]
module.add_function('TestDoubleIsEqual',
'bool',
[param('double const', 'a'), param('double const', 'b'), param('double const', 'epsilon', default_value='std::numeric_limits<double>::epsilon()')])
## nstime.h (module 'core'): ns3::Time ns3::TimeStep(uint64_t ts) [free function]
module.add_function('TimeStep',
'ns3::Time',
[param('uint64_t', 'ts')])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['double'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['float'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['long'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['int'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['short'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['signed char'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned long'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned int'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned short'])
## type-name.h (module 'core'): extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
[],
template_parameters=['unsigned char'])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
register_functions_ns3_SystemPath(module.get_submodule('SystemPath'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
return
def register_functions_ns3_Config(module, root_module):
## config.h (module 'core'): extern void ns3::Config::Connect(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('Connect',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern void ns3::Config::ConnectWithoutContext(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('ConnectWithoutContext',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern void ns3::Config::Disconnect(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('Disconnect',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern void ns3::Config::DisconnectWithoutContext(std::string path, ns3::CallbackBase const & cb) [free function]
module.add_function('DisconnectWithoutContext',
'void',
[param('std::string', 'path'), param('ns3::CallbackBase const &', 'cb')])
## config.h (module 'core'): extern ns3::Ptr<ns3::Object> ns3::Config::GetRootNamespaceObject(uint32_t i) [free function]
module.add_function('GetRootNamespaceObject',
'ns3::Ptr< ns3::Object >',
[param('uint32_t', 'i')])
## config.h (module 'core'): extern uint32_t ns3::Config::GetRootNamespaceObjectN() [free function]
module.add_function('GetRootNamespaceObjectN',
'uint32_t',
[])
## config.h (module 'core'): extern ns3::Config::MatchContainer ns3::Config::LookupMatches(std::string path) [free function]
module.add_function('LookupMatches',
'ns3::Config::MatchContainer',
[param('std::string', 'path')])
## config.h (module 'core'): extern void ns3::Config::RegisterRootNamespaceObject(ns3::Ptr<ns3::Object> obj) [free function]
module.add_function('RegisterRootNamespaceObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'obj')])
## config.h (module 'core'): extern void ns3::Config::Reset() [free function]
module.add_function('Reset',
'void',
[])
## config.h (module 'core'): extern void ns3::Config::Set(std::string path, ns3::AttributeValue const & value) [free function]
module.add_function('Set',
'void',
[param('std::string', 'path'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern void ns3::Config::SetDefault(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetDefault',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern bool ns3::Config::SetDefaultFailSafe(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetDefaultFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern void ns3::Config::SetGlobal(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetGlobal',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern bool ns3::Config::SetGlobalFailSafe(std::string name, ns3::AttributeValue const & value) [free function]
module.add_function('SetGlobalFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## config.h (module 'core'): extern void ns3::Config::UnregisterRootNamespaceObject(ns3::Ptr<ns3::Object> obj) [free function]
module.add_function('UnregisterRootNamespaceObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'obj')])
return
def register_functions_ns3_FatalImpl(module, root_module):
## fatal-impl.h (module 'core'): extern void ns3::FatalImpl::FlushStreams() [free function]
module.add_function('FlushStreams',
'void',
[])
## fatal-impl.h (module 'core'): extern void ns3::FatalImpl::RegisterStream(std::ostream * stream) [free function]
module.add_function('RegisterStream',
'void',
[param('std::ostream *', 'stream')])
## fatal-impl.h (module 'core'): extern void ns3::FatalImpl::UnregisterStream(std::ostream * stream) [free function]
module.add_function('UnregisterStream',
'void',
[param('std::ostream *', 'stream')])
return
def register_functions_ns3_SystemPath(module, root_module):
## system-path.h (module 'core'): extern std::string ns3::SystemPath::Append(std::string left, std::string right) [free function]
module.add_function('Append',
'std::string',
[param('std::string', 'left'), param('std::string', 'right')])
## system-path.h (module 'core'): extern std::string ns3::SystemPath::FindSelfDirectory() [free function]
module.add_function('FindSelfDirectory',
'std::string',
[])
## system-path.h (module 'core'): extern std::string ns3::SystemPath::Join(std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > begin, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > end) [free function]
module.add_function('Join',
'std::string',
[param('std::_List_const_iterator< std::basic_string< char, std::char_traits< char >, std::allocator< char > > >', 'begin'), param('std::_List_const_iterator< std::basic_string< char, std::char_traits< char >, std::allocator< char > > >', 'end')])
## system-path.h (module 'core'): extern void ns3::SystemPath::MakeDirectories(std::string path) [free function]
module.add_function('MakeDirectories',
'void',
[param('std::string', 'path')])
## system-path.h (module 'core'): extern std::string ns3::SystemPath::MakeTemporaryDirectoryName() [free function]
module.add_function('MakeTemporaryDirectoryName',
'std::string',
[])
## system-path.h (module 'core'): extern std::list<std::string, std::allocator<std::string> > ns3::SystemPath::ReadFiles(std::string path) [free function]
module.add_function('ReadFiles',
'std::list< std::string >',
[param('std::string', 'path')])
## system-path.h (module 'core'): extern std::list<std::string, std::allocator<std::string> > ns3::SystemPath::Split(std::string path) [free function]
module.add_function('Split',
'std::list< std::string >',
[param('std::string', 'path')])
return
def register_functions_ns3_internal(module, root_module):
## double.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeDoubleChecker(double min, double max, std::string name) [free function]
module.add_function('MakeDoubleChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('double', 'min'), param('double', 'max'), param('std::string', 'name')])
## integer.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeIntegerChecker(int64_t min, int64_t max, std::string name) [free function]
module.add_function('MakeIntegerChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('int64_t', 'min'), param('int64_t', 'max'), param('std::string', 'name')])
## uinteger.h (module 'core'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeUintegerChecker(uint64_t min, uint64_t max, std::string name) [free function]
module.add_function('MakeUintegerChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[param('uint64_t', 'min'), param('uint64_t', 'max'), param('std::string', 'name')])
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
| zy901002-gpsr | src/core/bindings/modulegen__gcc_LP64.py | Python | gpl2 | 278,187 |
#include "ns3module.h"
#include "ns3/ref-count-base.h"
namespace {
class PythonEventImpl : public ns3::EventImpl
{
private:
PyObject *m_callback;
PyObject *m_args;
public:
PythonEventImpl (PyObject *callback, PyObject *args)
{
m_callback = callback;
Py_INCREF (m_callback);
m_args = args;
Py_INCREF (m_args);
}
virtual ~PythonEventImpl ()
{
PyGILState_STATE __py_gil_state;
__py_gil_state = (PyEval_ThreadsInitialized () ? PyGILState_Ensure () : (PyGILState_STATE) 0);
Py_DECREF (m_callback);
Py_DECREF (m_args);
if (PyEval_ThreadsInitialized ())
PyGILState_Release (__py_gil_state);
}
virtual void Notify ()
{
PyGILState_STATE __py_gil_state;
__py_gil_state = (PyEval_ThreadsInitialized () ? PyGILState_Ensure () : (PyGILState_STATE) 0);
PyObject *retval = PyObject_CallObject (m_callback, m_args);
if (retval) {
if (retval != Py_None) {
PyErr_SetString (PyExc_TypeError, "event callback should return None");
PyErr_Print ();
}
Py_DECREF (retval);
} else {
PyErr_Print ();
}
if (PyEval_ThreadsInitialized ())
PyGILState_Release (__py_gil_state);
}
};
} // closes: namespace {
PyObject *
_wrap_Simulator_Schedule (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
PyObject *exc_type, *traceback;
PyObject *py_time;
PyObject *py_callback;
PyObject *user_args;
ns3::Ptr<PythonEventImpl> py_event_impl;
PyNs3EventId *py_EventId;
if (kwargs && PyObject_Length (kwargs) > 0) {
PyErr_SetString (PyExc_TypeError, "keyword arguments not supported");
goto error;
}
if (PyTuple_GET_SIZE (args) < 2) {
PyErr_SetString (PyExc_TypeError, "ns3.Simulator.Schedule needs at least 2 arguments");
goto error;
}
py_time = PyTuple_GET_ITEM (args, 0);
py_callback = PyTuple_GET_ITEM (args, 1);
if (!PyObject_IsInstance (py_time, (PyObject*) &PyNs3Time_Type)) {
PyErr_SetString (PyExc_TypeError, "Parameter 1 should be a ns3.Time instance");
goto error;
}
if (!PyCallable_Check (py_callback)) {
PyErr_SetString (PyExc_TypeError, "Parameter 2 should be callable");
goto error;
}
user_args = PyTuple_GetSlice (args, 2, PyTuple_GET_SIZE (args));
py_event_impl = ns3::Create<PythonEventImpl>(py_callback, user_args);
Py_DECREF (user_args);
py_EventId = PyObject_New (PyNs3EventId, &PyNs3EventId_Type);
py_EventId->obj = new ns3::EventId (
ns3::Simulator::Schedule (*((PyNs3Time *) py_time)->obj, py_event_impl));
py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
return (PyObject *) py_EventId;
error:
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
PyObject *
_wrap_Simulator_ScheduleNow (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
PyObject *exc_type, *traceback;
PyObject *py_callback;
PyObject *user_args;
ns3::Ptr<PythonEventImpl> py_event_impl;
PyNs3EventId *py_EventId;
if (kwargs && PyObject_Length (kwargs) > 0) {
PyErr_SetString (PyExc_TypeError, "keyword arguments not supported");
goto error;
}
if (PyTuple_GET_SIZE (args) < 1) {
PyErr_SetString (PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument");
goto error;
}
py_callback = PyTuple_GET_ITEM (args, 0);
if (!PyCallable_Check (py_callback)) {
PyErr_SetString (PyExc_TypeError, "Parameter 2 should be callable");
goto error;
}
user_args = PyTuple_GetSlice (args, 1, PyTuple_GET_SIZE (args));
py_event_impl = ns3::Create<PythonEventImpl>(py_callback, user_args);
Py_DECREF (user_args);
py_EventId = PyObject_New (PyNs3EventId, &PyNs3EventId_Type);
py_EventId->obj = new ns3::EventId (ns3::Simulator::ScheduleNow (py_event_impl));
py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
return (PyObject *) py_EventId;
error:
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
PyObject *
_wrap_Simulator_ScheduleDestroy (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
PyObject *exc_type, *traceback;
PyObject *py_callback;
PyObject *user_args;
ns3::Ptr<PythonEventImpl> py_event_impl;
PyNs3EventId *py_EventId;
if (kwargs && PyObject_Length (kwargs) > 0) {
PyErr_SetString (PyExc_TypeError, "keyword arguments not supported");
goto error;
}
if (PyTuple_GET_SIZE (args) < 1) {
PyErr_SetString (PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument");
goto error;
}
py_callback = PyTuple_GET_ITEM (args, 0);
if (!PyCallable_Check (py_callback)) {
PyErr_SetString (PyExc_TypeError, "Parameter 2 should be callable");
goto error;
}
user_args = PyTuple_GetSlice (args, 1, PyTuple_GET_SIZE (args));
py_event_impl = ns3::Create<PythonEventImpl>(py_callback, user_args);
Py_DECREF (user_args);
py_EventId = PyObject_New (PyNs3EventId, &PyNs3EventId_Type);
py_EventId->obj = new ns3::EventId (ns3::Simulator::ScheduleDestroy (py_event_impl));
py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
return (PyObject *) py_EventId;
error:
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
PyObject *
_wrap_TypeId_LookupByNameFailSafe (PyNs3TypeId *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
bool ok;
const char *name;
Py_ssize_t name_len;
ns3::TypeId tid;
PyNs3TypeId *py_tid;
const char *keywords[] = { "name", NULL};
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "s#", (char **) keywords, &name, &name_len)) {
PyObject *exc_type, *traceback;
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
ok = ns3::TypeId::LookupByNameFailSafe (std::string (name, name_len), &tid);
if (!ok)
{
PyErr_Format (PyExc_KeyError, "The ns3 type with name `%s' is not registered", name);
return NULL;
}
py_tid = PyObject_New (PyNs3TypeId, &PyNs3TypeId_Type);
py_tid->obj = new ns3::TypeId (tid);
PyNs3TypeId_wrapper_registry[(void *) py_tid->obj] = (PyObject *) py_tid;
return (PyObject *) py_tid;
}
class CommandLinePythonValueSetter : public ns3::RefCountBase
{
PyObject *m_namespace;
std::string m_variable;
public:
CommandLinePythonValueSetter (PyObject *ns, std::string const &variable) {
Py_INCREF (ns);
m_namespace = ns;
m_variable = variable;
}
bool Parse (std::string value) {
PyObject *pyvalue = PyString_FromStringAndSize (value.data (), value.size ());
PyObject_SetAttrString (m_namespace, (char *) m_variable.c_str (), pyvalue);
if (PyErr_Occurred ()) {
PyErr_Print ();
return false;
}
return true;
}
virtual ~CommandLinePythonValueSetter () {
Py_DECREF (m_namespace);
m_namespace = NULL;
}
};
PyObject *
_wrap_CommandLine_AddValue (PyNs3CommandLine *self, PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
const char *name, *help, *variable = NULL;
PyObject *py_namespace = NULL;
const char *keywords[] = { "name", "help", "variable", "namespace", NULL};
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "ss|sO", (char **) keywords, &name, &help, &variable, &py_namespace)) {
PyObject *exc_type, *traceback;
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
if (variable == NULL) {
variable = name;
}
if (py_namespace == NULL) {
py_namespace = (PyObject *) self;
}
ns3::Ptr<CommandLinePythonValueSetter> setter = ns3::Create<CommandLinePythonValueSetter> (py_namespace, variable);
self->obj->AddValue (name, help, ns3::MakeCallback (&CommandLinePythonValueSetter::Parse, setter));
Py_INCREF (Py_None);
return Py_None;
}
PyObject *
_wrap_Simulator_Run (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
const char *keywords[] = { "signal_check_frequency", NULL};
int signal_check_frequency;
ns3::Ptr<ns3::DefaultSimulatorImpl> defaultSim =
ns3::DynamicCast<ns3::DefaultSimulatorImpl> (ns3::Simulator::GetImplementation ());
if (defaultSim) {
signal_check_frequency = 100;
} else {
signal_check_frequency = -1;
}
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) {
PyObject *exc_type, *traceback;
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
PyThreadState *py_thread_state = NULL;
if (signal_check_frequency == -1)
{
if (PyEval_ThreadsInitialized ())
py_thread_state = PyEval_SaveThread ();
ns3::Simulator::Run ();
if (py_thread_state)
PyEval_RestoreThread (py_thread_state);
} else {
while (!ns3::Simulator::IsFinished ())
{
if (PyEval_ThreadsInitialized ())
py_thread_state = PyEval_SaveThread ();
for (int n = signal_check_frequency; n > 0 && !ns3::Simulator::IsFinished (); --n)
{
ns3::Simulator::RunOneEvent ();
}
if (py_thread_state)
PyEval_RestoreThread (py_thread_state);
PyErr_CheckSignals ();
if (PyErr_Occurred ())
return NULL;
}
}
Py_INCREF (Py_None);
return Py_None;
}
| zy901002-gpsr | src/core/bindings/module_helpers.cc | C++ | gpl2 | 9,972 |
callback_classes = [
['void', 'unsigned char*', 'long', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]
| zy901002-gpsr | src/core/bindings/callbacks_list.py | Python | gpl2 | 302 |
import re
import os
import sys
from pybindgen.typehandlers import base as typehandlers
from pybindgen import ReturnValue, Parameter
from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
from pybindgen.typehandlers.codesink import MemoryCodeSink
from pybindgen.typehandlers import ctypeparser
from pybindgen import cppclass, param, retval
import warnings
from pybindgen.typehandlers.base import CodeGenerationError
# class SmartPointerTransformation(typehandlers.TypeTransformation):
# """
# This class provides a "type transformation" that tends to support
# NS-3 smart pointers. Parameters such as "Ptr<Foo> foo" are
# transformed into something like Parameter.new("Foo*", "foo",
# transfer_ownership=False). Return values such as Ptr<Foo> are
# transformed into ReturnValue.new("Foo*",
# caller_owns_return=False). Since the underlying objects have
# reference counting, PyBindGen does the right thing.
# """
# def __init__(self):
# super(SmartPointerTransformation, self).__init__()
# self.rx = re.compile(r'(ns3::|::ns3::|)Ptr<([^>]+)>\s*$')
# def _get_untransformed_type_traits(self, name):
# m = self.rx.match(name)
# is_const = False
# if m is None:
# return None, False
# else:
# name1 = m.group(2).strip()
# if name1.startswith('const '):
# name1 = name1[len('const '):]
# is_const = True
# if name1.endswith(' const'):
# name1 = name1[:-len(' const')]
# is_const = True
# new_name = name1+' *'
# if new_name.startswith('::'):
# new_name = new_name[2:]
# return new_name, is_const
# def get_untransformed_name(self, name):
# new_name, dummy_is_const = self._get_untransformed_type_traits(name)
# return new_name
# def create_type_handler(self, type_handler, *args, **kwargs):
# if issubclass(type_handler, Parameter):
# kwargs['transfer_ownership'] = False
# elif issubclass(type_handler, ReturnValue):
# kwargs['caller_owns_return'] = False
# else:
# raise AssertionError
# ## fix the ctype, add ns3:: namespace
# orig_ctype, is_const = self._get_untransformed_type_traits(args[0])
# if is_const:
# correct_ctype = 'ns3::Ptr< %s const >' % orig_ctype[:-2]
# else:
# correct_ctype = 'ns3::Ptr< %s >' % orig_ctype[:-2]
# args = tuple([correct_ctype] + list(args[1:]))
# handler = type_handler(*args, **kwargs)
# handler.set_tranformation(self, orig_ctype)
# return handler
# def untransform(self, type_handler, declarations, code_block, expression):
# return 'const_cast<%s> (ns3::PeekPointer (%s))' % (type_handler.untransformed_ctype, expression)
# def transform(self, type_handler, declarations, code_block, expression):
# assert type_handler.untransformed_ctype[-1] == '*'
# return 'ns3::Ptr< %s > (%s)' % (type_handler.untransformed_ctype[:-1], expression)
# ## register the type transformation
# transf = SmartPointerTransformation()
# typehandlers.return_type_matcher.register_transformation(transf)
# typehandlers.param_type_matcher.register_transformation(transf)
# del transf
class ArgvParam(Parameter):
"""
Converts a python list-of-strings argument to a pair of 'int argc,
char *argv[]' arguments to pass into C.
One Python argument becomes two C function arguments -> it's a miracle!
Note: this parameter type handler is not registered by any name;
must be used explicitly.
"""
DIRECTIONS = [Parameter.DIRECTION_IN]
CTYPES = []
def convert_c_to_python(self, wrapper):
raise NotImplementedError
def convert_python_to_c(self, wrapper):
py_name = wrapper.declarations.declare_variable('PyObject*', 'py_' + self.name)
argc_var = wrapper.declarations.declare_variable('int', 'argc')
name = wrapper.declarations.declare_variable('char**', self.name)
idx = wrapper.declarations.declare_variable('Py_ssize_t', 'idx')
wrapper.parse_params.add_parameter('O!', ['&PyList_Type', '&'+py_name], self.name)
#wrapper.before_call.write_error_check('!PyList_Check(%s)' % py_name) # XXX
wrapper.before_call.write_code("%s = (char **) malloc(sizeof(char*)*PyList_Size(%s));"
% (name, py_name))
wrapper.before_call.add_cleanup_code('free(%s);' % name)
wrapper.before_call.write_code('''
for (%(idx)s = 0; %(idx)s < PyList_Size(%(py_name)s); %(idx)s++)
{
''' % vars())
wrapper.before_call.sink.indent()
wrapper.before_call.write_code('''
PyObject *item = PyList_GET_ITEM(%(py_name)s, %(idx)s);
''' % vars())
#wrapper.before_call.write_error_check('item == NULL')
wrapper.before_call.write_error_check(
'!PyString_Check(item)',
failure_cleanup=('PyErr_SetString(PyExc_TypeError, '
'"argument %s must be a list of strings");') % self.name)
wrapper.before_call.write_code(
'%s[%s] = PyString_AsString(item);' % (name, idx))
wrapper.before_call.sink.unindent()
wrapper.before_call.write_code('}')
wrapper.before_call.write_code('%s = PyList_Size(%s);' % (argc_var, py_name))
wrapper.call_params.append(argc_var)
wrapper.call_params.append(name)
# class CallbackImplProxyMethod(typehandlers.ReverseWrapperBase):
# """
# Class that generates a proxy virtual method that calls a similarly named python method.
# """
# def __init__(self, return_value, parameters):
# super(CallbackImplProxyMethod, self).__init__(return_value, parameters)
# def generate_python_call(self):
# """code to call the python method"""
# build_params = self.build_params.get_parameters(force_tuple_creation=True)
# if build_params[0][0] == '"':
# build_params[0] = '(char *) ' + build_params[0]
# args = self.before_call.declare_variable('PyObject*', 'args')
# self.before_call.write_code('%s = Py_BuildValue(%s);'
# % (args, ', '.join(build_params)))
# self.before_call.add_cleanup_code('Py_DECREF(%s);' % args)
# self.before_call.write_code('py_retval = PyObject_CallObject(m_callback, %s);' % args)
# self.before_call.write_error_check('py_retval == NULL')
# self.before_call.add_cleanup_code('Py_DECREF(py_retval);')
# def generate_callback_classes(out, callbacks):
# for callback_impl_num, template_parameters in enumerate(callbacks):
# sink = MemoryCodeSink()
# cls_name = "ns3::Callback< %s >" % ', '.join(template_parameters)
# #print >> sys.stderr, "***** trying to register callback: %r" % cls_name
# class_name = "PythonCallbackImpl%i" % callback_impl_num
# sink.writeln('''
# class %s : public ns3::CallbackImpl<%s>
# {
# public:
# PyObject *m_callback;
# %s(PyObject *callback)
# {
# Py_INCREF(callback);
# m_callback = callback;
# }
# virtual ~%s()
# {
# Py_DECREF(m_callback);
# m_callback = NULL;
# }
# virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
# {
# const %s *other = dynamic_cast<const %s*> (ns3::PeekPointer (other_base));
# if (other != NULL)
# return (other->m_callback == m_callback);
# else
# return false;
# }
# ''' % (class_name, ', '.join(template_parameters), class_name, class_name, class_name, class_name))
# sink.indent()
# callback_return = template_parameters[0]
# return_ctype = ctypeparser.parse_type(callback_return)
# if ('const' in return_ctype.remove_modifiers()):
# kwargs = {'is_const': True}
# else:
# kwargs = {}
# try:
# return_type = ReturnValue.new(str(return_ctype), **kwargs)
# except (typehandlers.TypeLookupError, typehandlers.TypeConfigurationError), ex:
# warnings.warn("***** Unable to register callback; Return value '%s' error (used in %s): %r"
# % (callback_return, cls_name, ex),
# Warning)
# continue
# arguments = []
# ok = True
# callback_parameters = [arg for arg in template_parameters[1:] if arg != 'ns3::empty']
# for arg_num, arg_type in enumerate(callback_parameters):
# arg_name = 'arg%i' % (arg_num+1)
# param_ctype = ctypeparser.parse_type(arg_type)
# if ('const' in param_ctype.remove_modifiers()):
# kwargs = {'is_const': True}
# else:
# kwargs = {}
# try:
# arguments.append(Parameter.new(str(param_ctype), arg_name, **kwargs))
# except (typehandlers.TypeLookupError, typehandlers.TypeConfigurationError), ex:
# warnings.warn("***** Unable to register callback; parameter '%s %s' error (used in %s): %r"
# % (arg_type, arg_name, cls_name, ex),
# Warning)
# ok = False
# if not ok:
# continue
# wrapper = CallbackImplProxyMethod(return_type, arguments)
# wrapper.generate(sink, 'operator()', decl_modifiers=[])
# sink.unindent()
# sink.writeln('};\n')
# sink.flush_to(out)
# class PythonCallbackParameter(Parameter):
# "Class handlers"
# CTYPES = [cls_name]
# #print >> sys.stderr, "***** registering callback handler: %r" % ctypeparser.normalize_type_string(cls_name)
# DIRECTIONS = [Parameter.DIRECTION_IN]
# PYTHON_CALLBACK_IMPL_NAME = class_name
# TEMPLATE_ARGS = template_parameters
# def convert_python_to_c(self, wrapper):
# "parses python args to get C++ value"
# assert isinstance(wrapper, typehandlers.ForwardWrapperBase)
# if self.default_value is None:
# py_callback = wrapper.declarations.declare_variable('PyObject*', self.name)
# wrapper.parse_params.add_parameter('O', ['&'+py_callback], self.name)
# wrapper.before_call.write_error_check(
# '!PyCallable_Check(%s)' % py_callback,
# 'PyErr_SetString(PyExc_TypeError, "parameter \'%s\' must be callbale");' % self.name)
# callback_impl = wrapper.declarations.declare_variable(
# 'ns3::Ptr<%s>' % self.PYTHON_CALLBACK_IMPL_NAME,
# '%s_cb_impl' % self.name)
# wrapper.before_call.write_code("%s = ns3::Create<%s> (%s);"
# % (callback_impl, self.PYTHON_CALLBACK_IMPL_NAME, py_callback))
# wrapper.call_params.append(
# 'ns3::Callback<%s> (%s)' % (', '.join(self.TEMPLATE_ARGS), callback_impl))
# else:
# py_callback = wrapper.declarations.declare_variable('PyObject*', self.name, 'NULL')
# wrapper.parse_params.add_parameter('O', ['&'+py_callback], self.name, optional=True)
# value = wrapper.declarations.declare_variable(
# 'ns3::Callback<%s>' % ', '.join(self.TEMPLATE_ARGS),
# self.name+'_value',
# self.default_value)
# wrapper.before_call.write_code("if (%s) {" % (py_callback,))
# wrapper.before_call.indent()
# wrapper.before_call.write_error_check(
# '!PyCallable_Check(%s)' % py_callback,
# 'PyErr_SetString(PyExc_TypeError, "parameter \'%s\' must be callbale");' % self.name)
# wrapper.before_call.write_code("%s = ns3::Callback<%s> (ns3::Create<%s> (%s));"
# % (value, ', '.join(self.TEMPLATE_ARGS),
# self.PYTHON_CALLBACK_IMPL_NAME, py_callback))
# wrapper.before_call.unindent()
# wrapper.before_call.write_code("}") # closes: if (py_callback) {
# wrapper.call_params.append(value)
# def convert_c_to_python(self, wrapper):
# raise typehandlers.NotSupportedError("Reverse wrappers for ns3::Callback<...> types "
# "(python using callbacks defined in C++) not implemented.")
# def write_preamble(out):
# pybindgen.write_preamble(out)
# out.writeln("#include \"ns3/everything.h\"")
def Simulator_customizations(module):
Simulator = module['ns3::Simulator']
## Simulator::Schedule(delay, callback, ...user..args...)
Simulator.add_custom_method_wrapper("Schedule", "_wrap_Simulator_Schedule",
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
## Simulator::ScheduleNow(callback, ...user..args...)
Simulator.add_custom_method_wrapper("ScheduleNow", "_wrap_Simulator_ScheduleNow",
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
## Simulator::ScheduleDestroy(callback, ...user..args...)
Simulator.add_custom_method_wrapper("ScheduleDestroy", "_wrap_Simulator_ScheduleDestroy",
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
Simulator.add_custom_method_wrapper("Run", "_wrap_Simulator_Run",
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
def CommandLine_customizations(module):
CommandLine = module['ns3::CommandLine']
CommandLine.add_method('Parse', None, [ArgvParam(None, 'argv')],
is_static=False)
CommandLine.add_custom_method_wrapper("AddValue", "_wrap_CommandLine_AddValue",
flags=["METH_VARARGS", "METH_KEYWORDS"])
# def Object_customizations(module):
# ## ---------------------------------------------------------------------
# ## Here we generate custom constructor code for all classes that
# ## derive from ns3::Object. The custom constructors are needed in
# ## order to support kwargs only and to translate kwargs into ns3
# ## attributes, etc.
# ## ---------------------------------------------------------------------
# Object = module['ns3::Object']
# ## add a GetTypeId method to all generatd helper classes
# def helper_class_hook(helper_class):
# decl = """
# static ns3::TypeId GetTypeId (void)
# {
# static ns3::TypeId tid = ns3::TypeId ("%s")
# .SetParent< %s > ()
# ;
# return tid;
# }""" % (helper_class.name, helper_class.class_.full_name)
# helper_class.add_custom_method(decl)
# helper_class.add_post_generation_code(
# "NS_OBJECT_ENSURE_REGISTERED (%s);" % helper_class.name)
# Object.add_helper_class_hook(helper_class_hook)
# def ns3_object_instance_creation_function(cpp_class, code_block, lvalue,
# parameters, construct_type_name):
# assert lvalue
# assert not lvalue.startswith('None')
# if cpp_class.cannot_be_constructed:
# raise CodeGenerationError("%s cannot be constructed (%s)"
# % cpp_class.full_name)
# if cpp_class.incomplete_type:
# raise CodeGenerationError("%s cannot be constructed (incomplete type)"
# % cpp_class.full_name)
# code_block.write_code("%s = new %s(%s);" % (lvalue, construct_type_name, parameters))
# code_block.write_code("%s->Ref ();" % (lvalue))
# def ns3_object_post_instance_creation_function(cpp_class, code_block, lvalue,
# parameters, construct_type_name):
# code_block.write_code("ns3::CompleteConstruct(%s);" % (lvalue, ))
# Object.set_instance_creation_function(ns3_object_instance_creation_function)
# Object.set_post_instance_creation_function(ns3_object_post_instance_creation_function)
# def Attribute_customizations(module):
# # Fix up for the "const AttributeValue &v = EmptyAttribute()"
# # case, as used extensively by helper classes.
# # Here's why we need to do this: pybindgen.gccxmlscanner, when
# # scanning parameter default values, is only provided with the
# # value as a simple C expression string. (py)gccxml does not
# # report the type of the default value.
# # As a workaround, here we iterate over all parameters of all
# # methods of all classes and tell pybindgen what is the type of
# # the default value for attributes.
# for cls in module.classes:
# for meth in cls.get_all_methods():
# for param in meth.parameters:
# if isinstance(param, cppclass.CppClassRefParameter):
# if param.cpp_class.name == 'AttributeValue' \
# and param.default_value is not None \
# and param.default_value_type is None:
# param.default_value_type = 'ns3::EmptyAttributeValue'
def TypeId_customizations(module):
TypeId = module['ns3::TypeId']
TypeId.add_custom_method_wrapper("LookupByNameFailSafe", "_wrap_TypeId_LookupByNameFailSafe",
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
def add_std_ofstream(module):
module.add_include('<fstream>')
ostream = module.add_class('ostream', foreign_cpp_namespace='::std')
ostream.set_cannot_be_constructed("abstract base class")
ofstream = module.add_class('ofstream', foreign_cpp_namespace='::std', parent=ostream)
ofstream.add_enum('openmode', [
('app', 'std::ios_base::app'),
('ate', 'std::ios_base::ate'),
('binary', 'std::ios_base::binary'),
('in', 'std::ios_base::in'),
('out', 'std::ios_base::out'),
('trunc', 'std::ios_base::trunc'),
])
ofstream.add_constructor([Parameter.new("const char *", 'filename'),
Parameter.new("::std::ofstream::openmode", 'mode', default_value="std::ios_base::out")])
ofstream.add_method('close', None, [])
import pybindgen.typehandlers.base
for alias in "std::_Ios_Openmode", "std::ios::openmode":
pybindgen.typehandlers.base.param_type_matcher.add_type_alias(alias, "int")
for flag in 'in', 'out', 'ate', 'app', 'trunc', 'binary':
module.after_init.write_code('PyModule_AddIntConstant(m, (char *) "STD_IOS_%s", std::ios::%s);'
% (flag.upper(), flag))
def add_ipv4_address_tp_hash(module):
module.body.writeln('''
long
_ns3_Ipv4Address_tp_hash (PyObject *obj)
{
PyNs3Ipv4Address *addr = reinterpret_cast<PyNs3Ipv4Address *> (obj);
return static_cast<long> (ns3::Ipv4AddressHash () (*addr->obj));
}
''')
module.header.writeln('long _ns3_Ipv4Address_tp_hash (PyObject *obj);')
module['Ipv4Address'].pytype.slots['tp_hash'] = "_ns3_Ipv4Address_tp_hash"
def post_register_types(root_module):
Simulator_customizations(root_module)
CommandLine_customizations(root_module)
TypeId_customizations(root_module)
add_std_ofstream(root_module)
enabled_features = os.environ['NS3_ENABLED_FEATURES'].split(',')
if 'Threading' not in enabled_features:
for clsname in ['SystemThread', 'SystemMutex', 'SystemCondition', 'CriticalSection',
'SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']:
root_module.classes.remove(root_module['ns3::%s' % clsname])
if 'RealTime' not in enabled_features:
for clsname in ['WallClockSynchronizer', 'RealtimeSimulatorImpl']:
root_module.classes.remove(root_module['ns3::%s' % clsname])
root_module.enums.remove(root_module['ns3::RealtimeSimulatorImpl::SynchronizationMode'])
# these are already in the main script, so commented out here
# Object_customizations(root_module)
# Attribute_customizations(root_module)
#def post_register_functions(root_module):
# pass
| zy901002-gpsr | src/core/bindings/modulegen_customizations.py | Python | gpl2 | 20,774 |
# "from _core import *" doesn't work here because symbols starting
# with underscore would not be imported. But they are needed because
# other modules depend on them...
import _core
g = globals()
for k,v in _core.__dict__.iteritems():
g[k] = v
del g, k, v, _core
# Without this, Python programs often crash because Node's are kept
# alive after the Python interpreter is finalized, which leads to
# crashes because some destructors call Python API.
import atexit
atexit.register(Simulator.Destroy)
del atexit
| zy901002-gpsr | src/core/bindings/core.py | Python | gpl2 | 518 |
// -*- c++ -*-
#include "ns3/core-module.h"
using namespace ns3;
namespace
{
static inline Ptr<Object>
__dummy_function_to_force_template_instantiation (Ptr<Object> obj, TypeId typeId)
{
return obj->GetObject<Object> (typeId);
}
static inline void
__dummy_function_to_force_template_instantiation_v2 ()
{
Time t1 = Seconds (1), t2 = Seconds (2), t3 = Seconds (3);
t1 = t2 + t3;
t1 = t2 - t3;
t1 < t2;
t1 <= t2;
t1 == t2;
t1 != t2;
t1 >= t2;
t1 > t2;
int64x64_t s1(2), s2(3), s3;
s1 = s2 + s3;
s1 = s2 - s3;
s1 < s2;
s1 <= s2;
s1 == s2;
s1 != s2;
s1 >= s2;
s1 > s2;
s3 = t1*s1;
s3 = t1/s1;
s3 = s1*t1;
s3 = t1/t2;
}
}
| zy901002-gpsr | src/core/bindings/scan-header.h | C++ | gpl2 | 682 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/test.h"
#include "ns3/names.h"
using namespace ns3;
// ===========================================================================
// Cook up a couple of simple object class that we can use in the object
// naming tests. They do nothing but be of the right type.
// ===========================================================================
class TestObject : public Object
{
public:
static TypeId GetTypeId (void)
{
static TypeId tid = TypeId ("TestObject")
.SetParent (Object::GetTypeId ())
.HideFromDocumentation ()
.AddConstructor<TestObject> ();
return tid;
}
TestObject () {}
virtual void Dispose (void) {}
};
class AlternateTestObject : public Object
{
public:
static TypeId GetTypeId (void)
{
static TypeId tid = TypeId ("AlternateTestObject")
.SetParent (Object::GetTypeId ())
.HideFromDocumentation ()
.AddConstructor<AlternateTestObject> ();
return tid;
}
AlternateTestObject () {}
virtual void Dispose (void) {}
};
// ===========================================================================
// Test case to make sure that the Object Name Service can do its most basic
// job and add associations between Objects using the lowest level add
// function, which is:
//
// Add (Ptr<Object> context, std::string name, Ptr<Object> object);
//
// All other add functions will just translate into this form, so this is the
// most basic Add functionality.
// ===========================================================================
class BasicAddTestCase : public TestCase
{
public:
BasicAddTestCase ();
virtual ~BasicAddTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
BasicAddTestCase::BasicAddTestCase ()
: TestCase ("Check low level Names::Add and Names::FindName functionality")
{
}
BasicAddTestCase::~BasicAddTestCase ()
{
}
void
BasicAddTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
BasicAddTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add (Ptr<Object> (0, false), "Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add (Ptr<Object> (0, false), "Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add (objectOne, "Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add (objectTwo, "Child", childOfObjectTwo);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name One", "Could not Names::Add and Names::FindName an Object");
found = Names::FindName (objectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Name Two", "Could not Names::Add and Names::FindName a second Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can correctly use a
// string context in the most basic ways
//
// Add (std::string context, std::string name, Ptr<Object> object);
//
// High level path-based functions will translate into this form, so this is
// the second most basic Add functionality.
// ===========================================================================
class StringContextAddTestCase : public TestCase
{
public:
StringContextAddTestCase ();
virtual ~StringContextAddTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
StringContextAddTestCase::StringContextAddTestCase ()
: TestCase ("Check string context Names::Add and Names::FindName functionality")
{
}
StringContextAddTestCase::~StringContextAddTestCase ()
{
}
void
StringContextAddTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
StringContextAddTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("/Names", "Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("/Names", "Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name One", "Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("/Names/Name Two", "Child", childOfObjectTwo);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name One", "Could not Names::Add and Names::FindName an Object");
found = Names::FindName (objectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Name Two", "Could not Names::Add and Names::FindName a second Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can correctly use a
// fully qualified path to add assocations
//
// Add (std::string name, Ptr<Object> object);
// ===========================================================================
class FullyQualifiedAddTestCase : public TestCase
{
public:
FullyQualifiedAddTestCase ();
virtual ~FullyQualifiedAddTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
FullyQualifiedAddTestCase::FullyQualifiedAddTestCase ()
: TestCase ("Check fully qualified path Names::Add and Names::FindName functionality")
{
}
FullyQualifiedAddTestCase::~FullyQualifiedAddTestCase ()
{
}
void
FullyQualifiedAddTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
FullyQualifiedAddTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("/Names/Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name One/Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("/Names/Name Two/Child", childOfObjectTwo);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name One", "Could not Names::Add and Names::FindName an Object");
found = Names::FindName (objectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Name Two", "Could not Names::Add and Names::FindName a second Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can correctly use a
// relative path to add assocations. This functionality is provided as a
// convenience so clients don't always have to provide the name service
// namespace name in all of their strings.
//
//
// Add (std::string name, Ptr<Object> object);
// ===========================================================================
class RelativeAddTestCase : public TestCase
{
public:
RelativeAddTestCase ();
virtual ~RelativeAddTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
RelativeAddTestCase::RelativeAddTestCase ()
: TestCase ("Check relative path Names::Add and Names::FindName functionality")
{
}
RelativeAddTestCase::~RelativeAddTestCase ()
{
}
void
RelativeAddTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
RelativeAddTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("Name One/Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two/Child", childOfObjectTwo);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name One", "Could not Names::Add and Names::FindName an Object");
found = Names::FindName (objectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Name Two", "Could not Names::Add and Names::FindName a second Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can rename objects in
// its most basic way, which is
//
// Rename (Ptr<Object> context, std::string oldname, std::string newname);
//
// All other rename functions will just translate into this form, so this is the
// most basic rename functionality.
// ===========================================================================
class BasicRenameTestCase : public TestCase
{
public:
BasicRenameTestCase ();
virtual ~BasicRenameTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
BasicRenameTestCase::BasicRenameTestCase ()
: TestCase ("Check low level Names::Rename functionality")
{
}
BasicRenameTestCase::~BasicRenameTestCase ()
{
}
void
BasicRenameTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
BasicRenameTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add (Ptr<Object> (0, false), "Name", objectOne);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add (objectOne, "Child", childOfObjectOne);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name", "Could not Names::Add and Names::FindName an Object");
Names::Rename (Ptr<Object> (0, false), "Name", "New Name");
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Name", "Could not Names::Rename an Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
Names::Rename (objectOne, "Child", "New Child");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can rename objects
// using a string context
//
// Rename (std::string context, std::string oldname, std::string newname);
// ===========================================================================
class StringContextRenameTestCase : public TestCase
{
public:
StringContextRenameTestCase ();
virtual ~StringContextRenameTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
StringContextRenameTestCase::StringContextRenameTestCase ()
: TestCase ("Check string context-based Names::Rename functionality")
{
}
StringContextRenameTestCase::~StringContextRenameTestCase ()
{
}
void
StringContextRenameTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
StringContextRenameTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("/Names", "Name", objectOne);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name", "Child", childOfObjectOne);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name", "Could not Names::Add and Names::FindName an Object");
Names::Rename ("/Names", "Name", "New Name");
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Name", "Could not Names::Rename an Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
Names::Rename ("/Names/New Name", "Child", "New Child");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can rename objects
// using a fully qualified path name
//
// Rename (std::string oldpath, std::string newname);
// ===========================================================================
class FullyQualifiedRenameTestCase : public TestCase
{
public:
FullyQualifiedRenameTestCase ();
virtual ~FullyQualifiedRenameTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
FullyQualifiedRenameTestCase::FullyQualifiedRenameTestCase ()
: TestCase ("Check fully qualified path Names::Rename functionality")
{
}
FullyQualifiedRenameTestCase::~FullyQualifiedRenameTestCase ()
{
}
void
FullyQualifiedRenameTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
FullyQualifiedRenameTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name", objectOne);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name/Child", childOfObjectOne);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name", "Could not Names::Add and Names::FindName an Object");
Names::Rename ("/Names/Name", "New Name");
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Name", "Could not Names::Rename an Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
Names::Rename ("/Names/New Name/Child", "New Child");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can rename objects
// using a relaltive path name
//
// Rename (std::string oldpath, std::string newname);
// ===========================================================================
class RelativeRenameTestCase : public TestCase
{
public:
RelativeRenameTestCase ();
virtual ~RelativeRenameTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
RelativeRenameTestCase::RelativeRenameTestCase ()
: TestCase ("Check relative path Names::Rename functionality")
{
}
RelativeRenameTestCase::~RelativeRenameTestCase ()
{
}
void
RelativeRenameTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
RelativeRenameTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("Name", objectOne);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("Name/Child", childOfObjectOne);
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Name", "Could not Names::Add and Names::FindName an Object");
Names::Rename ("Name", "New Name");
found = Names::FindName (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Name", "Could not Names::Rename an Object");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
Names::Rename ("New Name/Child", "New Child");
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can look up an object
// and return its fully qualified path name
//
// FindPath (Ptr<Object> object);
// ===========================================================================
class FindPathTestCase : public TestCase
{
public:
FindPathTestCase ();
virtual ~FindPathTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
FindPathTestCase::FindPathTestCase ()
: TestCase ("Check Names::FindPath functionality")
{
}
FindPathTestCase::~FindPathTestCase ()
{
}
void
FindPathTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
FindPathTestCase::DoRun (void)
{
std::string found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("Name", objectOne);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name/Child", childOfObjectOne);
found = Names::FindPath (objectOne);
NS_TEST_ASSERT_MSG_EQ (found, "/Names/Name", "Could not Names::Add and Names::FindPath an Object");
found = Names::FindPath (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "/Names/Name/Child", "Could not Names::Add and Names::FindPath a child Object");
Ptr<TestObject> objectNotThere = CreateObject<TestObject> ();
found = Names::FindPath (objectNotThere);
NS_TEST_ASSERT_MSG_EQ (found, "", "Unexpectedly found a non-existent Object");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can find Objects using
// the lowest level find function, which is:
//
// Find (Ptr<Object> context, std::string name);
// ===========================================================================
class BasicFindTestCase : public TestCase
{
public:
BasicFindTestCase ();
virtual ~BasicFindTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
BasicFindTestCase::BasicFindTestCase ()
: TestCase ("Check low level Names::Find functionality")
{
}
BasicFindTestCase::~BasicFindTestCase ()
{
}
void
BasicFindTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
BasicFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("Name One/Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two/Child", childOfObjectTwo);
found = Names::Find<TestObject> (Ptr<Object> (0, false), "Name One");
NS_TEST_ASSERT_MSG_EQ (found, objectOne, "Could not find a previously named Object via object context");
found = Names::Find<TestObject> (Ptr<Object> (0, false), "Name Two");
NS_TEST_ASSERT_MSG_EQ (found, objectTwo, "Could not find a previously named Object via object context");
found = Names::Find<TestObject> (objectOne, "Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne, "Could not find a previously named child Object via object context");
found = Names::Find<TestObject> (objectTwo, "Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via object context");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can find Objects using
// a string context-based find function, which is:
//
// Find (std::string context, std::string name);
// ===========================================================================
class StringContextFindTestCase : public TestCase
{
public:
StringContextFindTestCase ();
virtual ~StringContextFindTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
StringContextFindTestCase::StringContextFindTestCase ()
: TestCase ("Check string context-based Names::Find functionality")
{
}
StringContextFindTestCase::~StringContextFindTestCase ()
{
}
void
StringContextFindTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
StringContextFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("Name One/Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two/Child", childOfObjectTwo);
found = Names::Find<TestObject> ("/Names", "Name One");
NS_TEST_ASSERT_MSG_EQ (found, objectOne, "Could not find a previously named Object via string context");
found = Names::Find<TestObject> ("/Names", "Name Two");
NS_TEST_ASSERT_MSG_EQ (found, objectTwo, "Could not find a previously named Object via stribng context");
found = Names::Find<TestObject> ("/Names/Name One", "Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne, "Could not find a previously named child Object via string context");
found = Names::Find<TestObject> ("/Names/Name Two", "Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via string context");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can find Objects using
// a fully qualified path name-based find function, which is:
//
// Find (std::string name);
// ===========================================================================
class FullyQualifiedFindTestCase : public TestCase
{
public:
FullyQualifiedFindTestCase ();
virtual ~FullyQualifiedFindTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
FullyQualifiedFindTestCase::FullyQualifiedFindTestCase ()
: TestCase ("Check fully qualified path Names::Find functionality")
{
}
FullyQualifiedFindTestCase::~FullyQualifiedFindTestCase ()
{
}
void
FullyQualifiedFindTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
FullyQualifiedFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("/Names/Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("/Names/Name One/Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("/Names/Name Two/Child", childOfObjectTwo);
found = Names::Find<TestObject> ("/Names/Name One");
NS_TEST_ASSERT_MSG_EQ (found, objectOne, "Could not find a previously named Object via string context");
found = Names::Find<TestObject> ("/Names/Name Two");
NS_TEST_ASSERT_MSG_EQ (found, objectTwo, "Could not find a previously named Object via stribng context");
found = Names::Find<TestObject> ("/Names/Name One/Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne, "Could not find a previously named child Object via string context");
found = Names::Find<TestObject> ("/Names/Name Two/Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via string context");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can find Objects using
// a relative path name-based find function, which is:
//
// Find (std::string name);
// ===========================================================================
class RelativeFindTestCase : public TestCase
{
public:
RelativeFindTestCase ();
virtual ~RelativeFindTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
RelativeFindTestCase::RelativeFindTestCase ()
: TestCase ("Check relative path Names::Find functionality")
{
}
RelativeFindTestCase::~RelativeFindTestCase ()
{
}
void
RelativeFindTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
RelativeFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
Ptr<TestObject> objectOne = CreateObject<TestObject> ();
Names::Add ("Name One", objectOne);
Ptr<TestObject> objectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two", objectTwo);
Ptr<TestObject> childOfObjectOne = CreateObject<TestObject> ();
Names::Add ("Name One/Child", childOfObjectOne);
Ptr<TestObject> childOfObjectTwo = CreateObject<TestObject> ();
Names::Add ("Name Two/Child", childOfObjectTwo);
found = Names::Find<TestObject> ("Name One");
NS_TEST_ASSERT_MSG_EQ (found, objectOne, "Could not find a previously named Object via string context");
found = Names::Find<TestObject> ("Name Two");
NS_TEST_ASSERT_MSG_EQ (found, objectTwo, "Could not find a previously named Object via stribng context");
found = Names::Find<TestObject> ("Name One/Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne, "Could not find a previously named child Object via string context");
found = Names::Find<TestObject> ("Name Two/Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via string context");
}
// ===========================================================================
// Test case to make sure that the Object Name Service can find Objects using
// a second type.
// ===========================================================================
class AlternateFindTestCase : public TestCase
{
public:
AlternateFindTestCase ();
virtual ~AlternateFindTestCase ();
private:
virtual void DoRun (void);
virtual void DoTeardown (void);
};
AlternateFindTestCase::AlternateFindTestCase ()
: TestCase ("Check GetObject operation in Names::Find")
{
}
AlternateFindTestCase::~AlternateFindTestCase ()
{
}
void
AlternateFindTestCase::DoTeardown (void)
{
Names::Clear ();
}
void
AlternateFindTestCase::DoRun (void)
{
Ptr<TestObject> testObject = CreateObject<TestObject> ();
Names::Add ("Test Object", testObject);
Ptr<AlternateTestObject> alternateTestObject = CreateObject<AlternateTestObject> ();
Names::Add ("Alternate Test Object", alternateTestObject);
Ptr<TestObject> foundTestObject;
Ptr<AlternateTestObject> foundAlternateTestObject;
foundTestObject = Names::Find<TestObject> ("Test Object");
NS_TEST_ASSERT_MSG_EQ (foundTestObject, testObject,
"Could not find a previously named TestObject via GetObject");
foundAlternateTestObject = Names::Find<AlternateTestObject> ("Alternate Test Object");
NS_TEST_ASSERT_MSG_EQ (foundAlternateTestObject, alternateTestObject,
"Could not find a previously named AlternateTestObject via GetObject");
foundAlternateTestObject = Names::Find<AlternateTestObject> ("Test Object");
NS_TEST_ASSERT_MSG_EQ (foundAlternateTestObject, 0,
"Unexpectedly able to GetObject<AlternateTestObject> on a TestObject");
foundTestObject = Names::Find<TestObject> ("Alternate Test Object");
NS_TEST_ASSERT_MSG_EQ (foundTestObject, 0,
"Unexpectedly able to GetObject<TestObject> on an AlternateTestObject");
}
class NamesTestSuite : public TestSuite
{
public:
NamesTestSuite ();
};
NamesTestSuite::NamesTestSuite ()
: TestSuite ("object-name-service", UNIT)
{
AddTestCase (new BasicAddTestCase);
AddTestCase (new StringContextAddTestCase);
AddTestCase (new FullyQualifiedAddTestCase);
AddTestCase (new RelativeAddTestCase);
AddTestCase (new BasicRenameTestCase);
AddTestCase (new StringContextRenameTestCase);
AddTestCase (new FullyQualifiedRenameTestCase);
AddTestCase (new RelativeRenameTestCase);
AddTestCase (new FindPathTestCase);
AddTestCase (new BasicFindTestCase);
AddTestCase (new StringContextFindTestCase);
AddTestCase (new FullyQualifiedFindTestCase);
AddTestCase (new RelativeFindTestCase);
AddTestCase (new AlternateFindTestCase);
}
static NamesTestSuite namesTestSuite;
| zy901002-gpsr | src/core/test/names-test-suite.cc | C++ | gpl2 | 29,104 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/test.h"
#include "ns3/callback.h"
#include <stdint.h>
namespace ns3 {
// ===========================================================================
// Test the basic Callback mechanism
// ===========================================================================
class BasicCallbackTestCase : public TestCase
{
public:
BasicCallbackTestCase ();
virtual ~BasicCallbackTestCase () {}
void Target1 (void) { m_test1 = true; }
int Target2 (void) { m_test2 = true; return 2; }
void Target3 (double a) { m_test3 = true; }
int Target4 (double a, int b) { m_test4 = true; return 4; }
private:
virtual void DoRun (void);
virtual void DoSetup (void);
bool m_test1;
bool m_test2;
bool m_test3;
bool m_test4;
};
static bool gBasicCallbackTest5;
static bool gBasicCallbackTest6;
static bool gBasicCallbackTest7;
void
BasicCallbackTarget5 (void)
{
gBasicCallbackTest5 = true;
}
void
BasicCallbackTarget6 (int)
{
gBasicCallbackTest6 = true;
}
int
BasicCallbackTarget7 (int a)
{
gBasicCallbackTest7 = true;
return a;
}
BasicCallbackTestCase::BasicCallbackTestCase ()
: TestCase ("Check basic Callback mechansim")
{
}
void
BasicCallbackTestCase::DoSetup (void)
{
m_test1 = false;
m_test2 = false;
m_test3 = false;
m_test4 = false;
gBasicCallbackTest5 = false;
gBasicCallbackTest6 = false;
gBasicCallbackTest7 = false;
}
void
BasicCallbackTestCase::DoRun (void)
{
//
// Make sure we can declare and compile a Callback pointing to a member
// function returning void and execute it.
//
Callback<void> target1 (this, &BasicCallbackTestCase::Target1);
target1 ();
NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a member
// function that returns an int and execute it.
//
Callback<int> target2;
target2 = Callback<int> (this, &BasicCallbackTestCase::Target2);
target2 ();
NS_TEST_ASSERT_MSG_EQ (m_test2, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a member
// function that returns void, takes a double parameter, and execute it.
//
Callback<void, double> target3 = Callback<void, double> (this, &BasicCallbackTestCase::Target3);
target3 (0.0);
NS_TEST_ASSERT_MSG_EQ (m_test3, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a member
// function that returns void, takes two parameters, and execute it.
//
Callback<int, double, int> target4 = Callback<int, double, int> (this, &BasicCallbackTestCase::Target4);
target4 (0.0, 1);
NS_TEST_ASSERT_MSG_EQ (m_test4, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a non-member
// function that returns void, and execute it. This is a lower level call
// than MakeCallback so we have got to include at least two arguments to make
// sure that the constructor is properly disambiguated. If the arguments are
// not needed, we just pass in dummy values.
//
Callback<void> target5 = Callback<void> (&BasicCallbackTarget5, true, true);
target5 ();
NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest5, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a non-member
// function that returns void, takes one integer argument and execute it.
// We also need to provide two dummy arguments to the constructor here.
//
Callback<void, int> target6 = Callback<void, int> (&BasicCallbackTarget6, true, true);
target6 (1);
NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest6, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a non-member
// function that returns int, takes one integer argument and execute it.
// We also need to provide two dummy arguments to the constructor here.
//
Callback<int, int> target7 = Callback<int, int> (&BasicCallbackTarget7, true, true);
target7 (1);
NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest7, true, "Callback did not fire");
}
// ===========================================================================
// Test the MakeCallback mechanism
// ===========================================================================
class MakeCallbackTestCase : public TestCase
{
public:
MakeCallbackTestCase ();
virtual ~MakeCallbackTestCase () {}
void Target1 (void) { m_test1 = true; }
int Target2 (void) { m_test2 = true; return 2; }
void Target3 (double a) { m_test3 = true; }
int Target4 (double a, int b) { m_test4 = true; return 4; }
private:
virtual void DoRun (void);
virtual void DoSetup (void);
bool m_test1;
bool m_test2;
bool m_test3;
bool m_test4;
};
static bool gMakeCallbackTest5;
static bool gMakeCallbackTest6;
static bool gMakeCallbackTest7;
void
MakeCallbackTarget5 (void)
{
gMakeCallbackTest5 = true;
}
void
MakeCallbackTarget6 (int)
{
gMakeCallbackTest6 = true;
}
int
MakeCallbackTarget7 (int a)
{
gMakeCallbackTest7 = true;
return a;
}
MakeCallbackTestCase::MakeCallbackTestCase ()
: TestCase ("Check MakeCallback() mechanism")
{
}
void
MakeCallbackTestCase::DoSetup (void)
{
m_test1 = false;
m_test2 = false;
m_test3 = false;
m_test4 = false;
gMakeCallbackTest5 = false;
gMakeCallbackTest6 = false;
gMakeCallbackTest7 = false;
}
void
MakeCallbackTestCase::DoRun (void)
{
//
// Make sure we can declare and make a Callback pointing to a member
// function returning void and execute it.
//
Callback<void> target1 = MakeCallback (&MakeCallbackTestCase::Target1, this);
target1 ();
NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
//
// Make sure we can declare and make a Callback pointing to a member
// function that returns an int and execute it.
//
Callback<int> target2 = MakeCallback (&MakeCallbackTestCase::Target2, this);
target2 ();
NS_TEST_ASSERT_MSG_EQ (m_test2, true, "Callback did not fire");
//
// Make sure we can declare and make a Callback pointing to a member
// function that returns void, takes a double parameter, and execute it.
//
Callback<void, double> target3 = MakeCallback (&MakeCallbackTestCase::Target3, this);
target3 (0.0);
NS_TEST_ASSERT_MSG_EQ (m_test3, true, "Callback did not fire");
//
// Make sure we can declare and make a Callback pointing to a member
// function that returns void, takes two parameters, and execute it.
//
Callback<int, double, int> target4 = MakeCallback (&MakeCallbackTestCase::Target4, this);
target4 (0.0, 1);
NS_TEST_ASSERT_MSG_EQ (m_test4, true, "Callback did not fire");
//
// Make sure we can declare and make a Callback pointing to a non-member
// function that returns void, and execute it. This uses a higher level call
// than in the basic tests so we do not need to include any dummy arguments
// here.
//
Callback<void> target5 = MakeCallback (&MakeCallbackTarget5);
target5 ();
NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest5, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a non-member
// function that returns void, takes one integer argument and execute it.
// This uses a higher level call than in the basic tests so we do not need to
// include any dummy arguments here.
//
Callback<void, int> target6 = MakeCallback (&MakeCallbackTarget6);
target6 (1);
NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest6, true, "Callback did not fire");
//
// Make sure we can declare and compile a Callback pointing to a non-member
// function that returns int, takes one integer argument and execute it.
// This uses a higher level call than in the basic tests so we do not need to
// include any dummy arguments here.
//
Callback<int, int> target7 = MakeCallback (&MakeCallbackTarget7);
target7 (1);
NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest7, true, "Callback did not fire");
}
// ===========================================================================
// Test the MakeBoundCallback mechanism
// ===========================================================================
class MakeBoundCallbackTestCase : public TestCase
{
public:
MakeBoundCallbackTestCase ();
virtual ~MakeBoundCallbackTestCase () {}
private:
virtual void DoRun (void);
virtual void DoSetup (void);
};
static int gMakeBoundCallbackTest1;
static bool *gMakeBoundCallbackTest2;
static bool *gMakeBoundCallbackTest3a;
static int gMakeBoundCallbackTest3b;
void
MakeBoundCallbackTarget1 (int a)
{
gMakeBoundCallbackTest1 = a;
}
void
MakeBoundCallbackTarget2 (bool *a)
{
gMakeBoundCallbackTest2 = a;
}
int
MakeBoundCallbackTarget3 (bool *a, int b)
{
gMakeBoundCallbackTest3a = a;
gMakeBoundCallbackTest3b = b;
return 1234;
}
MakeBoundCallbackTestCase::MakeBoundCallbackTestCase ()
: TestCase ("Check MakeBoundCallback() mechanism")
{
}
void
MakeBoundCallbackTestCase::DoSetup (void)
{
gMakeBoundCallbackTest1 = 0;
gMakeBoundCallbackTest2 = 0;
gMakeBoundCallbackTest3a = 0;
gMakeBoundCallbackTest3b = 0;
}
void
MakeBoundCallbackTestCase::DoRun (void)
{
//
// This is slightly tricky to explain. A bound Callback allows us to package
// up arguments for use later. The arguments are bound when the callback is
// created and the code that fires the Callback does not know they are there.
//
// Since the callback is *declared* according to the way it will be used, the
// arguments are not seen there. However, the target function of the callback
// will have the provided arguments present. The MakeBoundCallback template
// function is what connects the two together and where you provide the
// arguments to be bound.
//
// Here we declare a Callback that returns a void and takes no parameters.
// MakeBoundCallback connects this Callback to a target function that returns
// void and takes an integer argument. That integer argument is bound to the
// value 1234. When the Callback is fired, no integer argument is provided
// directly. The argument is provided by bound Callback mechanism.
//
Callback<void> target1 = MakeBoundCallback (&MakeBoundCallbackTarget1, 1234);
target1 ();
NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest1, 1234, "Callback did not fire or binding not correct");
//
// Make sure we can bind a pointer value (a common use case).
//
bool a;
Callback<void> target2 = MakeBoundCallback (&MakeBoundCallbackTarget2, &a);
target2 ();
NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest2, &a, "Callback did not fire or binding not correct");
//
// Make sure we can mix and match bound and unbound arguments. This callback
// returns an integer so we should see that appear.
//
Callback<int, int> target3 = MakeBoundCallback (&MakeBoundCallbackTarget3, &a);
int result = target3 (2468);
NS_TEST_ASSERT_MSG_EQ (result, 1234, "Return value of callback not correct");
NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3a, &a, "Callback did not fire or binding not correct");
NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3b, 2468, "Callback did not fire or argument not correct");
}
// ===========================================================================
// Test the Nullify mechanism
// ===========================================================================
class NullifyCallbackTestCase : public TestCase
{
public:
NullifyCallbackTestCase ();
virtual ~NullifyCallbackTestCase () {}
void Target1 (void) { m_test1 = true; }
private:
virtual void DoRun (void);
virtual void DoSetup (void);
bool m_test1;
};
NullifyCallbackTestCase::NullifyCallbackTestCase ()
: TestCase ("Check Nullify() and IsNull()")
{
}
void
NullifyCallbackTestCase::DoSetup (void)
{
m_test1 = false;
}
void
NullifyCallbackTestCase::DoRun (void)
{
//
// Make sure we can declare and make a Callback pointing to a member
// function returning void and execute it.
//
Callback<void> target1 = MakeCallback (&NullifyCallbackTestCase::Target1, this);
target1 ();
NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), false, "Working Callback reports IsNull()");
target1.Nullify ();
NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), true, "Nullified Callback reports not IsNull()");
}
// ===========================================================================
// Make sure that various MakeCallback template functions compile and execute.
// Doesn't check an results of the execution.
// ===========================================================================
class MakeCallbackTemplatesTestCase : public TestCase
{
public:
MakeCallbackTemplatesTestCase ();
virtual ~MakeCallbackTemplatesTestCase () {}
void Target1 (void) { m_test1 = true; }
private:
virtual void DoRun (void);
bool m_test1;
};
void TestFZero (void) {}
void TestFOne (int) {}
void TestFTwo (int, int) {}
void TestFThree (int, int, int) {}
void TestFFour (int, int, int, int) {}
void TestFFive (int, int, int, int, int) {}
void TestFSix (int, int, int, int, int, int) {}
void TestFROne (int &) {}
void TestFRTwo (int &, int &) {}
void TestFRThree (int &, int &, int &) {}
void TestFRFour (int &, int &, int &, int &) {}
void TestFRFive (int &, int &, int &, int &, int &) {}
void TestFRSix (int &, int &, int &, int &, int &, int &) {}
class CallbackTestParent
{
public:
void PublicParent (void) {}
protected:
void ProtectedParent (void) {}
static void StaticProtectedParent (void) {}
private:
void PrivateParent (void) {}
};
class CallbackTestClass : public CallbackTestParent
{
public:
void TestZero (void) {}
void TestOne (int) {}
void TestTwo (int, int) {}
void TestThree (int, int, int) {}
void TestFour (int, int, int, int) {}
void TestFive (int, int, int, int, int) {}
void TestSix (int, int, int, int, int, int) {}
void TestCZero (void) const {}
void TestCOne (int) const {}
void TestCTwo (int, int) const {}
void TestCThree (int, int, int) const {}
void TestCFour (int, int, int, int) const {}
void TestCFive (int, int, int, int, int) const {}
void TestCSix (int, int, int, int, int, int) const {}
void CheckParentalRights (void)
{
MakeCallback (&CallbackTestParent::StaticProtectedParent);
MakeCallback (&CallbackTestParent::PublicParent, this);
MakeCallback (&CallbackTestClass::ProtectedParent, this);
// as expected, fails.
// MakeCallback (&CallbackTestParent::PrivateParent, this);
// unexpected, but fails too. It does fumble me.
// MakeCallback (&CallbackTestParent::ProtectedParent, this);
}
};
MakeCallbackTemplatesTestCase::MakeCallbackTemplatesTestCase ()
: TestCase ("Check various MakeCallback() template functions")
{
}
void
MakeCallbackTemplatesTestCase::DoRun (void)
{
CallbackTestClass that;
MakeCallback (&CallbackTestClass::TestZero, &that);
MakeCallback (&CallbackTestClass::TestOne, &that);
MakeCallback (&CallbackTestClass::TestTwo, &that);
MakeCallback (&CallbackTestClass::TestThree, &that);
MakeCallback (&CallbackTestClass::TestFour, &that);
MakeCallback (&CallbackTestClass::TestFive, &that);
MakeCallback (&CallbackTestClass::TestSix, &that);
MakeCallback (&CallbackTestClass::TestCZero, &that);
MakeCallback (&CallbackTestClass::TestCOne, &that);
MakeCallback (&CallbackTestClass::TestCTwo, &that);
MakeCallback (&CallbackTestClass::TestCThree, &that);
MakeCallback (&CallbackTestClass::TestCFour, &that);
MakeCallback (&CallbackTestClass::TestCFive, &that);
MakeCallback (&CallbackTestClass::TestCSix, &that);
MakeCallback (&TestFZero);
MakeCallback (&TestFOne);
MakeCallback (&TestFTwo);
MakeCallback (&TestFThree);
MakeCallback (&TestFFour);
MakeCallback (&TestFFive);
MakeCallback (&TestFSix);
MakeCallback (&TestFROne);
MakeCallback (&TestFRTwo);
MakeCallback (&TestFRThree);
MakeCallback (&TestFRFour);
MakeCallback (&TestFRFive);
MakeCallback (&TestFRSix);
MakeBoundCallback (&TestFOne, 1);
MakeBoundCallback (&TestFTwo, 1);
MakeBoundCallback (&TestFThree, 1);
MakeBoundCallback (&TestFFour, 1);
MakeBoundCallback (&TestFFive, 1);
MakeBoundCallback (&TestFROne, 1);
MakeBoundCallback (&TestFRTwo, 1);
MakeBoundCallback (&TestFRThree, 1);
MakeBoundCallback (&TestFRFour, 1);
MakeBoundCallback (&TestFRFive, 1);
that.CheckParentalRights ();
}
// ===========================================================================
// The Test Suite that glues all of the Test Cases together.
// ===========================================================================
class CallbackTestSuite : public TestSuite
{
public:
CallbackTestSuite ();
};
CallbackTestSuite::CallbackTestSuite ()
: TestSuite ("callback", UNIT)
{
AddTestCase (new BasicCallbackTestCase);
AddTestCase (new MakeCallbackTestCase);
AddTestCase (new MakeBoundCallbackTestCase);
AddTestCase (new NullifyCallbackTestCase);
AddTestCase (new MakeCallbackTemplatesTestCase);
}
static CallbackTestSuite CallbackTestSuite;
} // namespace
| zy901002-gpsr | src/core/test/callback-test-suite.cc | C++ | gpl2 | 17,817 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/test.h"
#include "ns3/simulator.h"
#include "ns3/list-scheduler.h"
#include "ns3/heap-scheduler.h"
#include "ns3/map-scheduler.h"
#include "ns3/calendar-scheduler.h"
#include "ns3/ns2-calendar-scheduler.h"
namespace ns3 {
class SimulatorEventsTestCase : public TestCase
{
public:
SimulatorEventsTestCase (ObjectFactory schedulerFactory);
virtual void DoRun (void);
void A (int a);
void B (int b);
void C (int c);
void D (int d);
void foo0 (void);
uint64_t NowUs (void);
void destroy (void);
bool m_b;
bool m_a;
bool m_c;
bool m_d;
EventId m_idC;
bool m_destroy;
EventId m_destroyId;
ObjectFactory m_schedulerFactory;
};
SimulatorEventsTestCase::SimulatorEventsTestCase (ObjectFactory schedulerFactory)
: TestCase ("Check that basic event handling is working with " +
schedulerFactory.GetTypeId ().GetName ()),
m_schedulerFactory (schedulerFactory)
{
}
uint64_t
SimulatorEventsTestCase::NowUs (void)
{
uint64_t ns = Now ().GetNanoSeconds ();
return ns / 1000;
}
void
SimulatorEventsTestCase::A (int a)
{
m_a = false;
}
void
SimulatorEventsTestCase::B (int b)
{
if (b != 2 || NowUs () != 11)
{
m_b = false;
}
else
{
m_b = true;
}
Simulator::Remove (m_idC);
Simulator::Schedule (MicroSeconds (10), &SimulatorEventsTestCase::D, this, 4);
}
void
SimulatorEventsTestCase::C (int c)
{
m_c = false;
}
void
SimulatorEventsTestCase::D (int d)
{
if (d != 4 || NowUs () != (11+10))
{
m_d = false;
}
else
{
m_d = true;
}
}
void
SimulatorEventsTestCase::foo0 (void)
{}
void
SimulatorEventsTestCase::destroy (void)
{
if (m_destroyId.IsExpired ())
{
m_destroy = true;
}
}
void
SimulatorEventsTestCase::DoRun (void)
{
m_a = true;
m_b = false;
m_c = true;
m_d = false;
Simulator::SetScheduler (m_schedulerFactory);
EventId a = Simulator::Schedule (MicroSeconds (10), &SimulatorEventsTestCase::A, this, 1);
Simulator::Schedule (MicroSeconds (11), &SimulatorEventsTestCase::B, this, 2);
m_idC = Simulator::Schedule (MicroSeconds (12), &SimulatorEventsTestCase::C, this, 3);
NS_TEST_EXPECT_MSG_EQ (!m_idC.IsExpired (), true, "");
NS_TEST_EXPECT_MSG_EQ (!a.IsExpired (), true, "");
Simulator::Cancel (a);
NS_TEST_EXPECT_MSG_EQ (a.IsExpired (), true, "");
Simulator::Run ();
NS_TEST_EXPECT_MSG_EQ (m_a, true, "Event A did not run ?");
NS_TEST_EXPECT_MSG_EQ (m_b, true, "Event B did not run ?");
NS_TEST_EXPECT_MSG_EQ (m_c, true, "Event C did not run ?");
NS_TEST_EXPECT_MSG_EQ (m_d, true, "Event D did not run ?");
EventId anId = Simulator::ScheduleNow (&SimulatorEventsTestCase::foo0, this);
EventId anotherId = anId;
NS_TEST_EXPECT_MSG_EQ (!(anId.IsExpired () || anotherId.IsExpired ()), true, "Event should not have expired yet.");
Simulator::Remove (anId);
NS_TEST_EXPECT_MSG_EQ (anId.IsExpired (), true, "Event was removed: it is now expired");
NS_TEST_EXPECT_MSG_EQ (anotherId.IsExpired (), true, "Event was removed: it is now expired");
m_destroy = false;
m_destroyId = Simulator::ScheduleDestroy (&SimulatorEventsTestCase::destroy, this);
NS_TEST_EXPECT_MSG_EQ (!m_destroyId.IsExpired (), true, "Event should not have expired yet");
m_destroyId.Cancel ();
NS_TEST_EXPECT_MSG_EQ (m_destroyId.IsExpired (), true, "Event was canceled: should have expired now");
m_destroyId = Simulator::ScheduleDestroy (&SimulatorEventsTestCase::destroy, this);
NS_TEST_EXPECT_MSG_EQ (!m_destroyId.IsExpired (), true, "Event should not have expired yet");
Simulator::Remove (m_destroyId);
NS_TEST_EXPECT_MSG_EQ (m_destroyId.IsExpired (), true, "Event was canceled: should have expired now");
m_destroyId = Simulator::ScheduleDestroy (&SimulatorEventsTestCase::destroy, this);
NS_TEST_EXPECT_MSG_EQ (!m_destroyId.IsExpired (), true, "Event should not have expired yet");
Simulator::Run ();
NS_TEST_EXPECT_MSG_EQ (!m_destroyId.IsExpired (), true, "Event should not have expired yet");
NS_TEST_EXPECT_MSG_EQ (!m_destroy, true, "Event should not have run");
Simulator::Destroy ();
NS_TEST_EXPECT_MSG_EQ (m_destroyId.IsExpired (), true, "Event should have expired now");
NS_TEST_EXPECT_MSG_EQ (m_destroy, true, "Event should have run");
}
class SimulatorTemplateTestCase : public TestCase
{
public:
SimulatorTemplateTestCase ();
// only here for testing of Ptr<>
void Ref (void) const {}
void Unref (void) const {}
private:
virtual void DoRun (void);
void bar0 (void) {}
void bar1 (int) {}
void bar2 (int, int) {}
void bar3 (int, int, int) {}
void bar4 (int, int, int, int) {}
void bar5 (int, int, int, int, int) {}
void baz1 (int &) {}
void baz2 (int &, int &) {}
void baz3 (int &, int &, int &) {}
void baz4 (int &, int &, int &, int &) {}
void baz5 (int &, int &, int &, int &, int &) {}
void cbaz1 (const int &) {}
void cbaz2 (const int &, const int &) {}
void cbaz3 (const int &, const int &, const int &) {}
void cbaz4 (const int &, const int &, const int &, const int &) {}
void cbaz5 (const int &, const int &, const int &, const int &, const int &) {}
void bar0c (void) const {}
void bar1c (int) const {}
void bar2c (int, int) const {}
void bar3c (int, int, int) const {}
void bar4c (int, int, int, int) const {}
void bar5c (int, int, int, int, int) const {}
void baz1c (int &) const {}
void baz2c (int &, int &) const {}
void baz3c (int &, int &, int &) const {}
void baz4c (int &, int &, int &, int &) const {}
void baz5c (int &, int &, int &, int &, int &) const {}
void cbaz1c (const int &) const {}
void cbaz2c (const int &, const int &) const {}
void cbaz3c (const int &, const int &, const int &) const {}
void cbaz4c (const int &, const int &, const int &, const int &) const {}
void cbaz5c (const int &, const int &, const int &, const int &, const int &) const {}
};
static void foo0 (void)
{}
static void foo1 (int)
{}
static void foo2 (int, int)
{}
static void foo3 (int, int, int)
{}
static void foo4 (int, int, int, int)
{}
static void foo5 (int, int, int, int, int)
{}
static void ber1 (int &)
{}
static void ber2 (int &, int &)
{}
static void ber3 (int &, int &, int &)
{}
static void ber4 (int &, int &, int &, int &)
{}
static void ber5 (int &, int &, int &, int &, int &)
{}
static void cber1 (const int &)
{}
static void cber2 (const int &, const int &)
{}
static void cber3 (const int &, const int &, const int &)
{}
static void cber4 (const int &, const int &, const int &, const int &)
{}
static void cber5 (const int &, const int &, const int &, const int &, const int &)
{}
SimulatorTemplateTestCase::SimulatorTemplateTestCase ()
: TestCase ("Check that all templates are instanciated correctly. This is a compilation test, it cannot fail at runtime.")
{
}
void
SimulatorTemplateTestCase::DoRun (void)
{
// Test schedule of const methods
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar0c, this);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar1c, this, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar2c, this, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar3c, this, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar4c, this, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar5c, this, 0, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz1c, this, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz2c, this, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz3c, this, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz4c, this, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz5c, this, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar0c, this);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar1c, this, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar2c, this, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar3c, this, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar4c, this, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar5c, this, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz1c, this, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz2c, this, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz3c, this, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz4c, this, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz5c, this, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar0c, this);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar1c, this, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar2c, this, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar3c, this, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar4c, this, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar5c, this, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz1c, this, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz2c, this, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz3c, this, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz4c, this, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz5c, this, 0, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz1c, this, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz2c, this, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz3c, this, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz4c, this, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz5c, this, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz1c, this, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz2c, this, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz3c, this, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz4c, this, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz5c, this, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz1c, this, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz2c, this, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz3c, this, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz4c, this, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz5c, this, 0, 0, 0, 0, 0);
// Test of schedule const methods with Ptr<> pointers
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar0c, Ptr<const SimulatorTemplateTestCase> (this));
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar1c, Ptr<const SimulatorTemplateTestCase> (this), 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar2c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar3c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar4c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar5c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar0c, Ptr<const SimulatorTemplateTestCase> (this));
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar1c, Ptr<const SimulatorTemplateTestCase> (this), 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar2c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar3c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar4c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar5c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar0c, Ptr<const SimulatorTemplateTestCase> (this));
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar1c, Ptr<const SimulatorTemplateTestCase> (this), 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar2c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar3c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar4c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar5c, Ptr<const SimulatorTemplateTestCase> (this), 0, 0, 0, 0, 0);
// Test schedule of raw functions
Simulator::Schedule (Seconds (0.0), &foo0);
Simulator::Schedule (Seconds (0.0), &foo1, 0);
Simulator::Schedule (Seconds (0.0), &foo2, 0, 0);
Simulator::Schedule (Seconds (0.0), &foo3, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &foo4, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &foo5, 0, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &cber1, 0);
Simulator::Schedule (Seconds (0.0), &cber2, 0, 0);
Simulator::Schedule (Seconds (0.0), &cber3, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &cber4, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &cber5, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&foo0);
Simulator::ScheduleNow (&foo1, 0);
Simulator::ScheduleNow (&foo2, 0, 0);
Simulator::ScheduleNow (&foo3, 0, 0, 0);
Simulator::ScheduleNow (&foo4, 0, 0, 0, 0);
Simulator::ScheduleNow (&foo5, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&cber1, 0);
Simulator::ScheduleNow (&cber2, 0, 0);
Simulator::ScheduleNow (&cber3, 0, 0, 0);
Simulator::ScheduleNow (&cber4, 0, 0, 0, 0);
Simulator::ScheduleNow (&cber5, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&foo0);
Simulator::ScheduleDestroy (&foo1, 0);
Simulator::ScheduleDestroy (&foo2, 0, 0);
Simulator::ScheduleDestroy (&foo3, 0, 0, 0);
Simulator::ScheduleDestroy (&foo4, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&foo5, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&cber1, 0);
Simulator::ScheduleDestroy (&cber2, 0, 0);
Simulator::ScheduleDestroy (&cber3, 0, 0, 0);
Simulator::ScheduleDestroy (&cber4, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&cber5, 0, 0, 0, 0, 0);
// Test schedule of normal member methods
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar0, this);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar1, this, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar2, this, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar3, this, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar4, this, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar5, this, 0, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz1, this, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz2, this, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz3, this, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz4, this, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::cbaz5, this, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar0, this);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar1, this, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar2, this, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar3, this, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar4, this, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar5, this, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz1, this, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz2, this, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz3, this, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz4, this, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::cbaz5, this, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar0, this);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar1, this, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar2, this, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar3, this, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar4, this, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar5, this, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz1, this, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz2, this, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz3, this, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz4, this, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::cbaz5, this, 0, 0, 0, 0, 0);
// test schedule of normal methods with Ptr<> pointers
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar0, Ptr<SimulatorTemplateTestCase> (this));
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar1, Ptr<SimulatorTemplateTestCase> (this), 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar2, Ptr<SimulatorTemplateTestCase> (this), 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar3, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar4, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::bar5, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar0, Ptr<SimulatorTemplateTestCase> (this));
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar1, Ptr<SimulatorTemplateTestCase> (this), 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar2, Ptr<SimulatorTemplateTestCase> (this), 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar3, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar4, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::bar5, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar0, Ptr<SimulatorTemplateTestCase> (this));
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar1, Ptr<SimulatorTemplateTestCase> (this), 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar2, Ptr<SimulatorTemplateTestCase> (this), 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar3, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar4, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::bar5, Ptr<SimulatorTemplateTestCase> (this), 0, 0, 0, 0, 0);
// the code below does not compile, as expected.
//Simulator::Schedule (Seconds (0.0), &cber1, 0.0);
// This code appears to be duplicate test code.
Simulator::Schedule (Seconds (0.0), &ber1, 0);
Simulator::Schedule (Seconds (0.0), &ber2, 0, 0);
Simulator::Schedule (Seconds (0.0), &ber3, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &ber4, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &ber5, 0, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz1, this, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz2, this, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz3, this, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz4, this, 0, 0, 0, 0);
Simulator::Schedule (Seconds (0.0), &SimulatorTemplateTestCase::baz5, this, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&ber1, 0);
Simulator::ScheduleNow (&ber2, 0, 0);
Simulator::ScheduleNow (&ber3, 0, 0, 0);
Simulator::ScheduleNow (&ber4, 0, 0, 0, 0);
Simulator::ScheduleNow (&ber5, 0, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz1, this, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz2, this, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz3, this, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz4, this, 0, 0, 0, 0);
Simulator::ScheduleNow (&SimulatorTemplateTestCase::baz5, this, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&ber1, 0);
Simulator::ScheduleDestroy (&ber2, 0, 0);
Simulator::ScheduleDestroy (&ber3, 0, 0, 0);
Simulator::ScheduleDestroy (&ber4, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&ber5, 0, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz1, this, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz2, this, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz3, this, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz4, this, 0, 0, 0, 0);
Simulator::ScheduleDestroy (&SimulatorTemplateTestCase::baz5, this, 0, 0, 0, 0, 0);
Simulator::Run ();
Simulator::Destroy ();
}
class SimulatorTestSuite : public TestSuite
{
public:
SimulatorTestSuite ()
: TestSuite ("simulator")
{
ObjectFactory factory;
factory.SetTypeId (ListScheduler::GetTypeId ());
AddTestCase (new SimulatorEventsTestCase (factory));
factory.SetTypeId (MapScheduler::GetTypeId ());
AddTestCase (new SimulatorEventsTestCase (factory));
factory.SetTypeId (HeapScheduler::GetTypeId ());
AddTestCase (new SimulatorEventsTestCase (factory));
factory.SetTypeId (CalendarScheduler::GetTypeId ());
AddTestCase (new SimulatorEventsTestCase (factory));
factory.SetTypeId (Ns2CalendarScheduler::GetTypeId ());
AddTestCase (new SimulatorEventsTestCase (factory));
}
} g_simulatorTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/simulator-test-suite.cc | C++ | gpl2 | 23,190 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/test.h"
#include "ns3/traced-callback.h"
using namespace ns3;
class BasicTracedCallbackTestCase : public TestCase
{
public:
BasicTracedCallbackTestCase ();
virtual ~BasicTracedCallbackTestCase () {}
private:
virtual void DoRun (void);
void CbOne (uint8_t a, double b);
void CbTwo (uint8_t a, double b);
bool m_one;
bool m_two;
};
BasicTracedCallbackTestCase::BasicTracedCallbackTestCase ()
: TestCase ("Check basic TracedCallback operation")
{
}
void
BasicTracedCallbackTestCase::CbOne (uint8_t a, double b)
{
m_one = true;
}
void
BasicTracedCallbackTestCase::CbTwo (uint8_t a, double b)
{
m_two = true;
}
void
BasicTracedCallbackTestCase::DoRun (void)
{
//
// Create a traced callback and connect it up to our target methods. All that
// these methods do is to set corresponding member variables m_one and m_two.
//
TracedCallback<uint8_t, double> trace;
//
// Connect both callbacks to their respective test methods. If we hit the
// trace, both callbacks should be called and the two variables should be set
// to true.
//
trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbOne, this));
trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbTwo, this));
m_one = false;
m_two = false;
trace (1, 2);
NS_TEST_ASSERT_MSG_EQ (m_one, true, "Callback CbOne not called");
NS_TEST_ASSERT_MSG_EQ (m_two, true, "Callback CbTwo not called");
//
// If we now disconnect callback one then only callback two should be called.
//
trace.DisconnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbOne, this));
m_one = false;
m_two = false;
trace (1, 2);
NS_TEST_ASSERT_MSG_EQ (m_one, false, "Callback CbOne unexpectedly called");
NS_TEST_ASSERT_MSG_EQ (m_two, true, "Callback CbTwo not called");
//
// If we now disconnect callback two then neither callback should be called.
//
trace.DisconnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbTwo, this));
m_one = false;
m_two = false;
trace (1, 2);
NS_TEST_ASSERT_MSG_EQ (m_one, false, "Callback CbOne unexpectedly called");
NS_TEST_ASSERT_MSG_EQ (m_two, false, "Callback CbTwo unexpectedly called");
//
// If we connect them back up, then both callbacks should be called.
//
trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbOne, this));
trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbTwo, this));
m_one = false;
m_two = false;
trace (1, 2);
NS_TEST_ASSERT_MSG_EQ (m_one, true, "Callback CbOne not called");
NS_TEST_ASSERT_MSG_EQ (m_two, true, "Callback CbTwo not called");
}
class TracedCallbackTestSuite : public TestSuite
{
public:
TracedCallbackTestSuite ();
};
TracedCallbackTestSuite::TracedCallbackTestSuite ()
: TestSuite ("traced-callback", UNIT)
{
AddTestCase (new BasicTracedCallbackTestCase);
}
static TracedCallbackTestSuite tracedCallbackTestSuite;
| zy901002-gpsr | src/core/test/traced-callback-test-suite.cc | C++ | gpl2 | 3,747 |
#include "ns3/int64x64.h"
#include "ns3/test.h"
namespace ns3
{
class Int64x64FracTestCase : public TestCase
{
public:
Int64x64FracTestCase ();
virtual void DoRun (void);
void CheckFrac (int64_t hi, uint64_t lo);
};
void
Int64x64FracTestCase::CheckFrac (int64_t hi, uint64_t lo)
{
int64x64_t tmp = int64x64_t (hi,lo);
NS_TEST_EXPECT_MSG_EQ (tmp.GetHigh (), hi,
"High part does not match");
NS_TEST_EXPECT_MSG_EQ (tmp.GetLow (), lo,
"Low part does not match");
}
Int64x64FracTestCase::Int64x64FracTestCase ()
: TestCase ("Check that we can manipulate the high and low part of every number")
{
}
void
Int64x64FracTestCase::DoRun (void)
{
CheckFrac (1, 0);
CheckFrac (1, 1);
CheckFrac (-1, 0);
CheckFrac (-1, 1);
}
class Int64x64InputTestCase : public TestCase
{
public:
Int64x64InputTestCase ();
virtual void DoRun (void);
void CheckString (std::string str, int64_t hi, uint64_t lo);
};
Int64x64InputTestCase::Int64x64InputTestCase ()
: TestCase ("Check that we parse Int64x64 numbers as strings")
{
}
void
Int64x64InputTestCase::CheckString (std::string str, int64_t hi, uint64_t lo)
{
std::istringstream iss;
iss.str (str);
int64x64_t hp;
iss >> hp;
NS_TEST_EXPECT_MSG_EQ (hp.GetHigh (), hi, "High parts do not match for input string " << str);
NS_TEST_EXPECT_MSG_EQ (hp.GetLow (), lo, "Low parts do not match for input string " << str);
}
void
Int64x64InputTestCase::DoRun (void)
{
CheckString ("1", 1, 0);
CheckString ("+1", 1, 0);
CheckString ("-1", -1, 0);
CheckString ("1.0", 1, 0);
CheckString ("+1.0", 1, 0);
CheckString ("001.0", 1, 0);
CheckString ("+001.0", 1, 0);
CheckString ("020.0", 20, 0);
CheckString ("+020.0", 20, 0);
CheckString ("-1.0", -1, 0);
CheckString ("-1.0000", -1, 0);
CheckString ("1.0000000", 1, 0);
CheckString ("1.08446744073709551615", 1, 8446744073709551615LL);
CheckString ("-1.08446744073709551615", -1, 8446744073709551615LL);
}
class Int64x64InputOutputTestCase : public TestCase
{
public:
Int64x64InputOutputTestCase ();
virtual void DoRun (void);
void CheckString (std::string str);
};
Int64x64InputOutputTestCase::Int64x64InputOutputTestCase ()
: TestCase ("Check that we can roundtrip Int64x64 numbers as strings")
{
}
void
Int64x64InputOutputTestCase::CheckString (std::string str)
{
std::istringstream iss;
iss.str (str);
int64x64_t value;
iss >> value;
std::ostringstream oss;
oss << value;
NS_TEST_EXPECT_MSG_EQ (oss.str (), str, "Converted string does not match expected string");
}
void
Int64x64InputOutputTestCase::DoRun (void)
{
CheckString ("+1.0");
CheckString ("-1.0");
CheckString ("+20.0");
CheckString ("+1.08446744073709551615");
CheckString ("-1.08446744073709551615");
CheckString ("+1.18446744073709551615");
CheckString ("-1.18446744073709551615");
}
#define CHECK_EXPECTED(a,b) \
NS_TEST_ASSERT_MSG_EQ ((a).GetHigh (),b,"Arithmetic failure: " << ((a).GetHigh ()) << "!=" << (b))
#define V(v) \
int64x64_t (v)
class Int64x64ArithmeticTestCase : public TestCase
{
public:
Int64x64ArithmeticTestCase ();
virtual void DoRun (void);
};
Int64x64ArithmeticTestCase::Int64x64ArithmeticTestCase ()
: TestCase ("Check basic arithmetic operations")
{
}
void
Int64x64ArithmeticTestCase::DoRun (void)
{
int64x64_t a, b;
CHECK_EXPECTED (V (1) - V (1), 0);
CHECK_EXPECTED (V (1) - V (2), -1);
CHECK_EXPECTED (V (1) - V (3), -2);
CHECK_EXPECTED (V (1) - V (-1), 2);
CHECK_EXPECTED (V (1) - V (-2), 3);
CHECK_EXPECTED (V (-3) - V (-4), 1);
CHECK_EXPECTED (V (-2) - V (3), -5);
CHECK_EXPECTED (V (1) + V (2), 3);
CHECK_EXPECTED (V (1) + V (-3), -2);
CHECK_EXPECTED (V (0) + V (0), 0);
CHECK_EXPECTED (V (0) * V (0), 0);
CHECK_EXPECTED (V (0) * V (1), 0);
CHECK_EXPECTED (V (0) * V (-1), 0);
CHECK_EXPECTED (V (1) * V (0), 0);
CHECK_EXPECTED (V (1) * V (1), 1);
CHECK_EXPECTED (V (1) * V (-1), -1);
CHECK_EXPECTED (V (-1) * V (-1), 1);
CHECK_EXPECTED (V (0) * V (1), 0);
CHECK_EXPECTED (V (0) * V (-1), 0);
CHECK_EXPECTED (V (-1) * V (1), -1);
CHECK_EXPECTED (V (2) * V (3) / V (3), 2);
// Below, the division loses precision because 2/3 is not
// representable exactly in 64.64 integers. So, we got
// something super close but the final rounding kills us.
a = V (2);
b = V (3);
a /= b;
a *= b;
CHECK_EXPECTED (V (2) / V (3) * V (3), 1);
// The example below shows that we really do not lose
// much precision internally: it is almost always the
// final conversion which loses precision.
CHECK_EXPECTED (V (2000000000) / V (3) * V (3), 1999999999);
}
class Int64x64Bug455TestCase : public TestCase
{
public:
Int64x64Bug455TestCase ();
virtual void DoRun (void);
};
Int64x64Bug455TestCase::Int64x64Bug455TestCase ()
: TestCase ("Test case for bug 455")
{
}
void
Int64x64Bug455TestCase::DoRun (void)
{
int64x64_t a = int64x64_t (0.1);
a /= int64x64_t (1.25);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 0.08, "The original testcase");
a = int64x64_t (0.5);
a *= int64x64_t (5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 2.5, "Simple test for multiplication");
a = int64x64_t (-0.5);
a *= int64x64_t (5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -2.5, "Test sign, first operation negative");
a = int64x64_t (-0.5);
a *=int64x64_t (-5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 2.5, "both operands negative");
a = int64x64_t (0.5);
a *= int64x64_t (-5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -2.5, "only second operand negative");
}
class Int64x64Bug863TestCase : public TestCase
{
public:
Int64x64Bug863TestCase ();
virtual void DoRun (void);
};
Int64x64Bug863TestCase::Int64x64Bug863TestCase ()
: TestCase ("Test case for bug 863")
{
}
void
Int64x64Bug863TestCase::DoRun (void)
{
int64x64_t a = int64x64_t (0.9);
a /= int64x64_t (1);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 0.9, "The original testcase");
a = int64x64_t (0.5);
a /= int64x64_t (0.5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 1.0, "Simple test for division");
a = int64x64_t (-0.5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -0.5, "Check that we actually convert doubles correctly");
a /= int64x64_t (0.5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -1.0, "first argument negative");
a = int64x64_t (0.5);
a /= int64x64_t (-0.5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -1.0, "second argument negative");
a = int64x64_t (-0.5);
a /= int64x64_t (-0.5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 1.0, "both arguments negative");
}
class Int64x64CompareTestCase : public TestCase
{
public:
Int64x64CompareTestCase ();
virtual void DoRun (void);
};
Int64x64CompareTestCase::Int64x64CompareTestCase ()
: TestCase ("Check basic compare operations")
{
}
void
Int64x64CompareTestCase::DoRun (void)
{
NS_TEST_ASSERT_MSG_EQ ((V (-1) < V (1)), true, "a is smaller than b");
NS_TEST_ASSERT_MSG_EQ ((V (-1) > V (-2)), true, "a is bigger than b");
NS_TEST_ASSERT_MSG_EQ ((V (-1) == V (-1)), true, "a is equal to b");
NS_TEST_ASSERT_MSG_EQ ((V (1) > V (-1)), true, "a is bigger than b");
NS_TEST_ASSERT_MSG_EQ ((V (1) < V (2)), true, "a is smaller than b");
}
class Int64x64InvertTestCase : public TestCase
{
public:
Int64x64InvertTestCase ();
virtual void DoRun (void);
};
Int64x64InvertTestCase::Int64x64InvertTestCase ()
: TestCase ("Test case for invertion")
{
}
void
Int64x64InvertTestCase::DoRun (void)
{
#define TEST(factor) \
do { \
int64x64_t a; \
a = int64x64_t::Invert (factor); \
int64x64_t b = V (factor); \
b.MulByInvert (a); \
NS_TEST_ASSERT_MSG_EQ (b.GetHigh (), 1, \
"x * 1/x should be 1 for x=" << factor); \
int64x64_t c = V (1); \
c.MulByInvert (a); \
NS_TEST_ASSERT_MSG_EQ (c.GetHigh (), 0, \
"1 * 1/x should be 0 for x=" << factor); \
int64x64_t d = V (1); \
d /= (V (factor)); \
NS_TEST_ASSERT_MSG_EQ (d.GetDouble (), c.GetDouble (), \
"1 * 1/x should be equal to 1/x for x=" << factor); \
int64x64_t e = V (-factor); \
e.MulByInvert (a); \
NS_TEST_ASSERT_MSG_EQ (e.GetHigh (), -1, \
"-x * 1/x should be -1 for x=" << factor); \
} \
while(false)
TEST (2);
TEST (3);
TEST (4);
TEST (5);
TEST (6);
TEST (10);
TEST (99);
TEST (100);
TEST (1000);
TEST (10000);
TEST (100000);
TEST (100000);
TEST (1000000);
TEST (10000000);
TEST (100000000);
TEST (1000000000);
TEST (10000000000LL);
TEST (100000000000LL);
TEST (1000000000000LL);
TEST (10000000000000LL);
TEST (100000000000000LL);
TEST (1000000000000000LL);
#undef TEST
}
static class Int64x64128TestSuite : public TestSuite
{
public:
Int64x64128TestSuite ()
: TestSuite ("int64x64", UNIT)
{
AddTestCase (new Int64x64FracTestCase ());
AddTestCase (new Int64x64InputTestCase ());
AddTestCase (new Int64x64InputOutputTestCase ());
AddTestCase (new Int64x64ArithmeticTestCase ());
AddTestCase (new Int64x64Bug455TestCase ());
AddTestCase (new Int64x64Bug863TestCase ());
AddTestCase (new Int64x64CompareTestCase ());
AddTestCase (new Int64x64InvertTestCase ());
}
} g_int64x64TestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/int64x64-test-suite.cc | C++ | gpl2 | 9,969 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Rajib Bhattacharjea<raj.b@gatech.edu>
// Author: Hadi Arbabi<marbabi@cs.odu.edu>
//
#include <iostream>
#include <math.h>
#include "ns3/test.h"
#include "ns3/assert.h"
#include "ns3/integer.h"
#include "ns3/random-variable.h"
using namespace std;
namespace ns3 {
class BasicRandomNumberTestCase : public TestCase
{
public:
BasicRandomNumberTestCase ();
virtual ~BasicRandomNumberTestCase ()
{
}
private:
virtual void DoRun (void);
};
BasicRandomNumberTestCase::BasicRandomNumberTestCase ()
: TestCase ("Check basic random number operation")
{
}
void
BasicRandomNumberTestCase::DoRun (void)
{
const double desiredMean = 1.0;
const double desiredStdDev = 1.0;
double tmp = log (1 + (desiredStdDev / desiredMean) * (desiredStdDev / desiredMean));
double sigma = sqrt (tmp);
double mu = log (desiredMean) - 0.5 * tmp;
//
// Test a custom lognormal instance to see if its moments have any relation
// expected reality.
//
LogNormalVariable lognormal (mu, sigma);
vector<double> samples;
const int NSAMPLES = 10000;
double sum = 0;
//
// Get and store a bunch of samples. As we go along sum them and then find
// the mean value of the samples.
//
for (int n = NSAMPLES; n; --n)
{
double value = lognormal.GetValue ();
sum += value;
samples.push_back (value);
}
double obtainedMean = sum / NSAMPLES;
NS_TEST_EXPECT_MSG_EQ_TOL (obtainedMean, desiredMean, 0.1, "Got unexpected mean value from LogNormalVariable");
//
// Wander back through the saved stamples and find their standard deviation
//
sum = 0;
for (vector<double>::iterator iter = samples.begin (); iter != samples.end (); iter++)
{
double tmp = (*iter - obtainedMean);
sum += tmp * tmp;
}
double obtainedStdDev = sqrt (sum / (NSAMPLES - 1));
NS_TEST_EXPECT_MSG_EQ_TOL (obtainedStdDev, desiredStdDev, 0.1, "Got unexpected standard deviation from LogNormalVariable");
}
class RandomNumberSerializationTestCase : public TestCase
{
public:
RandomNumberSerializationTestCase ();
virtual ~RandomNumberSerializationTestCase ()
{
}
private:
virtual void DoRun (void);
};
RandomNumberSerializationTestCase::RandomNumberSerializationTestCase ()
: TestCase ("Check basic random number operation")
{
}
void
RandomNumberSerializationTestCase::DoRun (void)
{
RandomVariableValue val;
val.DeserializeFromString ("Uniform:0.1:0.2", MakeRandomVariableChecker ());
RandomVariable rng = val.Get ();
NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Uniform:0.1:0.2",
"Deserialize and Serialize \"Uniform:0.1:0.2\" mismatch");
val.DeserializeFromString ("Normal:0.1:0.2", MakeRandomVariableChecker ());
rng = val.Get ();
NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2",
"Deserialize and Serialize \"Normal:0.1:0.2\" mismatch");
val.DeserializeFromString ("Normal:0.1:0.2:0.15", MakeRandomVariableChecker ());
rng = val.Get ();
NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2:0.15",
"Deserialize and Serialize \"Normal:0.1:0.2:0.15\" mismatch");
}
class BasicRandomNumberTestSuite : public TestSuite
{
public:
BasicRandomNumberTestSuite ();
};
BasicRandomNumberTestSuite::BasicRandomNumberTestSuite ()
: TestSuite ("basic-random-number", UNIT)
{
AddTestCase (new BasicRandomNumberTestCase);
AddTestCase (new RandomNumberSerializationTestCase);
}
static BasicRandomNumberTestSuite BasicRandomNumberTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/random-variable-test-suite.cc | C++ | gpl2 | 4,417 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/command-line.h"
#include "ns3/log.h"
#include "ns3/config.h"
#include "ns3/global-value.h"
#include "ns3/type-id.h"
#include "ns3/test.h"
#include "ns3/string.h"
#include <stdlib.h>
#include <stdarg.h>
namespace ns3 {
// ===========================================================================
// A test base class that drives Command Line parsing
// ===========================================================================
class CommandLineTestCaseBase : public TestCase
{
public:
CommandLineTestCaseBase (std::string description);
virtual ~CommandLineTestCaseBase () {}
void Parse (const CommandLine &cmd, int n, ...);
};
CommandLineTestCaseBase::CommandLineTestCaseBase (std::string description)
: TestCase (description)
{
}
void
CommandLineTestCaseBase::Parse (const CommandLine &cmd, int n, ...)
{
char **args = new char* [n+1];
args[0] = (char *) "Test";
va_list ap;
va_start (ap, n);
int i = 0;
while (i < n)
{
char *arg = va_arg (ap, char *);
args[i+1] = arg;
i++;
}
int argc = n + 1;
cmd.Parse (argc, args);
delete [] args;
}
// ===========================================================================
// Test boolean Command Line processing
// ===========================================================================
class CommandLineBooleanTestCase : public CommandLineTestCaseBase
{
public:
CommandLineBooleanTestCase ();
virtual ~CommandLineBooleanTestCase () {}
private:
virtual void DoRun (void);
};
CommandLineBooleanTestCase::CommandLineBooleanTestCase ()
: CommandLineTestCaseBase ("Check boolean arguments")
{
}
void
CommandLineBooleanTestCase::DoRun (void)
{
CommandLine cmd;
bool myBool = true;
cmd.AddValue ("my-bool", "help", myBool);
Parse (cmd, 1, "--my-bool=0");
NS_TEST_ASSERT_MSG_EQ (myBool, false, "Command parser did not correctly set a boolean value to false");
Parse (cmd, 1, "--my-bool=1");
NS_TEST_ASSERT_MSG_EQ (myBool, true, "Command parser did not correctly set a boolean value to true");
}
// ===========================================================================
// Test int Command Line processing
// ===========================================================================
class CommandLineIntTestCase : public CommandLineTestCaseBase
{
public:
CommandLineIntTestCase ();
virtual ~CommandLineIntTestCase () {}
private:
virtual void DoRun (void);
};
CommandLineIntTestCase::CommandLineIntTestCase ()
: CommandLineTestCaseBase ("Check int arguments")
{
}
void
CommandLineIntTestCase::DoRun (void)
{
CommandLine cmd;
bool myBool = true;
int32_t myInt32 = 10;
cmd.AddValue ("my-bool", "help", myBool);
cmd.AddValue ("my-int32", "help", myInt32);
Parse (cmd, 2, "--my-bool=0", "--my-int32=-3");
NS_TEST_ASSERT_MSG_EQ (myBool, false, "Command parser did not correctly set a boolean value to false");
NS_TEST_ASSERT_MSG_EQ (myInt32, -3, "Command parser did not correctly set an integer value to -3");
Parse (cmd, 2, "--my-bool=1", "--my-int32=+2");
NS_TEST_ASSERT_MSG_EQ (myBool, true, "Command parser did not correctly set a boolean value to true");
NS_TEST_ASSERT_MSG_EQ (myInt32, +2, "Command parser did not correctly set an integer value to +2");
}
// ===========================================================================
// Test unsigned int Command Line processing
// ===========================================================================
class CommandLineUnsignedIntTestCase : public CommandLineTestCaseBase
{
public:
CommandLineUnsignedIntTestCase ();
virtual ~CommandLineUnsignedIntTestCase () {}
private:
virtual void DoRun (void);
};
CommandLineUnsignedIntTestCase::CommandLineUnsignedIntTestCase ()
: CommandLineTestCaseBase ("Check unsigned int arguments")
{
}
void
CommandLineUnsignedIntTestCase::DoRun (void)
{
CommandLine cmd;
bool myBool = true;
uint32_t myUint32 = 10;
cmd.AddValue ("my-bool", "help", myBool);
cmd.AddValue ("my-uint32", "help", myUint32);
Parse (cmd, 2, "--my-bool=0", "--my-uint32=9");
NS_TEST_ASSERT_MSG_EQ (myBool, false, "Command parser did not correctly set a boolean value to true");
NS_TEST_ASSERT_MSG_EQ (myUint32, 9, "Command parser did not correctly set an unsigned integer value to 9");
}
// ===========================================================================
// Test string Command Line processing
// ===========================================================================
class CommandLineStringTestCase : public CommandLineTestCaseBase
{
public:
CommandLineStringTestCase ();
virtual ~CommandLineStringTestCase () {}
private:
virtual void DoRun (void);
};
CommandLineStringTestCase::CommandLineStringTestCase ()
: CommandLineTestCaseBase ("Check unsigned int arguments")
{
}
void
CommandLineStringTestCase::DoRun (void)
{
CommandLine cmd;
uint32_t myUint32 = 10;
std::string myStr = "MyStr";
cmd.AddValue ("my-uint32", "help", myUint32);
cmd.AddValue ("my-str", "help", myStr);
Parse (cmd, 2, "--my-uint32=9", "--my-str=XX");
NS_TEST_ASSERT_MSG_EQ (myUint32, 9, "Command parser did not correctly set an unsigned integer value to 9");
NS_TEST_ASSERT_MSG_EQ (myStr, "XX", "Command parser did not correctly set an string value to \"XX\"");
}
// ===========================================================================
// The Test Suite that glues all of the Test Cases together.
// ===========================================================================
class CommandLineTestSuite : public TestSuite
{
public:
CommandLineTestSuite ();
};
CommandLineTestSuite::CommandLineTestSuite ()
: TestSuite ("command-line", UNIT)
{
AddTestCase (new CommandLineBooleanTestCase);
AddTestCase (new CommandLineIntTestCase);
AddTestCase (new CommandLineUnsignedIntTestCase);
AddTestCase (new CommandLineStringTestCase);
}
static CommandLineTestSuite CommandLineTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/command-line-test-suite.cc | C++ | gpl2 | 6,740 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <math.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_histogram.h>
#include <time.h>
#include <fstream>
#include "ns3/test.h"
#include "ns3/random-variable.h"
using namespace ns3;
void
FillHistoRangeUniformly (double *array, uint32_t n, double start, double end)
{
double increment = (end - start) / (n - 1.);
double d = start;
for (uint32_t i = 0; i < n; ++i)
{
array[i] = d;
d += increment;
}
}
// ===========================================================================
// Test case for uniform distribution random number generator
// ===========================================================================
class RngUniformTestCase : public TestCase
{
public:
static const uint32_t N_RUNS = 5;
static const uint32_t N_BINS = 50;
static const uint32_t N_MEASUREMENTS = 1000000;
RngUniformTestCase ();
virtual ~RngUniformTestCase ();
double ChiSquaredTest (UniformVariable &u);
private:
virtual void DoRun (void);
};
RngUniformTestCase::RngUniformTestCase ()
: TestCase ("Uniform Random Number Generator")
{
}
RngUniformTestCase::~RngUniformTestCase ()
{
}
double
RngUniformTestCase::ChiSquaredTest (UniformVariable &u)
{
gsl_histogram * h = gsl_histogram_alloc (N_BINS);
gsl_histogram_set_ranges_uniform (h, 0., 1.);
for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
{
gsl_histogram_increment (h, u.GetValue ());
}
double tmp[N_BINS];
double expected = ((double)N_MEASUREMENTS / (double)N_BINS);
for (uint32_t i = 0; i < N_BINS; ++i)
{
tmp[i] = gsl_histogram_get (h, i);
tmp[i] -= expected;
tmp[i] *= tmp[i];
tmp[i] /= expected;
}
gsl_histogram_free (h);
double chiSquared = 0;
for (uint32_t i = 0; i < N_BINS; ++i)
{
chiSquared += tmp[i];
}
return chiSquared;
}
void
RngUniformTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
double sum = 0.;
double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
for (uint32_t i = 0; i < N_RUNS; ++i)
{
UniformVariable u;
double result = ChiSquaredTest (u);
sum += result;
}
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
}
// ===========================================================================
// Test case for normal distribution random number generator
// ===========================================================================
class RngNormalTestCase : public TestCase
{
public:
static const uint32_t N_RUNS = 5;
static const uint32_t N_BINS = 50;
static const uint32_t N_MEASUREMENTS = 1000000;
RngNormalTestCase ();
virtual ~RngNormalTestCase ();
double ChiSquaredTest (NormalVariable &n);
private:
virtual void DoRun (void);
};
RngNormalTestCase::RngNormalTestCase ()
: TestCase ("Normal Random Number Generator")
{
}
RngNormalTestCase::~RngNormalTestCase ()
{
}
double
RngNormalTestCase::ChiSquaredTest (NormalVariable &n)
{
gsl_histogram * h = gsl_histogram_alloc (N_BINS);
double range[N_BINS + 1];
FillHistoRangeUniformly (range, N_BINS + 1, -4., 4.);
range[0] = -std::numeric_limits<double>::max ();
range[N_BINS] = std::numeric_limits<double>::max ();
gsl_histogram_set_ranges (h, range, N_BINS + 1);
double expected[N_BINS];
double sigma = 1.;
for (uint32_t i = 0; i < N_BINS; ++i)
{
expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
expected[i] *= N_MEASUREMENTS;
}
for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
{
gsl_histogram_increment (h, n.GetValue ());
}
double tmp[N_BINS];
for (uint32_t i = 0; i < N_BINS; ++i)
{
tmp[i] = gsl_histogram_get (h, i);
tmp[i] -= expected[i];
tmp[i] *= tmp[i];
tmp[i] /= expected[i];
}
gsl_histogram_free (h);
double chiSquared = 0;
for (uint32_t i = 0; i < N_BINS; ++i)
{
chiSquared += tmp[i];
}
return chiSquared;
}
void
RngNormalTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
double sum = 0.;
double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
for (uint32_t i = 0; i < N_RUNS; ++i)
{
NormalVariable n;
double result = ChiSquaredTest (n);
sum += result;
}
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
}
// ===========================================================================
// Test case for exponential distribution random number generator
// ===========================================================================
class RngExponentialTestCase : public TestCase
{
public:
static const uint32_t N_RUNS = 5;
static const uint32_t N_BINS = 50;
static const uint32_t N_MEASUREMENTS = 1000000;
RngExponentialTestCase ();
virtual ~RngExponentialTestCase ();
double ChiSquaredTest (ExponentialVariable &n);
private:
virtual void DoRun (void);
};
RngExponentialTestCase::RngExponentialTestCase ()
: TestCase ("Exponential Random Number Generator")
{
}
RngExponentialTestCase::~RngExponentialTestCase ()
{
}
double
RngExponentialTestCase::ChiSquaredTest (ExponentialVariable &e)
{
gsl_histogram * h = gsl_histogram_alloc (N_BINS);
double range[N_BINS + 1];
FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
range[N_BINS] = std::numeric_limits<double>::max ();
gsl_histogram_set_ranges (h, range, N_BINS + 1);
double expected[N_BINS];
double mu = 1.;
for (uint32_t i = 0; i < N_BINS; ++i)
{
expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
expected[i] *= N_MEASUREMENTS;
}
for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
{
gsl_histogram_increment (h, e.GetValue ());
}
double tmp[N_BINS];
for (uint32_t i = 0; i < N_BINS; ++i)
{
tmp[i] = gsl_histogram_get (h, i);
tmp[i] -= expected[i];
tmp[i] *= tmp[i];
tmp[i] /= expected[i];
}
gsl_histogram_free (h);
double chiSquared = 0;
for (uint32_t i = 0; i < N_BINS; ++i)
{
chiSquared += tmp[i];
}
return chiSquared;
}
void
RngExponentialTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
double sum = 0.;
double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
for (uint32_t i = 0; i < N_RUNS; ++i)
{
ExponentialVariable e;
double result = ChiSquaredTest (e);
sum += result;
}
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
}
// ===========================================================================
// Test case for pareto distribution random number generator
// ===========================================================================
class RngParetoTestCase : public TestCase
{
public:
static const uint32_t N_RUNS = 5;
static const uint32_t N_BINS = 50;
static const uint32_t N_MEASUREMENTS = 1000000;
RngParetoTestCase ();
virtual ~RngParetoTestCase ();
double ChiSquaredTest (ParetoVariable &p);
private:
virtual void DoRun (void);
};
RngParetoTestCase::RngParetoTestCase ()
: TestCase ("Pareto Random Number Generator")
{
}
RngParetoTestCase::~RngParetoTestCase ()
{
}
double
RngParetoTestCase::ChiSquaredTest (ParetoVariable &p)
{
gsl_histogram * h = gsl_histogram_alloc (N_BINS);
double range[N_BINS + 1];
FillHistoRangeUniformly (range, N_BINS + 1, 1., 10.);
range[N_BINS] = std::numeric_limits<double>::max ();
gsl_histogram_set_ranges (h, range, N_BINS + 1);
double expected[N_BINS];
double a = 1.5;
double b = 0.33333333;
for (uint32_t i = 0; i < N_BINS; ++i)
{
expected[i] = gsl_cdf_pareto_P (range[i + 1], a, b) - gsl_cdf_pareto_P (range[i], a, b);
expected[i] *= N_MEASUREMENTS;
}
for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
{
gsl_histogram_increment (h, p.GetValue ());
}
double tmp[N_BINS];
for (uint32_t i = 0; i < N_BINS; ++i)
{
tmp[i] = gsl_histogram_get (h, i);
tmp[i] -= expected[i];
tmp[i] *= tmp[i];
tmp[i] /= expected[i];
}
gsl_histogram_free (h);
double chiSquared = 0;
for (uint32_t i = 0; i < N_BINS; ++i)
{
chiSquared += tmp[i];
}
return chiSquared;
}
void
RngParetoTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
double sum = 0.;
double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
for (uint32_t i = 0; i < N_RUNS; ++i)
{
ParetoVariable e;
double result = ChiSquaredTest (e);
sum += result;
}
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
}
class RngTestSuite : public TestSuite
{
public:
RngTestSuite ();
};
RngTestSuite::RngTestSuite ()
: TestSuite ("random-number-generators", UNIT)
{
AddTestCase (new RngUniformTestCase);
AddTestCase (new RngNormalTestCase);
AddTestCase (new RngExponentialTestCase);
AddTestCase (new RngParetoTestCase);
}
static RngTestSuite rngTestSuite;
| zy901002-gpsr | src/core/test/rng-test-suite.cc | C++ | gpl2 | 9,742 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/global-value.h"
#include "ns3/test.h"
#include "ns3/uinteger.h"
namespace ns3 {
// ===========================================================================
// Test for the ability to get at a GlobalValue.
// ===========================================================================
class GlobalValueTestCase : public TestCase
{
public:
GlobalValueTestCase ();
virtual ~GlobalValueTestCase () {}
private:
virtual void DoRun (void);
};
GlobalValueTestCase::GlobalValueTestCase ()
: TestCase ("Check GlobalValue mechanism")
{
}
void
GlobalValueTestCase::DoRun (void)
{
//
// Typically these are static globals but we can make one on the stack to
// keep it hidden from the documentation.
//
GlobalValue uint = GlobalValue ("TestUint", "help text",
UintegerValue (10),
MakeUintegerChecker<uint32_t> ());
//
// Make sure we can get at the value and that it was initialized correctly.
//
UintegerValue uv;
uint.GetValue (uv);
NS_TEST_ASSERT_MSG_EQ (uv.Get (), 10, "GlobalValue \"TestUint\" not initialized as expected");
//
// Remove the global value for a valgrind clean run
//
GlobalValue::Vector *vector = GlobalValue::GetVector ();
for (GlobalValue::Vector::iterator i = vector->begin (); i != vector->end (); ++i)
{
if ((*i) == &uint)
{
vector->erase (i);
break;
}
}
}
// ===========================================================================
// The Test Suite that glues all of the Test Cases together.
// ===========================================================================
class GlobalValueTestSuite : public TestSuite
{
public:
GlobalValueTestSuite ();
};
GlobalValueTestSuite::GlobalValueTestSuite ()
: TestSuite ("global-value", UNIT)
{
AddTestCase (new GlobalValueTestCase);
}
static GlobalValueTestSuite globalValueTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/global-value-test-suite.cc | C++ | gpl2 | 2,775 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/watchdog.h"
#include "ns3/test.h"
namespace ns3 {
class WatchdogTestCase : public TestCase
{
public:
WatchdogTestCase ();
virtual void DoRun (void);
void Expire (Time expected);
bool m_expired;
Time m_expiredTime;
Time m_expiredArgument;
};
WatchdogTestCase::WatchdogTestCase()
: TestCase ("Check that we can keepalive a watchdog")
{
}
void
WatchdogTestCase::Expire (Time expected)
{
m_expired = true;
m_expiredTime = Simulator::Now ();
m_expiredArgument = expected;
}
void
WatchdogTestCase::DoRun (void)
{
m_expired = false;
m_expiredArgument = Seconds (0);
m_expiredTime = Seconds (0);
Watchdog watchdog;
watchdog.SetFunction (&WatchdogTestCase::Expire, this);
watchdog.SetArguments (MicroSeconds (40));
watchdog.Ping (MicroSeconds (10));
Simulator::Schedule (MicroSeconds (5), &Watchdog::Ping, &watchdog, MicroSeconds (20));
Simulator::Schedule (MicroSeconds (20), &Watchdog::Ping, &watchdog, MicroSeconds (2));
Simulator::Schedule (MicroSeconds (23), &Watchdog::Ping, &watchdog, MicroSeconds (17));
Simulator::Run ();
Simulator::Destroy ();
NS_TEST_ASSERT_MSG_EQ (m_expired, true, "The timer did not expire ??");
NS_TEST_ASSERT_MSG_EQ (m_expiredTime, MicroSeconds (40), "The timer did not expire at the expected time ?");
NS_TEST_ASSERT_MSG_EQ (m_expiredArgument, MicroSeconds (40), "We did not get the right argument");
}
static class WatchdogTestSuite : public TestSuite
{
public:
WatchdogTestSuite()
: TestSuite ("watchdog", UNIT)
{
AddTestCase (new WatchdogTestCase ());
}
} g_watchdogTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/watchdog-test-suite.cc | C++ | gpl2 | 2,425 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/timer.h"
#include "ns3/test.h"
#include "ns3/simulator.h"
#include "ns3/nstime.h"
namespace {
void bari (int)
{
}
void bar2i (int, int)
{
}
void bar3i (int, int, int)
{
}
void bar4i (int, int, int, int)
{
}
void bar5i (int, int, int, int, int)
{
}
void bar6i (int, int, int, int, int, int)
{
}
void barcir (const int &)
{
}
void barir (int &)
{
}
void barip (int *)
{
}
void barcip (const int *)
{
}
} // anonymous namespace
namespace ns3 {
class TimerStateTestCase : public TestCase
{
public:
TimerStateTestCase ();
virtual void DoRun (void);
};
TimerStateTestCase::TimerStateTestCase ()
: TestCase ("Check correct state transitions")
{
}
void
TimerStateTestCase::DoRun (void)
{
Timer timer = Timer (Timer::CANCEL_ON_DESTROY);
timer.SetFunction (&bari);
timer.SetArguments (1);
timer.SetDelay (Seconds (10.0));
NS_TEST_ASSERT_MSG_EQ (!timer.IsRunning (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.IsExpired (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsSuspended (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.GetState (), Timer::EXPIRED, "");
timer.Schedule ();
NS_TEST_ASSERT_MSG_EQ (timer.IsRunning (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsExpired (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsSuspended (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.GetState (), Timer::RUNNING, "");
timer.Suspend ();
NS_TEST_ASSERT_MSG_EQ (!timer.IsRunning (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsExpired (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.IsSuspended (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.GetState (), Timer::SUSPENDED, "");
timer.Resume ();
NS_TEST_ASSERT_MSG_EQ (timer.IsRunning (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsExpired (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsSuspended (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.GetState (), Timer::RUNNING, "");
timer.Cancel ();
NS_TEST_ASSERT_MSG_EQ (!timer.IsRunning (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.IsExpired (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsSuspended (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.GetState (), Timer::EXPIRED, "");
}
class TimerTemplateTestCase : public TestCase
{
public:
TimerTemplateTestCase ();
virtual void DoRun (void);
virtual void DoTeardown (void);
void bazi (int)
{
}
void baz2i (int, int)
{
}
void baz3i (int, int, int)
{
}
void baz4i (int, int, int, int)
{
}
void baz5i (int, int, int, int, int)
{
}
void baz6i (int, int, int, int, int, int)
{
}
void bazcir (const int&)
{
}
void bazir (int&)
{
}
void bazip (int *)
{
}
void bazcip (const int *)
{
}
};
TimerTemplateTestCase::TimerTemplateTestCase ()
: TestCase ("Check that template magic is working")
{
}
void
TimerTemplateTestCase::DoRun (void)
{
Timer timer = Timer (Timer::CANCEL_ON_DESTROY);
int a = 0;
int &b = a;
const int &c = a;
timer.SetFunction (&bari);
timer.SetArguments (2);
timer.SetArguments (a);
timer.SetArguments (b);
timer.SetArguments (c);
timer.SetFunction (&barir);
timer.SetArguments (2);
timer.SetArguments (a);
timer.SetArguments (b);
timer.SetArguments (c);
timer.SetFunction (&barcir);
timer.SetArguments (2);
timer.SetArguments (a);
timer.SetArguments (b);
timer.SetArguments (c);
// the following call cannot possibly work and is flagged by
// a runtime error.
// timer.SetArguments (0.0);
timer.SetDelay (Seconds (1.0));
timer.Schedule ();
timer.SetFunction (&TimerTemplateTestCase::bazi, this);
timer.SetArguments (3);
timer.SetFunction (&TimerTemplateTestCase::bazir, this);
timer.SetArguments (3);
timer.SetFunction (&TimerTemplateTestCase::bazcir, this);
timer.SetArguments (3);
timer.SetFunction (&bar2i);
timer.SetArguments (1, 1);
timer.SetFunction (&bar3i);
timer.SetArguments (1, 1, 1);
timer.SetFunction (&bar4i);
timer.SetArguments (1, 1, 1, 1);
timer.SetFunction (&bar5i);
timer.SetArguments (1, 1, 1, 1, 1);
// unsupported in simulator class
// timer.SetFunction (&bar6i);
// timer.SetArguments (1, 1, 1, 1, 1, 1);
timer.SetFunction (&TimerTemplateTestCase::baz2i, this);
timer.SetArguments (1, 1);
timer.SetFunction (&TimerTemplateTestCase::baz3i, this);
timer.SetArguments (1, 1, 1);
timer.SetFunction (&TimerTemplateTestCase::baz4i, this);
timer.SetArguments (1, 1, 1, 1);
timer.SetFunction (&TimerTemplateTestCase::baz5i, this);
timer.SetArguments (1, 1, 1, 1, 1);
// unsupported in simulator class
// timer.SetFunction (&TimerTemplateTestCase::baz6i, this);
// timer.SetArguments (1, 1, 1, 1, 1, 1);
Simulator::Run ();
Simulator::Destroy ();
}
void
TimerTemplateTestCase::DoTeardown (void)
{
Simulator::Run ();
Simulator::Destroy ();
}
static class TimerTestSuite : public TestSuite
{
public:
TimerTestSuite ()
: TestSuite ("timer", UNIT)
{
AddTestCase (new TimerStateTestCase ());
AddTestCase (new TimerTemplateTestCase ());
}
} g_timerTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/timer-test-suite.cc | C++ | gpl2 | 5,801 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/test.h"
#include "ns3/object.h"
#include "ns3/boolean.h"
#include "ns3/integer.h"
#include "ns3/uinteger.h"
#include "ns3/config.h"
#include "ns3/enum.h"
#include "ns3/string.h"
#include "ns3/random-variable.h"
#include "ns3/double.h"
#include "ns3/object-vector.h"
#include "ns3/traced-value.h"
#include "ns3/callback.h"
#include "ns3/trace-source-accessor.h"
#include "ns3/pointer.h"
namespace ns3 {
class ValueClassTest
{
public:
ValueClassTest () {}
private:
int m_v;
};
bool operator != (const ValueClassTest &a, const ValueClassTest &b)
{
return true;
}
std::ostream & operator << (std::ostream &os, ValueClassTest v)
{
return os;
}
std::istream & operator >> (std::istream &is, ValueClassTest &v)
{
return is;
}
ATTRIBUTE_HELPER_HEADER (ValueClassTest);
ATTRIBUTE_HELPER_CPP (ValueClassTest);
class Derived : public Object
{
public:
static TypeId GetTypeId (void) {
static TypeId tid = TypeId ("ns3::Derived")
.SetParent<Object> ()
;
return tid;
}
};
class AttributeObjectTest : public Object
{
public:
enum Test_e {
TEST_A,
TEST_B,
TEST_C
};
static TypeId GetTypeId (void) {
static TypeId tid = TypeId ("ns3::AttributeObjectTest")
.SetParent<Object> ()
.HideFromDocumentation ()
.AddAttribute ("TestBoolName", "help text",
BooleanValue (false),
MakeBooleanAccessor (&AttributeObjectTest::m_boolTest),
MakeBooleanChecker ())
.AddAttribute ("TestBoolA", "help text",
BooleanValue (false),
MakeBooleanAccessor (&AttributeObjectTest::DoSetTestB,
&AttributeObjectTest::DoGetTestB),
MakeBooleanChecker ())
.AddAttribute ("TestInt16", "help text",
IntegerValue (-2),
MakeIntegerAccessor (&AttributeObjectTest::m_int16),
MakeIntegerChecker<int16_t> ())
.AddAttribute ("TestInt16WithBounds", "help text",
IntegerValue (-2),
MakeIntegerAccessor (&AttributeObjectTest::m_int16WithBounds),
MakeIntegerChecker<int16_t> (-5, 10))
.AddAttribute ("TestInt16SetGet", "help text",
IntegerValue (6),
MakeIntegerAccessor (&AttributeObjectTest::DoSetInt16,
&AttributeObjectTest::DoGetInt16),
MakeIntegerChecker<int16_t> ())
.AddAttribute ("TestUint8", "help text",
UintegerValue (1),
MakeUintegerAccessor (&AttributeObjectTest::m_uint8),
MakeUintegerChecker<uint8_t> ())
.AddAttribute ("TestEnum", "help text",
EnumValue (TEST_A),
MakeEnumAccessor (&AttributeObjectTest::m_enum),
MakeEnumChecker (TEST_A, "TestA",
TEST_B, "TestB",
TEST_C, "TestC"))
.AddAttribute ("TestRandom", "help text",
RandomVariableValue (ConstantVariable (1.0)),
MakeRandomVariableAccessor (&AttributeObjectTest::m_random),
MakeRandomVariableChecker ())
.AddAttribute ("TestFloat", "help text",
DoubleValue (-1.1),
MakeDoubleAccessor (&AttributeObjectTest::m_float),
MakeDoubleChecker<float> ())
.AddAttribute ("TestVector1", "help text",
ObjectVectorValue (),
MakeObjectVectorAccessor (&AttributeObjectTest::m_vector1),
MakeObjectVectorChecker<Derived> ())
.AddAttribute ("TestVector2", "help text",
ObjectVectorValue (),
MakeObjectVectorAccessor (&AttributeObjectTest::DoGetVectorN,
&AttributeObjectTest::DoGetVector),
MakeObjectVectorChecker<Derived> ())
.AddAttribute ("IntegerTraceSource1", "help text",
IntegerValue (-2),
MakeIntegerAccessor (&AttributeObjectTest::m_intSrc1),
MakeIntegerChecker<int8_t> ())
.AddAttribute ("IntegerTraceSource2", "help text",
IntegerValue (-2),
MakeIntegerAccessor (&AttributeObjectTest::DoSetIntSrc,
&AttributeObjectTest::DoGetIntSrc),
MakeIntegerChecker<int8_t> ())
.AddAttribute ("UIntegerTraceSource", "help text",
UintegerValue (2),
MakeUintegerAccessor (&AttributeObjectTest::m_uintSrc),
MakeIntegerChecker<uint8_t> ())
.AddAttribute ("DoubleTraceSource", "help text",
DoubleValue (2),
MakeDoubleAccessor (&AttributeObjectTest::m_doubleSrc),
MakeDoubleChecker<double> ())
.AddAttribute ("BoolTraceSource", "help text",
BooleanValue (false),
MakeBooleanAccessor (&AttributeObjectTest::m_boolSrc),
MakeBooleanChecker ())
.AddAttribute ("EnumTraceSource", "help text",
EnumValue (false),
MakeEnumAccessor (&AttributeObjectTest::m_enumSrc),
MakeEnumChecker (TEST_A, "TestA"))
.AddAttribute ("ValueClassSource", "help text",
ValueClassTestValue (ValueClassTest ()),
MakeValueClassTestAccessor (&AttributeObjectTest::m_valueSrc),
MakeValueClassTestChecker ())
.AddTraceSource ("Source1", "help test",
MakeTraceSourceAccessor (&AttributeObjectTest::m_intSrc1))
.AddTraceSource ("Source2", "help text",
MakeTraceSourceAccessor (&AttributeObjectTest::m_cb))
.AddTraceSource ("ValueSource", "help text",
MakeTraceSourceAccessor (&AttributeObjectTest::m_valueSrc))
.AddAttribute ("Pointer", "help text",
PointerValue (),
MakePointerAccessor (&AttributeObjectTest::m_ptr),
MakePointerChecker<Derived> ())
.AddAttribute ("Callback", "help text",
CallbackValue (),
MakeCallbackAccessor (&AttributeObjectTest::m_cbValue),
MakeCallbackChecker ())
;
return tid;
}
void AddToVector1 (void) { m_vector1.push_back (CreateObject<Derived> ()); }
void AddToVector2 (void) { m_vector2.push_back (CreateObject<Derived> ()); }
void InvokeCb (double a, int b, float c) { m_cb (a,b,c); }
void InvokeCbValue (int8_t a)
{
if (!m_cbValue.IsNull ()) {
m_cbValue (a);
}
}
private:
void DoSetTestB (bool v) { m_boolTestA = v; }
bool DoGetTestB (void) const { return m_boolTestA; }
int16_t DoGetInt16 (void) const { return m_int16SetGet; }
void DoSetInt16 (int16_t v) { m_int16SetGet = v; }
uint32_t DoGetVectorN (void) const { return m_vector2.size (); }
Ptr<Derived> DoGetVector (uint32_t i) const { return m_vector2[i]; }
bool DoSetIntSrc (int8_t v) { m_intSrc2 = v; return true; }
int8_t DoGetIntSrc (void) const { return m_intSrc2; }
bool m_boolTestA;
bool m_boolTest;
int16_t m_int16;
int16_t m_int16WithBounds;
int16_t m_int16SetGet;
uint8_t m_uint8;
float m_float;
enum Test_e m_enum;
RandomVariable m_random;
std::vector<Ptr<Derived> > m_vector1;
std::vector<Ptr<Derived> > m_vector2;
Callback<void,int8_t> m_cbValue;
TracedValue<int8_t> m_intSrc1;
TracedValue<int8_t> m_intSrc2;
TracedCallback<double, int, float> m_cb;
TracedValue<ValueClassTest> m_valueSrc;
Ptr<Derived> m_ptr;
TracedValue<uint8_t> m_uintSrc;
TracedValue<enum Test_e> m_enumSrc;
TracedValue<double> m_doubleSrc;
TracedValue<bool> m_boolSrc;
};
NS_OBJECT_ENSURE_REGISTERED (AttributeObjectTest);
// ===========================================================================
// Test case template used for generic Attribute Value types -- used to make
// sure that Attributes work as expected.
// ===========================================================================
template <typename T>
class AttributeTestCase : public TestCase
{
public:
AttributeTestCase (std::string description);
virtual ~AttributeTestCase ();
private:
virtual void DoRun (void);
bool CheckGetCodePaths (Ptr<Object> p, std::string attributeName, std::string expectedString, T expectedValue);
};
template <typename T>
AttributeTestCase<T>::AttributeTestCase (std::string description)
: TestCase (description)
{
}
template <typename T>
AttributeTestCase<T>::~AttributeTestCase ()
{
}
template <typename T> bool
AttributeTestCase<T>::CheckGetCodePaths (
Ptr<Object> p,
std::string attributeName,
std::string expectedString,
T expectedValue)
{
StringValue stringValue;
T actualValue;
//
// Get an Attribute value through its StringValue representation.
//
bool ok1 = p->GetAttributeFailSafe (attributeName.c_str (), stringValue);
bool ok2 = stringValue.Get () == expectedString;
//
// Get the existing boolean value through its particular type representation.
//
bool ok3 = p->GetAttributeFailSafe (attributeName.c_str (), actualValue);
bool ok4 = expectedValue.Get () == actualValue.Get ();
return ok1 && ok2 && ok3 && ok4;
}
// ===========================================================================
// The actual Attribute type test cases are specialized for each Attribute type
// ===========================================================================
template <> void
AttributeTestCase<BooleanValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// Set the default value of the BooleanValue and create an object. The new
// default value should stick.
//
Config::SetDefault ("ns3::AttributeObjectTest::TestBoolName", StringValue ("true"));
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
ok = CheckGetCodePaths (p, "TestBoolName", "true", BooleanValue (true));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by default value");
//
// Set the default value of the BooleanValue the other way and create an object.
// The new default value should stick.
//
Config::SetDefaultFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("false"));
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
ok = CheckGetCodePaths (p, "TestBoolName", "false", BooleanValue (false));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not et properly by default value");
//
// Set the BooleanValue Attribute to true via SetAttributeFailSafe path.
//
ok = p->SetAttributeFailSafe ("TestBoolName", StringValue ("true"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() \"TestBoolName\" to true");
ok = CheckGetCodePaths (p, "TestBoolName", "true", BooleanValue (true));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Set the BooleanValue to false via SetAttributeFailSafe path.
//
ok = p->SetAttributeFailSafe ("TestBoolName", StringValue ("false"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() \"TestBoolName\" to false");
ok = CheckGetCodePaths (p, "TestBoolName", "false", BooleanValue (false));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Create an object using
//
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// The previous object-based tests checked access directly. Now check through
// setter and getter. The code here looks the same, but the underlying
// attribute is declared differently in the object. First make sure we can set
// to true.
//
ok = p->SetAttributeFailSafe ("TestBoolA", StringValue ("true"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a boolean value to true");
ok = CheckGetCodePaths (p, "TestBoolA", "true", BooleanValue (true));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (getter/setter) via StringValue");
//
// Now Set the BooleanValue to false via the setter.
//
ok = p->SetAttributeFailSafe ("TestBoolA", StringValue ("false"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a boolean value to false");
ok = CheckGetCodePaths (p, "TestBoolA", "false", BooleanValue (false));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (getter/setter) via StringValue");
}
template <> void
AttributeTestCase<IntegerValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// When the object is first created, the Attribute should have the default
// value.
//
ok = CheckGetCodePaths (p, "TestInt16", "-2", IntegerValue (-2));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by default value");
//
// Set the Attribute to a negative value through a StringValue.
//
ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("-5"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to -5");
ok = CheckGetCodePaths (p, "TestInt16", "-5", IntegerValue (-5));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Set the Attribute to a positive value through a StringValue.
//
ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("+2"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to +2");
ok = CheckGetCodePaths (p, "TestInt16", "2", IntegerValue (2));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Set the Attribute to the most negative value of the signed 16-bit range.
//
ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("-32768"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to -32768");
ok = CheckGetCodePaths (p, "TestInt16", "-32768", IntegerValue (-32768));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (most negative) via StringValue");
//
// Try to set the Attribute past the most negative value of the signed 16-bit
// range and make sure the underlying attribute is unchanged.
//
ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("-32769"));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to -32769");
ok = CheckGetCodePaths (p, "TestInt16", "-32768", IntegerValue (-32768));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
//
// Set the Attribute to the most positive value of the signed 16-bit range.
//
ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("32767"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to 32767");
ok = CheckGetCodePaths (p, "TestInt16", "32767", IntegerValue (32767));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (most positive) via StringValue");
//
// Try to set the Attribute past the most positive value of the signed 16-bit
// range and make sure the underlying attribute is unchanged.
//
ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("32768"));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to 32768");
ok = CheckGetCodePaths (p, "TestInt16", "32767", IntegerValue (32767));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
//
// Attributes can have limits other than the intrinsic limits of the
// underlying data types. These limits are specified in the Object.
//
ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (10));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 10");
ok = CheckGetCodePaths (p, "TestInt16WithBounds", "10", IntegerValue (10));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (positive limit) via StringValue");
//
// Set the Attribute past the positive limit.
//
ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (11));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to 11");
ok = CheckGetCodePaths (p, "TestInt16WithBounds", "10", IntegerValue (10));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
//
// Set the Attribute at the negative limit.
//
ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (-5));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -5");
ok = CheckGetCodePaths (p, "TestInt16WithBounds", "-5", IntegerValue (-5));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (negative limit) via StringValue");
//
// Set the Attribute past the negative limit.
//
ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (-6));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -6");
ok = CheckGetCodePaths (p, "TestInt16WithBounds", "-5", IntegerValue (-5));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
}
template <> void
AttributeTestCase<UintegerValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// When the object is first created, the Attribute should have the default
// value.
//
ok = CheckGetCodePaths (p, "TestUint8", "1", UintegerValue (1));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by default value");;
//
// Set the Attribute to zero.
//
ok = p->SetAttributeFailSafe ("TestUint8", UintegerValue (0));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to 0");
ok = CheckGetCodePaths (p, "TestUint8", "0", UintegerValue (0));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Set the Attribute to the most positive value of the unsigned 8-bit range.
//
ok = p->SetAttributeFailSafe ("TestUint8", UintegerValue (255));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to 255");
ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() (positive limit) via UintegerValue");
//
// Try and set the Attribute past the most positive value of the unsigned
// 8-bit range.
//
ok = p->SetAttributeFailSafe ("TestUint8", UintegerValue (256));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() to 256");
ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
//
// Set the Attribute to the most positive value of the unsigned 8-bit range
// through a StringValue.
//
ok = p->SetAttributeFailSafe ("TestUint8", StringValue ("255"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to 255");
ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Try and set the Attribute past the most positive value of the unsigned
// 8-bit range through a StringValue.
//
ok = p->SetAttributeFailSafe ("TestUint8", StringValue ("256"));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to 256");
ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
//
// Try to set the Attribute to a negative StringValue.
//
ok = p->SetAttributeFailSafe ("TestUint8", StringValue ("-1"));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to -1");
}
template <> void
AttributeTestCase<DoubleValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// When the object is first created, the Attribute should have the default
// value.
//
ok = CheckGetCodePaths (p, "TestFloat", "-1.1", DoubleValue ((float)-1.1));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by default value");
//
// Set the Attribute.
//
ok = p->SetAttributeFailSafe ("TestFloat", DoubleValue ((float)2.3));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to 2.3");
ok = CheckGetCodePaths (p, "TestFloat", "2.3", DoubleValue ((float)2.3));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via DoubleValue");
}
template <> void
AttributeTestCase<EnumValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// When the object is first created, the Attribute should have the default
// value.
//
ok = CheckGetCodePaths (p, "TestEnum", "TestA", EnumValue (AttributeObjectTest::TEST_A));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by default value");
//
// Set the Attribute using the EnumValue type.
//
ok = p->SetAttributeFailSafe ("TestEnum", EnumValue (AttributeObjectTest::TEST_C));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to TEST_C");
ok = CheckGetCodePaths (p, "TestEnum", "TestC", EnumValue (AttributeObjectTest::TEST_C));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via EnumValue");
//
// Set the Attribute using the StringValue type.
//
ok = p->SetAttributeFailSafe ("TestEnum", StringValue ("TestB"));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to TEST_B");
ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Attribute not set properly by SetAttributeFailSafe() via StringValue");
//
// Try to set the Attribute to a bogus enum using the StringValue type and
// make sure the underlying value doesn't change.
//
ok = p->SetAttributeFailSafe ("TestEnum", StringValue ("TestD"));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() to TEST_D"); //
ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
//
// Try to set the Attribute to a bogus enum using an integer implicit conversion
// and make sure the underlying value doesn't change.
//
ok = p->SetAttributeFailSafe ("TestEnum", EnumValue (5));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() to 5");
ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Error in SetAttributeFailSafe() but value changes");
}
template <> void
AttributeTestCase<RandomVariableValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// Try to set a UniformVariable
//
ok = p->SetAttributeFailSafe ("TestRandom", RandomVariableValue (UniformVariable (0., 1.)));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a UniformVariable");
//
// Try to set a <snicker> ConstantVariable
//
ok = p->SetAttributeFailSafe ("TestRandom", RandomVariableValue (ConstantVariable (10.)));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a UniformVariable");
}
// ===========================================================================
// Test case for Object Vector Attributes. Generic nature is pretty much lost
// here, so we just break the class out.
// ===========================================================================
class ObjectVectorAttributeTestCase : public TestCase
{
public:
ObjectVectorAttributeTestCase (std::string description);
virtual ~ObjectVectorAttributeTestCase () {}
private:
virtual void DoRun (void);
};
ObjectVectorAttributeTestCase::ObjectVectorAttributeTestCase (std::string description)
: TestCase (description)
{
}
void
ObjectVectorAttributeTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
ObjectVectorValue vector;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// When the object is first created, the Attribute should have no items in
// the vector.
//
p->GetAttribute ("TestVector1", vector);
NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 0, "Initial count of ObjectVectorValue \"TestVector1\" should be zero");
//
// Adding to the attribute shouldn't affect the value we already have.
//
p->AddToVector1 ();
NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 0, "Initial count of ObjectVectorValue \"TestVector1\" should still be zero");
//
// Getting the attribute again should update the value.
//
p->GetAttribute ("TestVector1", vector);
NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 1, "ObjectVectorValue \"TestVector1\" should be incremented");
//
// Get the Object pointer from the value.
//
Ptr<Object> a = vector.Get (0);
NS_TEST_ASSERT_MSG_NE (a, 0, "Ptr<Object> from VectorValue \"TestVector1\" is zero");
//
// Adding to the attribute shouldn't affect the value we already have.
//
p->AddToVector1 ();
NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 1, "Count of ObjectVectorValue \"TestVector1\" should still be one");
//
// Getting the attribute again should update the value.
//
p->GetAttribute ("TestVector1", vector);
NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 2, "ObjectVectorValue \"TestVector1\" should be incremented");
}
// ===========================================================================
// Trace sources with value semantics can be used like Attributes. Make sure
// we can use them that way.
// ===========================================================================
class IntegerTraceSourceAttributeTestCase : public TestCase
{
public:
IntegerTraceSourceAttributeTestCase (std::string description);
virtual ~IntegerTraceSourceAttributeTestCase () {}
private:
virtual void DoRun (void);
};
IntegerTraceSourceAttributeTestCase::IntegerTraceSourceAttributeTestCase (std::string description)
: TestCase (description)
{
}
void
IntegerTraceSourceAttributeTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
IntegerValue iv;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// When the object is first created, the Attribute should have the default
// value.
//
p->GetAttribute ("IntegerTraceSource1", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -2, "Attribute not set properly by default value");
//
// Set the Attribute to a positive value through an IntegerValue.
//
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (5));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 5");
p->GetAttribute ("IntegerTraceSource1", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 5, "Attribute not set properly by SetAttributeFailSafe() via IntegerValue");
//
// Limits should work.
//
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (127));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 127");
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (128));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to 128");
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-128));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -128");
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-129));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129");
//
// When the object is first created, the Attribute should have the default
// value.
//
p->GetAttribute ("IntegerTraceSource2", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -2, "Attribute not set properly by default value");
//
// Set the Attribute to a positive value through an IntegerValue.
//
ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (5));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 5");
p->GetAttribute ("IntegerTraceSource2", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 5, "Attribute not set properly by SetAttributeFailSafe() via IntegerValue");
//
// Limits should work.
//
ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (127));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 127");
ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (128));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to 128");
ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-128));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -128");
ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-129));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129");
}
// ===========================================================================
// Trace sources used like Attributes must also work as trace sources. Make
// sure we can use them that way.
// ===========================================================================
class IntegerTraceSourceTestCase : public TestCase
{
public:
IntegerTraceSourceTestCase (std::string description);
virtual ~IntegerTraceSourceTestCase () {}
private:
virtual void DoRun (void);
void NotifySource1 (int8_t old, int8_t n) { m_got1 = n; }
int64_t m_got1;
};
IntegerTraceSourceTestCase::IntegerTraceSourceTestCase (std::string description)
: TestCase (description)
{
}
void
IntegerTraceSourceTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// Check to make sure changing an Attibute value triggers a trace callback
// that sets a member variable.
//
m_got1 = 1234;
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-1));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -1");
//
// Source1 is declared as a TraceSourceAccessor to m_intSrc1. This m_intSrc1
// is also declared as an Integer Attribute. We just checked to make sure we
// could set it using an IntegerValue through its IntegerTraceSource1 "persona."
// We should also be able to hook a trace source to the underlying variable.
//
ok = p->TraceConnectWithoutContext ("Source1", MakeCallback (&IntegerTraceSourceTestCase::NotifySource1, this));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not TraceConnectWithoutContext() \"Source1\" to NodifySource1()");
//
// When we set the IntegerValue that now underlies both the Integer Attribute
// and the trace source, the trace should fire and call NotifySource1 which
// will set m_got1 to the new value.
//
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (0));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 0");
NS_TEST_ASSERT_MSG_EQ (m_got1, 0, "Hitting a TracedValue does not cause trace callback to be called");
//
// Now disconnect from the trace source and ensure that the trace callback
// is not called if the trace source is hit.
//
ok = p->TraceDisconnectWithoutContext ("Source1", MakeCallback (&IntegerTraceSourceTestCase::NotifySource1, this));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not TraceConnectWithoutContext() \"Source1\" to NodifySource1()");
ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (1));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 1");
NS_TEST_ASSERT_MSG_EQ (m_got1, 0, "Hitting a TracedValue after disconnect still causes callback");
}
// ===========================================================================
// Trace sources used like Attributes must also work as trace sources. Make
// sure we can use them that way.
// ===========================================================================
class TracedCallbackTestCase : public TestCase
{
public:
TracedCallbackTestCase (std::string description);
virtual ~TracedCallbackTestCase () {}
private:
virtual void DoRun (void);
void NotifySource2 (double a, int b, float c) { m_got2 = a; }
double m_got2;
};
TracedCallbackTestCase::TracedCallbackTestCase (std::string description)
: TestCase (description)
{
}
void
TracedCallbackTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// Initialize the
//
m_got2 = 4.3;
//
// Invoke the callback that lies at the heart of this test. We have a
// method InvokeCb() that just executes m_cb(). The variable m_cb is
// declared as a TracedCallback<double, int, float>. This kind of beast
// is like a callback but can call a list of targets. This list should
// be empty so nothing should happen now. Specifically, m_got2 shouldn't
// have changed.
//
p->InvokeCb (1.0, -5, 0.0);
NS_TEST_ASSERT_MSG_EQ (m_got2, 4.3, "Invoking a newly created TracedCallback results in an unexpected callback");
//
// Now, wire the TracedCallback up to a trace sink. This sink will just set
// m_got2 to the first argument.
//
ok = p->TraceConnectWithoutContext ("Source2", MakeCallback (&TracedCallbackTestCase::NotifySource2, this));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not TraceConnectWithoutContext() to NotifySource2");
//
// Now if we invoke the callback, the trace source should fire and m_got2
// should be set in the trace sink.
//
p->InvokeCb (1.0, -5, 0.0);
NS_TEST_ASSERT_MSG_EQ (m_got2, 1.0, "Invoking TracedCallback does not result in trace callback");
//
// Now, disconnect the trace sink and see what happens when we invoke the
// callback again. Of course, the trace should not happen and m_got2
// should remain unchanged.
//
ok = p->TraceDisconnectWithoutContext ("Source2", MakeCallback (&TracedCallbackTestCase::NotifySource2, this));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not TraceDisconnectWithoutContext() from NotifySource2");
p->InvokeCb (-1.0, -5, 0.0);
NS_TEST_ASSERT_MSG_EQ (m_got2, 1.0, "Invoking disconnected TracedCallback unexpectedly results in trace callback");
}
// ===========================================================================
// Smart pointers (Ptr) are central to our architecture, so they must work as
// attributes.
// ===========================================================================
class PointerAttributeTestCase : public TestCase
{
public:
PointerAttributeTestCase (std::string description);
virtual ~PointerAttributeTestCase () {}
private:
virtual void DoRun (void);
void NotifySource2 (double a, int b, float c) { m_got2 = a; }
double m_got2;
};
PointerAttributeTestCase::PointerAttributeTestCase (std::string description)
: TestCase (description)
{
}
void
PointerAttributeTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// We have declared a PointerValue Attribute named "Pointer" with a pointer
// checker of type Derived. This means that we should be able to pull out
// a Ptr<Derived> with the initial value (which is 0).
//
PointerValue ptr;
p->GetAttribute ("Pointer", ptr);
Ptr<Derived> derived = ptr.Get<Derived> ();
NS_TEST_ASSERT_MSG_EQ (derived, 0, "Unexpectedly found non-null pointer in newly initialized PointerValue Attribute");
//
// Now, lets create an Object of type Derived and set the local Ptr to point
// to that object. We can then set the PointerValue Attribute to that Ptr.
//
derived = Create<Derived> ();
ok = p->SetAttributeFailSafe ("Pointer", PointerValue (derived));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a PointerValue of the correct type");
//
// Pull the value back out of the Attribute and make sure it points to the
// correct object.
//
p->GetAttribute ("Pointer", ptr);
Ptr<Derived> stored = ptr.Get<Derived> ();
NS_TEST_ASSERT_MSG_EQ (stored, derived, "Retreived Attribute does not match stored PointerValue");
//
// We should be able to use the Attribute Get() just like GetObject<type>,
// So see if we can get a Ptr<Object> out of the Ptr<Derived> we stored.
// This should be a pointer to the same physical memory since its the
// same object.
//
p->GetAttribute ("Pointer", ptr);
Ptr<Object> storedBase = ptr.Get<Object> ();
NS_TEST_ASSERT_MSG_EQ (storedBase, stored, "Retreived Ptr<Object> does not match stored Ptr<Derived>");
//
// If we try to Get() something that is unrelated to what we stored, we should
// retrieve a 0.
//
p->GetAttribute ("Pointer", ptr);
Ptr<AttributeObjectTest> x = ptr.Get<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_EQ (x, 0, "Unexpectedly retreived unrelated Ptr<type> from stored Ptr<Derived>");
}
// ===========================================================================
// Test the Attributes of type CallbackVale.
// ===========================================================================
class CallbackValueTestCase : public TestCase
{
public:
CallbackValueTestCase (std::string description);
virtual ~CallbackValueTestCase () {}
void InvokeCbValue (int8_t a)
{
if (!m_cbValue.IsNull ()) {
m_cbValue (a);
}
}
private:
virtual void DoRun (void);
Callback<void,int8_t> m_cbValue;
void NotifyCallbackValue (int8_t a) { m_gotCbValue = a; }
int16_t m_gotCbValue;
};
CallbackValueTestCase::CallbackValueTestCase (std::string description)
: TestCase (description)
{
}
void
CallbackValueTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
bool ok;
p = CreateObject<AttributeObjectTest> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Unable to CreateObject");
//
// The member variable m_cbValue is declared as a Callback<void, int8_t>. The
// Attibute named "Callback" also points to m_cbValue and allows us to set the
// callback using that Attribute.
//
// NotifyCallbackValue is going to be the target of the callback and will just set
// m_gotCbValue to its single parameter. This will be the parameter from the
// callback invocation. The method InvokeCbValue() just invokes the m_cbValue
// callback if it is non-null.
//
m_gotCbValue = 1;
//
// If we invoke the callback (which has not been set) nothing should happen.
// Further, nothing should happen when we initialize the callback (it shouldn't
// accidentally fire).
//
p->InvokeCbValue (2);
CallbackValue cbValue = MakeCallback (&CallbackValueTestCase::NotifyCallbackValue, this);
NS_TEST_ASSERT_MSG_EQ (m_gotCbValue, 1, "Callback unexpectedly fired");
ok = p->SetAttributeFailSafe ("Callback", cbValue);
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a CallbackValue");
//
// Now that the callback has been set, invoking it should set m_gotCbValue.
//
p->InvokeCbValue (2);
NS_TEST_ASSERT_MSG_EQ (m_gotCbValue, 2, "Callback Attribute set by CallbackValue did not fire");
ok = p->SetAttributeFailSafe ("Callback", CallbackValue (MakeNullCallback<void,int8_t> ()));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a null CallbackValue");
//
// If the callback has been set to a null callback, it should no longer fire.
//
p->InvokeCbValue (3);
NS_TEST_ASSERT_MSG_EQ (m_gotCbValue, 2, "Callback Attribute set to null callback unexpectedly fired");
}
// ===========================================================================
// The Test Suite that glues all of the Test Cases together.
// ===========================================================================
class AttributesTestSuite : public TestSuite
{
public:
AttributesTestSuite ();
};
AttributesTestSuite::AttributesTestSuite ()
: TestSuite ("attributes", UNIT)
{
AddTestCase (new AttributeTestCase<BooleanValue> ("Check Attributes of type BooleanValue"));
AddTestCase (new AttributeTestCase<IntegerValue> ("Check Attributes of type IntegerValue"));
AddTestCase (new AttributeTestCase<UintegerValue> ("Check Attributes of type UintegerValue"));
AddTestCase (new AttributeTestCase<DoubleValue> ("Check Attributes of type DoubleValue"));
AddTestCase (new AttributeTestCase<EnumValue> ("Check Attributes of type EnumValue"));
AddTestCase (new AttributeTestCase<RandomVariableValue> ("Check Attributes of type RandomVariableValue"));
AddTestCase (new ObjectVectorAttributeTestCase ("Check Attributes of type ObjectVectorValue"));
AddTestCase (new IntegerTraceSourceAttributeTestCase ("Ensure TracedValue<uint8_t> can be set like IntegerValue"));
AddTestCase (new IntegerTraceSourceTestCase ("Ensure TracedValue<uint8_t> also works as trace source"));
AddTestCase (new TracedCallbackTestCase ("Ensure TracedCallback<double, int, float> works as trace source"));
AddTestCase (new PointerAttributeTestCase ("Check Attributes of type PointerValue"));
AddTestCase (new CallbackValueTestCase ("Check Attributes of type CallbackValue"));
}
static AttributesTestSuite attributesTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/attribute-test-suite.cc | C++ | gpl2 | 43,517 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/config.h"
#include "ns3/test.h"
#include "ns3/integer.h"
#include "ns3/traced-value.h"
#include "ns3/trace-source-accessor.h"
#include "ns3/callback.h"
#include "ns3/singleton.h"
#include "ns3/object.h"
#include "ns3/object-vector.h"
#include "ns3/names.h"
#include "ns3/pointer.h"
#include "ns3/log.h"
#include <sstream>
namespace ns3 {
// ===========================================================================
// An object with some attributes that we can play with using config.
// ===========================================================================
class ConfigTestObject : public Object
{
public:
static TypeId GetTypeId (void);
void AddNodeA (Ptr<ConfigTestObject> a);
void AddNodeB (Ptr<ConfigTestObject> b);
void SetNodeA (Ptr<ConfigTestObject> a);
void SetNodeB (Ptr<ConfigTestObject> b);
int8_t GetA (void) const;
int8_t GetB (void) const;
private:
std::vector<Ptr<ConfigTestObject> > m_nodesA;
std::vector<Ptr<ConfigTestObject> > m_nodesB;
Ptr<ConfigTestObject> m_nodeA;
Ptr<ConfigTestObject> m_nodeB;
int8_t m_a;
int8_t m_b;
TracedValue<int16_t> m_trace;
};
TypeId
ConfigTestObject::GetTypeId (void)
{
static TypeId tid = TypeId ("ConfigTestObject")
.SetParent<Object> ()
.AddAttribute ("NodesA", "",
ObjectVectorValue (),
MakeObjectVectorAccessor (&ConfigTestObject::m_nodesA),
MakeObjectVectorChecker<ConfigTestObject> ())
.AddAttribute ("NodesB", "",
ObjectVectorValue (),
MakeObjectVectorAccessor (&ConfigTestObject::m_nodesB),
MakeObjectVectorChecker<ConfigTestObject> ())
.AddAttribute ("NodeA", "",
PointerValue (),
MakePointerAccessor (&ConfigTestObject::m_nodeA),
MakePointerChecker<ConfigTestObject> ())
.AddAttribute ("NodeB", "",
PointerValue (),
MakePointerAccessor (&ConfigTestObject::m_nodeB),
MakePointerChecker<ConfigTestObject> ())
.AddAttribute ("A", "",
IntegerValue (10),
MakeIntegerAccessor (&ConfigTestObject::m_a),
MakeIntegerChecker<int8_t> ())
.AddAttribute ("B", "",
IntegerValue (9),
MakeIntegerAccessor (&ConfigTestObject::m_b),
MakeIntegerChecker<int8_t> ())
.AddAttribute ("Source", "XX",
IntegerValue (-1),
MakeIntegerAccessor (&ConfigTestObject::m_trace),
MakeIntegerChecker<int16_t> ())
.AddTraceSource ("Source", "XX",
MakeTraceSourceAccessor (&ConfigTestObject::m_trace))
;
return tid;
}
void
ConfigTestObject::SetNodeA (Ptr<ConfigTestObject> a)
{
m_nodeA = a;
}
void
ConfigTestObject::SetNodeB (Ptr<ConfigTestObject> b)
{
m_nodeB = b;
}
void
ConfigTestObject::AddNodeA (Ptr<ConfigTestObject> a)
{
m_nodesA.push_back (a);
}
void
ConfigTestObject::AddNodeB (Ptr<ConfigTestObject> b)
{
m_nodesB.push_back (b);
}
int8_t
ConfigTestObject::GetA (void) const
{
return m_a;
}
int8_t
ConfigTestObject::GetB (void) const
{
return m_b;
}
// ===========================================================================
// Test for the ability to register and use a root namespace
// ===========================================================================
class RootNamespaceConfigTestCase : public TestCase
{
public:
RootNamespaceConfigTestCase ();
virtual ~RootNamespaceConfigTestCase () {}
private:
virtual void DoRun (void);
};
RootNamespaceConfigTestCase::RootNamespaceConfigTestCase ()
: TestCase ("Check ability to register a root namespace and use it")
{
}
void
RootNamespaceConfigTestCase::DoRun (void)
{
IntegerValue iv;
//
// Create an object and register its attributes directly in the root
// namespace.
//
Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
Config::RegisterRootNamespaceObject (root);
//
// We should find the default values there.
//
root->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
//
// Now use the config mechanism to set the attribute; and we should find the
// new value.
//
Config::Set ("/A", IntegerValue (1));
root->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
//
// We should find the default values of "B" too.
//
root->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
//
// Now use the config mechanism to set the attribute; and we should find the
// new value.
//
Config::Set ("/B", IntegerValue (-1));
root->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
}
// ===========================================================================
// Test for the ability to add an object under the root namespace.
// ===========================================================================
class UnderRootNamespaceConfigTestCase : public TestCase
{
public:
UnderRootNamespaceConfigTestCase ();
virtual ~UnderRootNamespaceConfigTestCase () {}
private:
virtual void DoRun (void);
};
UnderRootNamespaceConfigTestCase::UnderRootNamespaceConfigTestCase ()
: TestCase ("Check ability to register an object under the root namespace and use it")
{
}
void
UnderRootNamespaceConfigTestCase::DoRun (void)
{
IntegerValue iv;
//
// Create an object and register its attributes directly in the root
// namespace.
//
Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
Config::RegisterRootNamespaceObject (root);
Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
root->SetNodeA (a);
//
// We should find the default values there.
//
a->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
//
// Now use the config mechanism to set the attribute; and we should find the
// new value.
//
Config::Set ("/NodeA/A", IntegerValue (1));
a->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
//
// We should find the default values of "B" too.
//
a->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
//
// Now use the config mechanism to set the attribute; and we should find the
// new value.
//
Config::Set ("/NodeA/B", IntegerValue (-1));
a->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
//
// Try and set through a nonexistent path. Should do nothing.
//
Config::Set ("/NodeB/A", IntegerValue (1234));
a->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" unexpectedly set via bad path");
Config::Set ("/NodeB/B", IntegerValue (1234));
a->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" unexpectedly set via bad path");
//
// Step down one level of recursion and try again
//
Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
//
// We should find the default values there.
//
b->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
b->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
//
// Now tell A that it has a B; and we should be able to set this new object's
// Attributes.
//
a->SetNodeB (b);
Config::Set ("/NodeA/NodeB/A", IntegerValue (4));
Config::Set ("/NodeA/NodeB/B", IntegerValue (-4));
b->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set as expected");
b->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -4, "Object Attribute \"B\" not set as expected");
}
// ===========================================================================
// Test for the ability to deal configure with vectors of objects.
// ===========================================================================
class ObjectVectorConfigTestCase : public TestCase
{
public:
ObjectVectorConfigTestCase ();
virtual ~ObjectVectorConfigTestCase () {}
private:
virtual void DoRun (void);
};
ObjectVectorConfigTestCase::ObjectVectorConfigTestCase ()
: TestCase ("Check ability to configure vectors of Object using regular expressions")
{
}
void
ObjectVectorConfigTestCase::DoRun (void)
{
IntegerValue iv;
//
// Create a root namespace object
//
Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
Config::RegisterRootNamespaceObject (root);
//
// Create an object under the root.
//
Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
root->SetNodeA (a);
//
// Create an object one level down.
//
Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
a->SetNodeB (b);
//
// Add four objects to the ObjectVector Attribute at the bottom of the
// object hierarchy. By this point, we believe that the Attributes
// will be initialized correctly.
//
Ptr<ConfigTestObject> obj0 = CreateObject<ConfigTestObject> ();
Ptr<ConfigTestObject> obj1 = CreateObject<ConfigTestObject> ();
Ptr<ConfigTestObject> obj2 = CreateObject<ConfigTestObject> ();
Ptr<ConfigTestObject> obj3 = CreateObject<ConfigTestObject> ();
b->AddNodeB (obj0);
b->AddNodeB (obj1);
b->AddNodeB (obj2);
b->AddNodeB (obj3);
//
// Set an Attribute of the zeroth Object in the vector by explicitly writing
// the '0' and make sure that only the one thing changed.
//
Config::Set ("/NodeA/NodeB/NodesB/0/A", IntegerValue (-11));
obj0->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -11, "Object Attribute \"A\" not set as expected");
obj1->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
obj2->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
//
// Start using regular expression-like syntax to set Attributes. First try
// the OR syntax. Make sure that the two objects changed and nothing else
//
Config::Set ("/NodeA/NodeB/NodesB/0|1/A", IntegerValue (-12));
obj0->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -12, "Object Attribute \"A\" not set as expected");
obj1->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -12, "Object Attribute \"A\" not set as expected");
obj2->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
//
// Make sure that extra '|' are allowed at the start and end of the regular expression
//
Config::Set ("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue (-13));
obj0->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -13, "Object Attribute \"A\" not set as expected");
obj1->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -13, "Object Attribute \"A\" not set as expected");
obj2->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
//
// Try the [x-y] syntax
//
Config::Set ("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue (-14));
obj0->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
obj1->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
obj2->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
//
// Try the [x-y] syntax at the other limit
//
Config::Set ("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue (-15));
obj0->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" unexpectedly set");
obj1->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
obj2->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
//
// Combine the [x-y] syntax and the OR sntax
//
Config::Set ("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue (-16));
obj0->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
obj1->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
obj2->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" unexpectedly set");
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
}
// ===========================================================================
// Test for the ability to trace configure with vectors of objects.
// ===========================================================================
class ObjectVectorTraceConfigTestCase : public TestCase
{
public:
ObjectVectorTraceConfigTestCase ();
virtual ~ObjectVectorTraceConfigTestCase () {}
void Trace (int16_t oldValue, int16_t newValue) { m_newValue = newValue; }
void TraceWithPath (std::string path, int16_t old, int16_t newValue) { m_newValue = newValue; m_path = path; }
private:
virtual void DoRun (void);
int16_t m_newValue;
std::string m_path;
};
ObjectVectorTraceConfigTestCase::ObjectVectorTraceConfigTestCase ()
: TestCase ("Check ability to trace connect through vectors of Object using regular expressions")
{
}
void
ObjectVectorTraceConfigTestCase::DoRun (void)
{
IntegerValue iv;
//
// Create a root namespace object
//
Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
Config::RegisterRootNamespaceObject (root);
//
// Create an object under the root.
//
Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
root->SetNodeA (a);
//
// Create an object one level down.
//
Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
a->SetNodeB (b);
//
// Add four objects to the ObjectVector Attribute at the bottom of the
// object hierarchy. By this point, we believe that the Attributes
// will be initialized correctly.
//
Ptr<ConfigTestObject> obj0 = CreateObject<ConfigTestObject> ();
Ptr<ConfigTestObject> obj1 = CreateObject<ConfigTestObject> ();
Ptr<ConfigTestObject> obj2 = CreateObject<ConfigTestObject> ();
Ptr<ConfigTestObject> obj3 = CreateObject<ConfigTestObject> ();
b->AddNodeB (obj0);
b->AddNodeB (obj1);
b->AddNodeB (obj2);
b->AddNodeB (obj3);
//
// Do a trace connect to some of the sources. We already checked parsing of
// the regular expressions, so we'll concentrate on the tracing part of the
// puzzle here.
//
Config::ConnectWithoutContext ("/NodeA/NodeB/NodesB/[0-1]|3/Source",
MakeCallback (&ObjectVectorTraceConfigTestCase::Trace, this));
//
// If we bug the trace source referred to by index '0' above, we should see
// the trace fire.
//
m_newValue = 0;
obj0->SetAttribute ("Source", IntegerValue (-1));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -1, "Trace 0 did not fire as expected");
//
// If we bug the trace source referred to by index '1' above, we should see
// the trace fire.
//
m_newValue = 0;
obj1->SetAttribute ("Source", IntegerValue (-2));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -2, "Trace 1 did not fire as expected");
//
// If we bug the trace source referred to by index '2' which is skipped above,
// we should not see the trace fire.
//
m_newValue = 0;
obj2->SetAttribute ("Source", IntegerValue (-3));
NS_TEST_ASSERT_MSG_EQ (m_newValue, 0, "Trace 2 fired unexpectedly");
//
// If we bug the trace source referred to by index '3' above, we should see
// the trace fire.
//
m_newValue = 0;
obj3->SetAttribute ("Source", IntegerValue (-4));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
//
// Do a trace connect (with context) to some of the sources.
//
Config::Connect ("/NodeA/NodeB/NodesB/[0-1]|3/Source",
MakeCallback (&ObjectVectorTraceConfigTestCase::TraceWithPath, this));
//
// If we bug the trace source referred to by index '0' above, we should see
// the trace fire with the expected context path.
//
m_newValue = 0;
m_path = "";
obj0->SetAttribute ("Source", IntegerValue (-1));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -1, "Trace 0 did not fire as expected");
NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/0/Source", "Trace 0 did not provide expected context");
//
// If we bug the trace source referred to by index '1' above, we should see
// the trace fire with the expected context path.
//
m_newValue = 0;
m_path = "";
obj1->SetAttribute ("Source", IntegerValue (-2));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -2, "Trace 1 did not fire as expected");
NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
//
// If we bug the trace source referred to by index '2' which is skipped above,
// we should not see the trace fire.
//
m_newValue = 0;
m_path = "";
obj2->SetAttribute ("Source", IntegerValue (-3));
NS_TEST_ASSERT_MSG_EQ (m_newValue, 0, "Trace 2 fired unexpectedly");
//
// If we bug the trace source referred to by index '3' above, we should see
// the trace fire with the expected context path.
//
m_newValue = 0;
m_path = "";
obj3->SetAttribute ("Source", IntegerValue (-4));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
}
// ===========================================================================
// The Test Suite that glues all of the Test Cases together.
// ===========================================================================
class ConfigTestSuite : public TestSuite
{
public:
ConfigTestSuite ();
};
ConfigTestSuite::ConfigTestSuite ()
: TestSuite ("config", UNIT)
{
AddTestCase (new RootNamespaceConfigTestCase);
AddTestCase (new UnderRootNamespaceConfigTestCase);
AddTestCase (new ObjectVectorConfigTestCase);
}
static ConfigTestSuite configTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/config-test-suite.cc | C++ | gpl2 | 19,974 |
#! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#
# See test.py for more information.
cpp_examples = [
("main-attribute-value", "True", "True"),
("main-callback", "True", "True"),
("sample-simulator", "True", "True"),
("main-ptr", "True", "True"),
("main-random-variable", "True", "False"),
("sample-random-variable", "True", "True"),
]
# A list of Python examples to run in order to ensure that they remain
# runnable over time. Each tuple in the list contains
#
# (example_name, do_run).
#
# See test.py for more information.
python_examples = [
("sample-simulator.py", "True"),
]
| zy901002-gpsr | src/core/test/examples-to-run.py | Python | gpl2 | 863 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/test.h"
#include "ns3/ptr.h"
namespace ns3 {
class PtrTestCase;
class Base
{
public:
Base ();
virtual ~Base ();
void Ref (void) const;
void Unref (void) const;
private:
mutable uint32_t m_count;
};
class NoCount : public Base
{
public:
NoCount (PtrTestCase *test);
~NoCount ();
void Nothing (void) const;
private:
PtrTestCase *m_test;
};
class PtrTestCase : public TestCase
{
public:
PtrTestCase ();
void DestroyNotify (void);
private:
virtual void DoRun (void);
Ptr<NoCount> CallTest (Ptr<NoCount> p);
Ptr<NoCount> const CallTestConst (Ptr<NoCount> const p);
uint32_t m_nDestroyed;
};
Base::Base ()
: m_count (1)
{
}
Base::~Base ()
{
}
void
Base::Ref (void) const
{
m_count++;
}
void
Base::Unref (void) const
{
m_count--;
if (m_count == 0)
{
delete this;
}
}
NoCount::NoCount (PtrTestCase *test)
: m_test (test)
{
}
NoCount::~NoCount ()
{
m_test->DestroyNotify ();
}
void
NoCount::Nothing () const
{}
PtrTestCase::PtrTestCase (void)
: TestCase ("Sanity checking of Ptr<>")
{
}
void
PtrTestCase::DestroyNotify (void)
{
m_nDestroyed++;
}
Ptr<NoCount>
PtrTestCase::CallTest (Ptr<NoCount> p)
{
return p;
}
Ptr<NoCount> const
PtrTestCase::CallTestConst (Ptr<NoCount> const p)
{
return p;
}
void
PtrTestCase::DoRun (void)
{
m_nDestroyed = false;
{
Ptr<NoCount> p = Create<NoCount> (this);
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p;
p = Create<NoCount> (this);
p = p;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
p1 = Create<NoCount> (this);
Ptr<NoCount> p2 = p1;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
p1 = Create<NoCount> (this);
Ptr<NoCount> p2;
p2 = p1;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
p1 = Create<NoCount> (this);
Ptr<NoCount> p2 = Create<NoCount> (this);
p2 = p1;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 2, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
p1 = Create<NoCount> (this);
Ptr<NoCount> p2;
p2 = Create<NoCount> (this);
p2 = p1;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 2, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
p1 = Create<NoCount> (this);
p1 = Create<NoCount> (this);
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 2, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
{
Ptr<NoCount> p2;
p1 = Create<NoCount> (this);
p2 = Create<NoCount> (this);
p2 = p1;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 2, "XXX");
m_nDestroyed = 0;
{
Ptr<NoCount> p1;
{
Ptr<NoCount> p2;
p1 = Create<NoCount> (this);
p2 = Create<NoCount> (this);
p2 = CallTest (p1);
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 2, "XXX");
{
Ptr<NoCount> p1;
Ptr<NoCount> const p2 = CallTest (p1);
Ptr<NoCount> const p3 = CallTestConst (p1);
Ptr<NoCount> p4 = CallTestConst (p1);
Ptr<NoCount const> p5 = p4;
//p4 = p5; You cannot make a const pointer be a non-const pointer.
// but if you use ConstCast, you can.
p4 = ConstCast<NoCount> (p5);
p5 = p1;
Ptr<NoCount> p;
if (p == 0)
{}
if (p != 0)
{}
if (0 == p)
{}
if (0 != p)
{}
if (p)
{}
if (!p)
{}
}
m_nDestroyed = 0;
{
NoCount *raw;
{
Ptr<NoCount> p = Create<NoCount> (this);
{
Ptr<NoCount const> p1 = p;
}
raw = GetPointer (p);
p = 0;
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 0, "XXX");
delete raw;
}
m_nDestroyed = 0;
{
Ptr<NoCount> p = Create<NoCount> (this);
const NoCount *v1 = PeekPointer (p);
NoCount *v2 = PeekPointer (p);
v1->Nothing ();
v2->Nothing ();
}
NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 1, "XXX");
{
Ptr<Base> p0 = Create<NoCount> (this);
Ptr<NoCount> p1 = Create<NoCount> (this);
NS_TEST_EXPECT_MSG_EQ ((p0 == p1), false, "operator == failed");
NS_TEST_EXPECT_MSG_EQ ((p0 != p1), true, "operator != failed");
}
}
static class PtrTestSuite : public TestSuite
{
public:
PtrTestSuite ()
: TestSuite ("ptr", UNIT)
{
AddTestCase (new PtrTestCase ());
}
} g_ptrTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/ptr-test-suite.cc | C++ | gpl2 | 5,287 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
// An essential include is test.h
#include "ns3/test.h"
// Do not put your test classes in namespace ns3. You may find it useful
// to use the using directive to access the ns3 namespace directly
using namespace ns3;
// This is an example TestCase.
class SampleTestCase1 : public TestCase
{
public:
SampleTestCase1 ();
virtual ~SampleTestCase1 ();
private:
virtual void DoRun (void);
};
// Add some help text to this case to describe what it is intended to test
SampleTestCase1::SampleTestCase1 ()
: TestCase ("Sample test case (does nothing)")
{
}
// This destructor does nothing but we include it as a reminder that
// the test case should clean up after itself
SampleTestCase1::~SampleTestCase1 ()
{
}
//
// This method is the pure virtual method from class TestCase that every
// TestCase must implement
//
void
SampleTestCase1::DoRun (void)
{
// A wide variety of test macros are available in src/core/test.h
NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason");
// Use this one for floating point comparisons
NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance");
}
// The TestSuite class names the TestSuite, identifies what type of TestSuite,
// and enables the TestCases to be run. Typically, only the constructor for
// this class must be defined
//
class SampleTestSuite : public TestSuite
{
public:
SampleTestSuite ();
};
SampleTestSuite::SampleTestSuite ()
: TestSuite ("sample", UNIT)
{
AddTestCase (new SampleTestCase1);
}
// Do not forget to allocate an instance of this TestSuite
static SampleTestSuite sampleTestSuite;
| zy901002-gpsr | src/core/test/sample-test-suite.cc | C++ | gpl2 | 1,696 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* Copyright (c) 2007 Emmanuelle Laprise
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* TimeStep support by Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
*/
#include "ns3/nstime.h"
#include "ns3/test.h"
namespace ns3 {
class TimeSimpleTestCase : public TestCase
{
public:
TimeSimpleTestCase (enum Time::Unit resolution);
private:
virtual void DoSetup (void);
virtual void DoRun (void);
virtual void DoTeardown (void);
enum Time::Unit m_originalResolution;
enum Time::Unit m_resolution;
};
TimeSimpleTestCase::TimeSimpleTestCase (enum Time::Unit resolution)
: TestCase ("Sanity check of common time operations"),
m_resolution (resolution)
{
}
void
TimeSimpleTestCase::DoSetup (void)
{
m_originalResolution = Time::GetResolution ();
}
void
TimeSimpleTestCase::DoRun (void)
{
Time::SetResolution (m_resolution);
NS_TEST_ASSERT_MSG_EQ_TOL (Seconds (1.0).GetSeconds (), 1.0, TimeStep (1).GetSeconds (),
"is 1 really 1 ?");
NS_TEST_ASSERT_MSG_EQ_TOL (Seconds (10.0).GetSeconds (), 10.0, TimeStep (1).GetSeconds (),
"is 10 really 10 ?");
NS_TEST_ASSERT_MSG_EQ (MilliSeconds (1).GetMilliSeconds (), 1,
"is 1ms really 1ms ?");
NS_TEST_ASSERT_MSG_EQ (MicroSeconds (1).GetMicroSeconds (), 1,
"is 1us really 1us ?");
#if 0
Time ns = NanoSeconds (1);
ns.GetNanoSeconds ();
NS_TEST_ASSERT_MSG_EQ (NanoSeconds (1).GetNanoSeconds (), 1,
"is 1ns really 1ns ?");
NS_TEST_ASSERT_MSG_EQ (PicoSeconds (1).GetPicoSeconds (), 1,
"is 1ps really 1ps ?");
NS_TEST_ASSERT_MSG_EQ (FemtoSeconds (1).GetFemtoSeconds (), 1,
"is 1fs really 1fs ?");
#endif
}
void
TimeSimpleTestCase::DoTeardown (void)
{
Time::SetResolution (m_originalResolution);
}
class TimesWithSignsTestCase : public TestCase
{
public:
TimesWithSignsTestCase ();
private:
virtual void DoSetup (void);
virtual void DoRun (void);
virtual void DoTeardown (void);
};
TimesWithSignsTestCase::TimesWithSignsTestCase ()
: TestCase ("Checks times that have plus or minus signs")
{
}
void
TimesWithSignsTestCase::DoSetup (void)
{
}
void
TimesWithSignsTestCase::DoRun (void)
{
Time timePositive ("+1000.0");
Time timePositiveWithUnits ("+1000.0ms");
Time timeNegative ("-1000.0");
Time timeNegativeWithUnits ("-1000.0ms");
NS_TEST_ASSERT_MSG_EQ_TOL (timePositive.GetSeconds (),
+1000.0,
1.0e-8,
"Positive time not parsed correctly.");
NS_TEST_ASSERT_MSG_EQ_TOL (timePositiveWithUnits.GetSeconds (),
+1.0,
1.0e-8,
"Positive time with units not parsed correctly.");
NS_TEST_ASSERT_MSG_EQ_TOL (timeNegative.GetSeconds (),
-1000.0,
1.0e-8,
"Negative time not parsed correctly.");
NS_TEST_ASSERT_MSG_EQ_TOL (timeNegativeWithUnits.GetSeconds (),
-1.0,
1.0e-8,
"Negative time with units not parsed correctly.");
}
void
TimesWithSignsTestCase::DoTeardown (void)
{
}
static class TimeTestSuite : public TestSuite
{
public:
TimeTestSuite ()
: TestSuite ("time", UNIT)
{
AddTestCase (new TimeSimpleTestCase (Time::US));
AddTestCase (new TimesWithSignsTestCase ());
}
} g_timeTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/time-test-suite.cc | C++ | gpl2 | 4,363 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA, Gustavo Carneiro
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Gustavo Carneiro <gjcarneiro@gmail.com>,
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/test.h"
#include "ns3/object.h"
#include "ns3/object-factory.h"
#include "ns3/assert.h"
namespace {
class BaseA : public ns3::Object
{
public:
static ns3::TypeId GetTypeId (void) {
static ns3::TypeId tid = ns3::TypeId ("BaseA")
.SetParent (Object::GetTypeId ())
.HideFromDocumentation ()
.AddConstructor<BaseA> ();
return tid;
}
BaseA ()
{}
virtual void Dispose (void) {}
};
class DerivedA : public BaseA
{
public:
static ns3::TypeId GetTypeId (void) {
static ns3::TypeId tid = ns3::TypeId ("DerivedA")
.SetParent (BaseA::GetTypeId ())
.HideFromDocumentation ()
.AddConstructor<DerivedA> ();
return tid;
}
DerivedA ()
{}
virtual void Dispose (void) {
BaseA::Dispose ();
}
};
class BaseB : public ns3::Object
{
public:
static ns3::TypeId GetTypeId (void) {
static ns3::TypeId tid = ns3::TypeId ("BaseB")
.SetParent (Object::GetTypeId ())
.HideFromDocumentation ()
.AddConstructor<BaseB> ();
return tid;
}
BaseB ()
{}
virtual void Dispose (void) {}
};
class DerivedB : public BaseB
{
public:
static ns3::TypeId GetTypeId (void) {
static ns3::TypeId tid = ns3::TypeId ("DerivedB")
.SetParent (BaseB::GetTypeId ())
.HideFromDocumentation ()
.AddConstructor<DerivedB> ();
return tid;
}
DerivedB ()
{}
virtual void Dispose (void) {
BaseB::Dispose ();
}
};
NS_OBJECT_ENSURE_REGISTERED (BaseA);
NS_OBJECT_ENSURE_REGISTERED (DerivedA);
NS_OBJECT_ENSURE_REGISTERED (BaseB);
NS_OBJECT_ENSURE_REGISTERED (DerivedB);
} // namespace anonymous
namespace ns3 {
// ===========================================================================
// Test case to make sure that we can make Objects using CreateObject.
// ===========================================================================
class CreateObjectTestCase : public TestCase
{
public:
CreateObjectTestCase ();
virtual ~CreateObjectTestCase ();
private:
virtual void DoRun (void);
};
CreateObjectTestCase::CreateObjectTestCase ()
: TestCase ("Check CreateObject<Type> template function")
{
}
CreateObjectTestCase::~CreateObjectTestCase ()
{
}
void
CreateObjectTestCase::DoRun (void)
{
Ptr<BaseA> baseA = CreateObject<BaseA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to CreateObject<BaseA>");
//
// Since baseA is a BaseA, we must be able to successfully ask for a BaseA.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<BaseA> (), baseA, "GetObject() of same type returns different Ptr");
//
// Since BaseA is a BaseA and not a DerivedA, we must not find a DerivedA if we look.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<DerivedA> (), 0, "GetObject() of unrelated type returns nonzero pointer");
//
// Since baseA is not a BaseA, we must not be able to ask for a DerivedA even if we
// try an implied cast back to a BaseA.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), 0, "GetObject() of unrelated returns nonzero Ptr");
baseA = CreateObject<DerivedA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to CreateObject<DerivedA> with implicit cast to BaseA");
//
// If we create a DerivedA and cast it to a BaseA, then if we do a GetObject for
// that BaseA we should get the same address (same Object).
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<BaseA> (), baseA, "Unable to GetObject<BaseA> on BaseA");
//
// Since we created a DerivedA and cast it to a BaseA, we should be able to
// get back a DerivedA and it should be the original Ptr.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<DerivedA> (), baseA, "GetObject() of the original type returns different Ptr");
// If we created a DerivedA and cast it to a BaseA, then we GetObject for the
// same DerivedA and cast it back to the same BaseA, we should get the same
// object.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), baseA, "GetObject returns different Ptr");
}
// ===========================================================================
// Test case to make sure that we can aggregate Objects.
// ===========================================================================
class AggregateObjectTestCase : public TestCase
{
public:
AggregateObjectTestCase ();
virtual ~AggregateObjectTestCase ();
private:
virtual void DoRun (void);
};
AggregateObjectTestCase::AggregateObjectTestCase ()
: TestCase ("Check Object aggregation functionality")
{
}
AggregateObjectTestCase::~AggregateObjectTestCase ()
{
}
void
AggregateObjectTestCase::DoRun (void)
{
Ptr<BaseA> baseA = CreateObject<BaseA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to CreateObject<BaseA>");
Ptr<BaseB> baseB = CreateObject<BaseB> ();
NS_TEST_ASSERT_MSG_NE (baseB, 0, "Unable to CreateObject<BaseB>");
Ptr<BaseB> baseBCopy = baseB;
NS_TEST_ASSERT_MSG_NE (baseBCopy, 0, "Unable to copy BaseB");
//
// Make an aggregation of a BaseA object and a BaseB object.
//
baseA->AggregateObject (baseB);
//
// We should be able to ask the aggregation (through baseA) for the BaseA part
// of the aggregation.
//
NS_TEST_ASSERT_MSG_NE (baseA->GetObject<BaseA> (), 0, "Cannot GetObject (through baseA) for BaseA Object");
//
// There is no DerivedA in this picture, so we should not be able to GetObject
// for that type.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<DerivedA> (), 0, "Unexpectedly found a DerivedA through baseA");
//
// We should be able to ask the aggregation (through baseA) for the BaseB part
//
NS_TEST_ASSERT_MSG_NE (baseA->GetObject<BaseB> (), 0, "Cannot GetObject (through baseA) for BaseB Object");
//
// There is no DerivedB in this picture, so we should not be able to GetObject
// for that type.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<DerivedB> (), 0, "Unexpectedly found a DerivedB through baseA");
//
// We should be able to ask the aggregation (through baseA) for the BaseB part
//
NS_TEST_ASSERT_MSG_NE (baseB->GetObject<BaseB> (), 0, "Cannot GetObject (through baseB) for BaseB Object");
//
// There is no DerivedB in this picture, so we should not be able to GetObject
// for that type.
//
NS_TEST_ASSERT_MSG_EQ (baseB->GetObject<DerivedB> (), 0, "Unexpectedly found a DerivedB through baseB");
//
// We should be able to ask the aggregation (through baseB) for the BaseA part
// of the aggregation.
//
NS_TEST_ASSERT_MSG_NE (baseB->GetObject<BaseA> (), 0, "Cannot GetObject (through baseB) for BaseA Object");
//
// There is no DerivedA in this picture, so we should not be able to GetObject
// for that type.
//
NS_TEST_ASSERT_MSG_EQ (baseB->GetObject<DerivedA> (), 0, "Unexpectedly found a DerivedA through baseB");
//
// baseBCopy is a copy of the original Ptr to the Object BaseB. Even though
// we didn't use baseBCopy directly in the aggregations, the object to which
// it points was used, therefore, we should be able to use baseBCopy as if
// it were baseB and get a BaseA out of the aggregation.
//
NS_TEST_ASSERT_MSG_NE (baseBCopy->GetObject<BaseA> (), 0, "Cannot GetObject (through baseBCopy) for a BaseA Object");
//
// Now, change the underlying type of the objects to be the derived types.
//
baseA = CreateObject<DerivedA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to CreateObject<DerivedA> with implicit cast to BaseA");
baseB = CreateObject<DerivedB> ();
NS_TEST_ASSERT_MSG_NE (baseB, 0, "Unable to CreateObject<DerivedB> with implicit cast to BaseB");
//
// Create an aggregation of two objects, both of the derived types; and leave
// an unaggregated copy of one lying around.
//
baseBCopy = baseB;
baseA->AggregateObject (baseB);
//
// We should be able to ask the aggregation (through baseA) for the DerivedB part
//
NS_TEST_ASSERT_MSG_NE (baseA->GetObject<DerivedB> (), 0, "Cannot GetObject (through baseA) for DerivedB Object");
//
// Since the DerivedB is also a BaseB, we should be able to ask the aggregation
// (through baseA) for the BaseB part
//
NS_TEST_ASSERT_MSG_NE (baseA->GetObject<BaseB> (), 0, "Cannot GetObject (through baseA) for BaseB Object");
//
// We should be able to ask the aggregation (through baseB) for the DerivedA part
//
NS_TEST_ASSERT_MSG_NE (baseB->GetObject<DerivedA> (), 0, "Cannot GetObject (through baseB) for DerivedA Object");
//
// Since the DerivedA is also a BaseA, we should be able to ask the aggregation
// (through baseB) for the BaseA part
//
NS_TEST_ASSERT_MSG_NE (baseB->GetObject<BaseA> (), 0, "Cannot GetObject (through baseB) for BaseA Object");
//
// baseBCopy is a copy of the original Ptr to the Object BaseB. Even though
// we didn't use baseBCopy directly in the aggregations, the object to which
// it points was used, therefore, we should be able to use baseBCopy as if
// it were baseB (same underlying Object) and get a BaseA and a DerivedA out
// of the aggregation through baseBCopy.
//
NS_TEST_ASSERT_MSG_NE (baseBCopy->GetObject<BaseA> (), 0, "Cannot GetObject (through baseBCopy) for a BaseA Object");
NS_TEST_ASSERT_MSG_NE (baseBCopy->GetObject<DerivedA> (), 0, "Cannot GetObject (through baseBCopy) for a BaseA Object");
//
// Since the Ptr<BaseB> is actually a DerivedB, we should be able to ask the
// aggregation (through baseB) for the DerivedB part
//
NS_TEST_ASSERT_MSG_NE (baseB->GetObject<DerivedB> (), 0, "Cannot GetObject (through baseB) for DerivedB Object");
//
// Since the DerivedB was cast to a BaseB, we should be able to ask the
// aggregation (through baseB) for the BaseB part
//
NS_TEST_ASSERT_MSG_NE (baseB->GetObject<BaseB> (), 0, "Cannot GetObject (through baseB) for BaseB Object");
//
// Make sure reference counting works in the aggregate. Create two Objects
// and aggregate them, then release one of them. The aggregation should
// keep a reference to both and the Object we released should still be there.
//
baseA = CreateObject<BaseA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to CreateObject<BaseA>");
baseB = CreateObject<BaseB> ();
NS_TEST_ASSERT_MSG_NE (baseB, 0, "Unable to CreateObject<BaseA>");
baseA->AggregateObject (baseB);
baseA = 0;
baseA = baseB->GetObject<BaseA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to GetObject on released object");
}
// ===========================================================================
// Test case to make sure that an Object factory can create Objects
// ===========================================================================
class ObjectFactoryTestCase : public TestCase
{
public:
ObjectFactoryTestCase ();
virtual ~ObjectFactoryTestCase ();
private:
virtual void DoRun (void);
};
ObjectFactoryTestCase::ObjectFactoryTestCase ()
: TestCase ("Check ObjectFactory functionality")
{
}
ObjectFactoryTestCase::~ObjectFactoryTestCase ()
{
}
void
ObjectFactoryTestCase::DoRun (void)
{
ObjectFactory factory;
//
// Create an Object of type BaseA through an object factory.
//
factory.SetTypeId (BaseA::GetTypeId ());
Ptr<Object> a = factory.Create ();
NS_TEST_ASSERT_MSG_NE (a, 0, "Unable to factory.Create() a BaseA");
//
// What we made should be a BaseA, not have anything to do with a DerivedA
//
NS_TEST_ASSERT_MSG_EQ (a->GetObject<BaseA> (DerivedA::GetTypeId ()), 0, "BaseA is unexpectedly a DerivedA also");
//
// The BaseA we got should not respond to a GetObject for DerivedA
//
NS_TEST_ASSERT_MSG_EQ (a->GetObject<DerivedA> (), 0, "BaseA unexpectedly responds to GetObject for DerivedA");
//
// Now tell the factory to make DerivedA Objects and create one with an
// implied cast back to a BaseA
//
factory.SetTypeId (DerivedA::GetTypeId ());
a = factory.Create ();
//
// Since the DerivedA has a BaseA part, we should be able to use GetObject to
// dynamically cast back to a BaseA.
//
NS_TEST_ASSERT_MSG_EQ (a->GetObject<BaseA> (), a, "Unable to use GetObject as dynamic_cast<BaseA>()");
//
// Since a is already a BaseA and is really a DerivedA, we should be able to
// GetObject for the DerivedA and cast it back to a BaseA getting the same
// value that is there.
//
NS_TEST_ASSERT_MSG_EQ (a->GetObject<BaseA> (DerivedA::GetTypeId ()), a, "GetObject with implied cast returns different Ptr");
//
// Since a declared a BaseA, even if it is really a DerivedA, we should not
// be able to GetOBject for a DerivedA since this would break the type
// declaration.
//
NS_TEST_ASSERT_MSG_NE (a->GetObject<DerivedA> (), 0, "Unexpectedly able to work around C++ type system");
}
// ===========================================================================
// The Test Suite that glues the Test Cases together.
// ===========================================================================
class ObjectTestSuite : public TestSuite
{
public:
ObjectTestSuite ();
};
ObjectTestSuite::ObjectTestSuite ()
: TestSuite ("object", UNIT)
{
AddTestCase (new CreateObjectTestCase);
AddTestCase (new AggregateObjectTestCase);
AddTestCase (new ObjectFactoryTestCase);
}
static ObjectTestSuite objectTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/object-test-suite.cc | C++ | gpl2 | 14,095 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/type-traits.h"
#include "ns3/test.h"
namespace ns3 {
class TypeTraitsTestCase : public TestCase
{
public:
TypeTraitsTestCase ();
virtual ~TypeTraitsTestCase () {}
private:
virtual void DoRun (void);
};
TypeTraitsTestCase::TypeTraitsTestCase (void)
: TestCase ("Check type traits")
{
}
void
TypeTraitsTestCase::DoRun (void)
{
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void)>::IsPointerToMember, 1, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::IsPointerToMember, 1, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int)>::IsPointerToMember, 1, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::IsPointerToMember, 1, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::PointerToMemberTraits::nArgs, 0, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::PointerToMemberTraits::nArgs, 1, "Check");
}
class TypeTraitsTestSuite : public TestSuite
{
public:
TypeTraitsTestSuite ();
};
TypeTraitsTestSuite::TypeTraitsTestSuite ()
: TestSuite ("type-traits", UNIT)
{
AddTestCase (new TypeTraitsTestCase);
}
static TypeTraitsTestSuite typeTraitsTestSuite;
} // namespace ns3
| zy901002-gpsr | src/core/test/type-traits-test-suite.cc | C++ | gpl2 | 2,084 |
# -*- Mode:Python; -*-
# /*
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License version 2 as
# * published by the Free Software Foundation
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# */
# Demonstrate use of ns-3 as a random number generator integrated with
# plotting tools; adapted from Gustavo Carneiro's ns-3 tutorial
import numpy as np
import matplotlib.pyplot as plt
import ns.core
# mu, var = 100, 225
rng = ns.core.NormalVariable(100.0, 225.0)
x = [rng.GetValue() for t in range(10000)]
# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
plt.title('ns-3 histogram')
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
| zy901002-gpsr | src/core/examples/sample-rng-plot.py | Python | gpl2 | 1,246 |
# -*- Mode:Python; -*-
# /*
# * Copyright (c) 2010 INRIA
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License version 2 as
# * published by the Free Software Foundation;
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# *
# * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
# */
#
# Python version of sample-simulator.cc
import ns.core
class MyModel(object):
def Start(self):
ns.core.Simulator.Schedule(ns.core.Seconds(10.0), self.HandleEvent, ns.core.Simulator.Now().GetSeconds())
def HandleEvent(self, value):
print "Member method received event at", ns.core.Simulator.Now().GetSeconds(), \
"s started at", value, "s"
def ExampleFunction(model):
print "ExampleFunction received event at", ns.core.Simulator.Now().GetSeconds(), "s"
model.Start()
def RandomFunction(model):
print "RandomFunction received event at", ns.core.Simulator.Now().GetSeconds(), "s"
def CancelledEvent():
print "I should never be called... "
def main(dummy_argv):
model = MyModel()
v = ns.core.UniformVariable(10,20)
ns.core.Simulator.Schedule(ns.core.Seconds(10.0), ExampleFunction, model)
ns.core.Simulator.Schedule(ns.core.Seconds(v.GetValue()), RandomFunction, model)
id = ns.core.Simulator.Schedule(ns.core.Seconds(30.0), CancelledEvent)
ns.core.Simulator.Cancel(id)
ns.core.Simulator.Run()
ns.core.Simulator.Destroy()
if __name__ == '__main__':
import sys
main(sys.argv)
| zy901002-gpsr | src/core/examples/sample-simulator.py | Python | gpl2 | 1,989 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "ns3/callback.h"
#include "ns3/assert.h"
#include <iostream>
using namespace ns3;
static double
CbOne (double a, double b)
{
std::cout << "invoke cbOne a=" << a << ", b=" << b << std::endl;
return a;
}
class MyCb {
public:
int CbTwo (double a) {
std::cout << "invoke cbTwo a=" << a << std::endl;
return -5;
}
};
int main (int argc, char *argv[])
{
// return type: double
// first arg type: double
// second arg type: double
Callback<double, double, double> one;
// build callback instance which points to cbOne function
one = MakeCallback (&CbOne);
// this is not a null callback
NS_ASSERT (!one.IsNull ());
// invoke cbOne function through callback instance
double retOne;
retOne = one (10.0, 20.0);
// cast retOne to void, to suppress variable ‘retOne’ set but
// not used compiler warning
(void) retOne;
// return type: int
// first arg type: double
Callback<int, double> two;
MyCb cb;
// build callback instance which points to MyCb::cbTwo
two = MakeCallback (&MyCb::CbTwo, &cb);
// this is not a null callback
NS_ASSERT (!two.IsNull ());
// invoke MyCb::cbTwo through callback instance
int retTwo;
retTwo = two (10.0);
// cast retTwo to void, to suppress variable ‘retTwo’ set but
// not used compiler warning
(void) retTwo;
two = MakeNullCallback<int, double> ();
// invoking a null callback is just like
// invoking a null function pointer:
// it will crash.
//int retTwoNull = two (20.0);
NS_ASSERT (two.IsNull ());
#if 0
// The below type mismatch between CbOne() and callback two will fail to
// compile if enabled in this program.
two = MakeCallback (&CbOne);
#endif
#if 0
// This is a slightly different example, in which the code will compile
// but because callbacks are type-safe, will cause a fatal error at runtime
// (the difference here is that Assign() is called instead of operator=)
Callback<void, float> three;
three.Assign (MakeCallback (&CbOne));
#endif
return 0;
}
| zy901002-gpsr | src/core/examples/main-callback.cc | C++ | gpl2 | 2,089 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "ns3/ptr.h"
#include "ns3/object.h"
#include <iostream>
using namespace ns3;
class A : public Object
{
public:
A ();
~A ();
void Method (void);
};
A::A ()
{
std::cout << "A constructor" << std::endl;
}
A::~A()
{
std::cout << "A destructor" << std::endl;
}
void
A::Method (void)
{
std::cout << "A method" << std::endl;
}
static Ptr<A> g_a = 0;
static Ptr<A>
StoreA (Ptr<A> a)
{
Ptr<A> prev = g_a;
g_a = a;
return prev;
}
static void
ClearA (void)
{
g_a = 0;
}
int main (int argc, char *argv[])
{
{
// Create a new object of type A, store it in global
// variable g_a
Ptr<A> a = CreateObject<A> ();
a->Method ();
Ptr<A> prev = StoreA (a);
NS_ASSERT (prev == 0);
}
{
// Create a new object of type A, store it in global
// variable g_a, get a hold on the previous A object.
Ptr<A> a = CreateObject<A> ();
Ptr<A> prev = StoreA (a);
// call method on object
prev->Method ();
// Clear the currently-stored object
ClearA ();
// get the raw pointer and release it.
A *raw = GetPointer (prev);
prev = 0;
raw->Method ();
raw->Unref ();
}
return 0;
}
| zy901002-gpsr | src/core/examples/main-ptr.cc | C++ | gpl2 | 1,234 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include "ns3/command-line.h"
#include "ns3/random-variable.h"
#include <iostream>
using namespace ns3;
using namespace std;
/*
* This program can be run from waf such as "./waf --run sample-random-variable"
*
* This program is about as simple as possible to display the use of ns-3
* to generate random numbers. By default, the uniform random variate that
* will be outputted is 0.816532. Because ns-3 uses a fixed seed for the
* pseudo-random number generator, this program should always output the
* same number. Likewise, ns-3 simulations using random variables will
* behave deterministically unless the user changes the RunNumber or the
* Seed.
*
* There are three primary mechanisms to change the seed or run numbers
* from their default integer value of 1
* 1) Through explicit call of SeedManager::SetSeed () and
* SeedManager::SetRun () (commented out below)
* 2) Through the passing of command line arguments such as:
* "./waf --command-template="%s --RngRun=<value>" --run program-name"
* 3) Through the use of the NS_GLOBAL_VALUE environment variable, such as:
* "NS_GLOBAL_VALUE="RngRun=<value>" ./waf --run program-name"
*
* For instance, setting the run number to 3 will change the program output to
* 0.775417
*
* Consult the ns-3 manual for more information about the use of the
* random number generator
*/
int main (int argc, char *argv[])
{
CommandLine cmd;
cmd.Parse (argc, argv);
// SeedManager::SetRun (3);
UniformVariable uv;
cout << uv.GetValue () << endl;
}
| zy901002-gpsr | src/core/examples/sample-random-variable.cc | C++ | gpl2 | 2,319 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 Timo Bingmann
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Timo Bingmann <timo.bingmann@student.kit.edu>
*/
#include "ns3/random-variable.h"
#include "ns3/gnuplot.h"
#include <map>
#include <cmath>
using namespace ns3;
/// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2
/// and dround(0.257, 0.1) = 0.3
double dround (double number, double precision)
{
number /= precision;
if (number >= 0)
number = std::floor (number + 0.5);
else
number = std::ceil (number - 0.5);
number *= precision;
return number;
}
static GnuplotDataset
Histogramm (RandomVariable rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
{
typedef std::map<double, unsigned int> histogramm_maptype;
histogramm_maptype histogramm;
for(unsigned int i = 0; i < probes; ++i)
{
double val = dround ( rndvar.GetValue (), precision );
++histogramm[val];
}
Gnuplot2dDataset data;
data.SetTitle (title);
if (notcontinous)
{
data.SetStyle (Gnuplot2dDataset::IMPULSES);
}
for(histogramm_maptype::const_iterator hi = histogramm.begin ();
hi != histogramm.end (); ++hi)
{
data.Add (hi->first, (double)hi->second / (double)probes / precision);
}
return data;
}
int main (int argc, char *argv[])
{
unsigned int probes = 1000000;
double precision = 0.01;
GnuplotCollection gnuplots ("main-random-variables.pdf");
gnuplots.SetTerminal ("pdf enhanced");
{
Gnuplot plot;
plot.SetTitle ("UniformVariable");
plot.AppendExtra ("set yrange [0:]");
plot.AddDataset ( Histogramm (UniformVariable (0.0, 1.0), probes, precision,
"UniformVariable [0.0 .. 1.0)") );
plot.AddDataset ( Gnuplot2dFunction ("0.1",
"0 <= x && x <= 1 ? 1.0 : 0") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("ExponentialVariable");
plot.AppendExtra ("set xrange [0:8]");
plot.AppendExtra ("ExpDist(x,l) = 1/l * exp(-1/l * x)");
plot.AddDataset ( Histogramm (ExponentialVariable (0.5), probes, precision,
"ExponentialVariable m=0.5") );
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 0.5",
"ExpDist(x, 0.5)") );
plot.AddDataset ( Histogramm (ExponentialVariable (1.0), probes, precision,
"ExponentialVariable m=1") );
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.0",
"ExpDist(x, 1.0)") );
plot.AddDataset ( Histogramm (ExponentialVariable (1.5), probes, precision,
"ExponentialVariable m=1.5") );
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.5",
"ExpDist(x, 1.5)") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("ParetoVariable");
plot.AppendExtra ("set xrange [0:2]");
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 1.5), probes, precision,
"ParetoVariable m=1.0 s=1.5") );
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.0), probes, precision,
"ParetoVariable m=1.0 s=2.0") );
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.5), probes, precision,
"ParetoVariable m=1.0 s=2.5") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("WeibullVariable");
plot.AppendExtra ("set xrange [0:3]");
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 1.0), probes, precision,
"WeibullVariable m=1.0 s=1.0") );
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 2.0), probes, precision,
"WeibullVariable m=1.0 s=2.0") );
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 3.0), probes, precision,
"WeibullVariable m=1.0 s=3.0") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("NormalVariable");
plot.AppendExtra ("set xrange [-3:3]");
plot.AppendExtra ("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)");
plot.AddDataset ( Histogramm (NormalVariable (0.0, 1.0), probes, precision,
"NormalVariable m=0.0 v=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0",
"NormalDist(x,0.0,1.0)") );
plot.AddDataset ( Histogramm (NormalVariable (0.0, 2.0), probes, precision,
"NormalVariable m=0.0 v=2.0") );
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)",
"NormalDist(x,0.0,sqrt(2.0))") );
plot.AddDataset ( Histogramm (NormalVariable (0.0, 3.0), probes, precision,
"NormalVariable m=0.0 v=3.0") );
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)",
"NormalDist(x,0.0,sqrt(3.0))") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("EmpiricalVariable");
plot.AppendExtra ("set xrange [*:*]");
EmpiricalVariable emp1;
emp1.CDF (0.0, 0.0 / 15.0);
emp1.CDF (0.2, 1.0 / 15.0);
emp1.CDF (0.4, 3.0 / 15.0);
emp1.CDF (0.6, 6.0 / 15.0);
emp1.CDF (0.8, 10.0 / 15.0);
emp1.CDF (1.0, 15.0 / 15.0);
plot.AddDataset ( Histogramm (emp1, probes, precision,
"EmpiricalVariable (Stairs)") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("DeterministicVariable");
plot.AppendExtra ("set xrange [*:*]");
double values[] = { 0.0, 0.2, 0.2, 0.4, 0.2, 0.6, 0.8, 0.8, 1.0 };
DeterministicVariable det1 (values, sizeof(values) / sizeof(values[0]));
plot.AddDataset ( Histogramm (det1, probes, precision,
"DeterministicVariable", true) );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("LogNormalVariable");
plot.AppendExtra ("set xrange [0:3]");
plot.AppendExtra ("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)");
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 1.0), probes, precision,
"LogNormalVariable m=0.0 s=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 1.0)",
"LogNormalDist(x, 0.0, 1.0)") );
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.5), probes, precision,
"LogNormalVariable m=0.0 s=0.5") );
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.25), probes, precision,
"LogNormalVariable m=0.0 s=0.25") );
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 0.25)",
"LogNormalDist(x, 0.0, 0.25)") );
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.125), probes, precision,
"LogNormalVariable m=0.0 s=0.125") );
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.0), probes, precision,
"LogNormalVariable m=0.0 s=2.0") );
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 2.0)",
"LogNormalDist(x, 0.0, 2.0)") );
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.5), probes, precision,
"LogNormalVariable m=0.0 s=2.5") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("TriangularVariable");
plot.AppendExtra ("set xrange [*:*]");
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.5), probes, precision,
"TriangularVariable [0.0 .. 1.0) m=0.5") );
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.4), probes, precision,
"TriangularVariable [0.0 .. 1.0) m=0.4") );
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.65), probes, precision,
"TriangularVariable [0.0 .. 1.0) m=0.65") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("GammaVariable");
plot.AppendExtra ("set xrange [0:10]");
plot.AppendExtra ("set yrange [0:1]");
plot.AppendExtra ("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)");
plot.AppendExtra ("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9");
plot.AddDataset ( Histogramm (GammaVariable (1.0, 1.0), probes, precision,
"GammaVariable a=1.0 b=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.0, 1.0)",
"GammaDist(x, 1.0, 1.0)") );
plot.AddDataset ( Histogramm (GammaVariable (1.5, 1.0), probes, precision,
"GammaVariable a=1.5 b=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.5, 1.0)",
"GammaDist(x, 1.5, 1.0)") );
plot.AddDataset ( Histogramm (GammaVariable (2.0, 1.0), probes, precision,
"GammaVariable a=2.0 b=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 1.0)",
"GammaDist(x, 2.0, 1.0)") );
plot.AddDataset ( Histogramm (GammaVariable (4.0, 1.0), probes, precision,
"GammaVariable a=4.0 b=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 4.0, 1.0)",
"GammaDist(x, 4.0, 1.0)") );
plot.AddDataset ( Histogramm (GammaVariable (2.0, 2.0), probes, precision,
"GammaVariable a=2.0 b=2.0") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 2.0)",
"GammaDist(x, 2.0, 2.0)") );
plot.AddDataset ( Histogramm (GammaVariable (2.5, 3.0), probes, precision,
"GammaVariable a=2.5 b=3.0") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 3.0)",
"GammaDist(x, 2.5, 3.0)") );
plot.AddDataset ( Histogramm (GammaVariable (2.5, 4.5), probes, precision,
"GammaVariable a=2.5 b=4.5") );
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 4.5)",
"GammaDist(x, 2.5, 4.5)") );
gnuplots.AddPlot (plot);
}
{
Gnuplot plot;
plot.SetTitle ("ErlangVariable");
plot.AppendExtra ("set xrange [0:10]");
plot.AppendExtra ("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!");
plot.AppendExtra ("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9");
plot.AddDataset ( Histogramm (ErlangVariable (1, 1.0), probes, precision,
"ErlangVariable k=1 {/Symbol l}=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 1, 1.0)",
"ErlangDist(x, 1, 1.0)") );
plot.AddDataset ( Histogramm (ErlangVariable (2, 1.0), probes, precision,
"ErlangVariable k=2 {/Symbol l}=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 1.0)",
"ErlangDist(x, 2, 1.0)") );
plot.AddDataset ( Histogramm (ErlangVariable (3, 1.0), probes, precision,
"ErlangVariable k=3 {/Symbol l}=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 3, 1.0)",
"ErlangDist(x, 3, 1.0)") );
plot.AddDataset ( Histogramm (ErlangVariable (5, 1.0), probes, precision,
"ErlangVariable k=5 {/Symbol l}=1.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 5, 1.0)",
"ErlangDist(x, 5, 1.0)") );
plot.AddDataset ( Histogramm (ErlangVariable (2, 2.0), probes, precision,
"ErlangVariable k=2 {/Symbol l}=2.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 2.0)",
"ErlangDist(x, 2, 2.0)") );
plot.AddDataset ( Histogramm (ErlangVariable (2, 3.0), probes, precision,
"ErlangVariable k=2 {/Symbol l}=3.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 3.0)",
"ErlangDist(x, 2, 3.0)") );
plot.AddDataset ( Histogramm (ErlangVariable (2, 5.0), probes, precision,
"ErlangVariable k=2 {/Symbol l}=5.0") );
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 5.0)",
"ErlangDist(x, 2, 5.0)") );
gnuplots.AddPlot (plot);
}
gnuplots.GenerateOutput (std::cout);
return 0;
}
| zy901002-gpsr | src/core/examples/main-random-variable.cc | C++ | gpl2 | 14,071 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include <iostream>
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include "ns3/command-line.h"
#include "ns3/random-variable.h"
using namespace ns3;
class MyModel
{
public:
void Start (void);
private:
void HandleEvent (double eventValue);
};
void
MyModel::Start (void)
{
Simulator::Schedule (Seconds (10.0),
&MyModel::HandleEvent,
this, Simulator::Now ().GetSeconds ());
}
void
MyModel::HandleEvent (double value)
{
std::cout << "Member method received event at "
<< Simulator::Now ().GetSeconds ()
<< "s started at " << value << "s" << std::endl;
}
static void
ExampleFunction (MyModel *model)
{
std::cout << "ExampleFunction received event at "
<< Simulator::Now ().GetSeconds () << "s" << std::endl;
model->Start ();
}
static void
RandomFunction (void)
{
std::cout << "RandomFunction received event at "
<< Simulator::Now ().GetSeconds () << "s" << std::endl;
}
static void
CancelledEvent (void)
{
std::cout << "I should never be called... " << std::endl;
}
int main (int argc, char *argv[])
{
CommandLine cmd;
cmd.Parse (argc, argv);
MyModel model;
UniformVariable v = UniformVariable (10, 20);
Simulator::Schedule (Seconds (10.0), &ExampleFunction, &model);
Simulator::Schedule (Seconds (v.GetValue ()), &RandomFunction);
EventId id = Simulator::Schedule (Seconds (30.0), &CancelledEvent);
Simulator::Cancel (id);
Simulator::Run ();
Simulator::Destroy ();
}
| zy901002-gpsr | src/core/examples/sample-simulator.cc | C++ | gpl2 | 2,328 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "ns3/simulator.h"
#include "ns3/realtime-simulator-impl.h"
#include "ns3/nstime.h"
#include "ns3/log.h"
#include "ns3/system-thread.h"
#include "ns3/string.h"
#include "ns3/config.h"
#include "ns3/global-value.h"
#include "ns3/ptr.h"
#include <unistd.h>
#include <sys/time.h>
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("TestSync");
bool gFirstRun = false;
void
inserted_function (void)
{
NS_ASSERT (gFirstRun);
NS_LOG_UNCOND ("inserted_function() called at " <<
Simulator::Now ().GetSeconds () << " s");
}
void
background_function (void)
{
NS_ASSERT (gFirstRun);
NS_LOG_UNCOND ("background_function() called at " <<
Simulator::Now ().GetSeconds () << " s");
}
void
first_function (void)
{
NS_LOG_UNCOND ("first_function() called at " <<
Simulator::Now ().GetSeconds () << " s");
gFirstRun = true;
}
class FakeNetDevice
{
public:
FakeNetDevice ();
void Doit3 (void);
void Doit4 (void);
};
FakeNetDevice::FakeNetDevice ()
{
NS_LOG_FUNCTION_NOARGS ();
}
void
FakeNetDevice::Doit3 (void)
{
NS_LOG_FUNCTION_NOARGS ();
sleep (1);
for (uint32_t i = 0; i < 10000; ++i)
{
//
// Exercise the realtime relative now path
//
DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtimeNow (MakeEvent (&inserted_function));
usleep (1000);
}
}
void
FakeNetDevice::Doit4 (void)
{
NS_LOG_FUNCTION_NOARGS ();
sleep (1);
for (uint32_t i = 0; i < 10000; ++i)
{
//
// Exercise the realtime relative schedule path
//
DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtime (Seconds (0), MakeEvent (&inserted_function));
usleep (1000);
}
}
void
test (void)
{
GlobalValue::Bind ("SimulatorImplementationType",
StringValue ("ns3::RealtimeSimulatorImpl"));
FakeNetDevice fnd;
//
// Make sure ScheduleNow works when the system isn't running
//
DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtimeNow (MakeEvent (&first_function));
//
// drive the progression of m_currentTs at a ten millisecond rate from the main thread
//
for (double d = 0.; d < 14.999; d += 0.01)
{
Simulator::Schedule (Seconds (d), &background_function);
}
Ptr<SystemThread> st3 = Create<SystemThread> (
MakeCallback (&FakeNetDevice::Doit3, &fnd));
st3->Start ();
Ptr<SystemThread> st4 = Create<SystemThread> (
MakeCallback (&FakeNetDevice::Doit4, &fnd));
st4->Start ();
Simulator::Stop (Seconds (15.0));
Simulator::Run ();
st3->Join ();
st4->Join ();
Simulator::Destroy ();
}
int
main (int argc, char *argv[])
{
while (true)
{
test ();
}
}
| zy901002-gpsr | src/core/examples/main-test-sync.cc | C++ | gpl2 | 2,845 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
if not bld.env['ENABLE_EXAMPLES']:
return;
obj = bld.create_ns3_program('main-callback', ['core'])
obj.source = 'main-callback.cc'
obj = bld.create_ns3_program('sample-simulator', ['core'])
obj.source = 'sample-simulator.cc'
bld.register_ns3_script('sample-simulator.py', ['core'])
obj = bld.create_ns3_program('main-ptr', ['core'] )
obj.source = 'main-ptr.cc'
obj = bld.create_ns3_program('main-random-variable', ['core', 'config-store', 'tools'])
obj.source = 'main-random-variable.cc'
obj = bld.create_ns3_program('sample-random-variable',
['core'])
obj.source = 'sample-random-variable.cc'
if bld.env['ENABLE_THREADING'] and bld.env["ENABLE_REAL_TIME"]:
obj = bld.create_ns3_program('main-test-sync', ['network'])
obj.source = 'main-test-sync.cc'
| zy901002-gpsr | src/core/examples/wscript | Python | gpl2 | 969 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import sys
import Options
def options(opt):
opt.add_option('--int64x64-as-double',
help=('Whether to use a double floating point'
' type for int64x64 values'
' WARNING: this option only has effect '
'with the configure command.'),
action="store_true", default=False,
dest='int64x64_as_double')
def configure(conf):
a = conf.check_nonfatal(type_name='uint128_t', define_name='HAVE_UINT128_T')
b = conf.check_nonfatal(type_name='__uint128_t', define_name='HAVE___UINT128_T')
if Options.options.int64x64_as_double:
conf.define('INT64X64_USE_DOUBLE', 1)
conf.env['INT64X64_USE_DOUBLE'] = 1
highprec = 'long double'
elif a or b:
conf.define('INT64X64_USE_128', 1)
conf.env['INT64X64_USE_128'] = 1
highprec = '128-bit integer'
else:
conf.define('INT64X64_USE_CAIRO', 1)
conf.env['INT64X64_USE_CAIRO'] = 1
highprec = 'cairo 128-bit integer'
conf.msg('Checking high precision time implementation', highprec)
conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H')
conf.check_nonfatal(header_name='inttypes.h', define_name='HAVE_INTTYPES_H')
conf.check_nonfatal(header_name='sys/inttypes.h', define_name='HAVE_SYS_INT_TYPES_H')
conf.check_nonfatal(header_name='sys/types.h', define_name='HAVE_SYS_TYPES_H')
conf.check_nonfatal(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H')
conf.check_nonfatal(header_name='dirent.h', define_name='HAVE_DIRENT_H')
if conf.check_nonfatal(header_name='stdlib.h'):
conf.define('HAVE_STDLIB_H', 1)
conf.define('HAVE_GETENV', 1)
conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H')
# Check for POSIX threads
test_env = conf.env.copy()
if Options.platform != 'darwin' and Options.platform != 'cygwin':
test_env.append_value('LINKFLAGS', '-pthread')
test_env.append_value('CXXFLAGS', '-pthread')
test_env.append_value('CCFLAGS', '-pthread')
fragment = r"""
#include <pthread.h>
int main ()
{
pthread_mutex_t m;
pthread_mutex_init (&m, NULL);
return 0;
}
"""
have_pthread = conf.check_nonfatal(header_name='pthread.h', define_name='HAVE_PTHREAD_H',
env=test_env, fragment=fragment,
errmsg='Could not find pthread support (build/config.log for details)')
if have_pthread:
# darwin accepts -pthread but prints a warning saying it is ignored
if Options.platform != 'darwin' and Options.platform != 'cygwin':
conf.env['CXXFLAGS_PTHREAD'] = '-pthread'
conf.env['CCFLAGS_PTHREAD'] = '-pthread'
conf.env['LINKFLAGS_PTHREAD'] = '-pthread'
conf.env['ENABLE_THREADING'] = have_pthread
conf.report_optional_feature("Threading", "Threading Primitives",
conf.env['ENABLE_THREADING'],
"<pthread.h> include not detected")
conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H')
conf.check_nonfatal(header_name='inttypes.h', define_name='HAVE_INTTYPES_H')
conf.check_nonfatal(header_name='sys/inttypes.h', define_name='HAVE_SYS_INT_TYPES_H')
if not conf.check_nonfatal(lib='rt', uselib_store='RT', define_name='HAVE_RT'):
conf.report_optional_feature("RealTime", "Real Time Simulator",
False, "librt is not available")
else:
conf.report_optional_feature("RealTime", "Real Time Simulator",
conf.env['ENABLE_THREADING'],
"threading not enabled")
conf.env["ENABLE_REAL_TIME"] = conf.env['ENABLE_THREADING']
conf.write_config_header('ns3/core-config.h', top=True)
def build(bld):
bld.install_files('${PREFIX}/include/ns3', '../../ns3/core-config.h')
core = bld.create_ns3_module('core')
core.source = [
'model/time.cc',
'model/event-id.cc',
'model/scheduler.cc',
'model/list-scheduler.cc',
'model/map-scheduler.cc',
'model/heap-scheduler.cc',
'model/calendar-scheduler.cc',
'model/ns2-calendar-scheduler.cc',
'model/event-impl.cc',
'model/simulator.cc',
'model/simulator-impl.cc',
'model/default-simulator-impl.cc',
'model/timer.cc',
'model/watchdog.cc',
'model/synchronizer.cc',
'model/make-event.cc',
'model/log.cc',
'model/breakpoint.cc',
'model/type-id.cc',
'model/attribute-construction-list.cc',
'model/object-base.cc',
'model/ref-count-base.cc',
'model/object.cc',
'model/test.cc',
'model/random-variable.cc',
'model/rng-stream.cc',
'model/command-line.cc',
'model/type-name.cc',
'model/attribute.cc',
'model/boolean.cc',
'model/integer.cc',
'model/uinteger.cc',
'model/enum.cc',
'model/double.cc',
'model/int64x64.cc',
'model/string.cc',
'model/pointer.cc',
'model/object-ptr-container.cc',
'model/object-factory.cc',
'model/global-value.cc',
'model/trace-source-accessor.cc',
'model/config.cc',
'model/callback.cc',
'model/names.cc',
'model/vector.cc',
'model/fatal-impl.cc',
'model/system-path.cc',
]
core_test = bld.create_ns3_module_test_library('core')
core_test.source = [
'test/attribute-test-suite.cc',
'test/callback-test-suite.cc',
'test/command-line-test-suite.cc',
'test/config-test-suite.cc',
'test/global-value-test-suite.cc',
'test/int64x64-test-suite.cc',
'test/names-test-suite.cc',
'test/object-test-suite.cc',
'test/ptr-test-suite.cc',
'test/random-variable-test-suite.cc',
'test/sample-test-suite.cc',
'test/simulator-test-suite.cc',
'test/time-test-suite.cc',
'test/timer-test-suite.cc',
'test/traced-callback-test-suite.cc',
'test/type-traits-test-suite.cc',
'test/watchdog-test-suite.cc',
]
headers = bld.new_task_gen(features=['ns3header'])
headers.module = 'core'
headers.source = [
'model/nstime.h',
'model/event-id.h',
'model/event-impl.h',
'model/simulator.h',
'model/simulator-impl.h',
'model/default-simulator-impl.h',
'model/scheduler.h',
'model/list-scheduler.h',
'model/map-scheduler.h',
'model/heap-scheduler.h',
'model/calendar-scheduler.h',
'model/ns2-calendar-scheduler.h',
'model/simulation-singleton.h',
'model/singleton.h',
'model/timer.h',
'model/timer-impl.h',
'model/watchdog.h',
'model/synchronizer.h',
'model/make-event.h',
'model/system-wall-clock-ms.h',
'model/empty.h',
'model/callback.h',
'model/object-base.h',
'model/ref-count-base.h',
'model/simple-ref-count.h',
'model/type-id.h',
'model/attribute-construction-list.h',
'model/ptr.h',
'model/object.h',
'model/log.h',
'model/assert.h',
'model/breakpoint.h',
'model/fatal-error.h',
'model/test.h',
'model/random-variable.h',
'model/rng-stream.h',
'model/command-line.h',
'model/type-name.h',
'model/type-traits.h',
'model/int-to-type.h',
'model/attribute.h',
'model/attribute-accessor-helper.h',
'model/boolean.h',
'model/int64x64.h',
'model/int64x64-double.h',
'model/integer.h',
'model/uinteger.h',
'model/double.h',
'model/enum.h',
'model/string.h',
'model/pointer.h',
'model/object-factory.h',
'model/attribute-helper.h',
'model/global-value.h',
'model/traced-callback.h',
'model/traced-value.h',
'model/trace-source-accessor.h',
'model/config.h',
'model/object-ptr-container.h',
'model/object-vector.h',
'model/object-map.h',
'model/deprecated.h',
'model/abort.h',
'model/names.h',
'model/vector.h',
'model/default-deleter.h',
'model/fatal-impl.h',
'model/system-path.h'
]
if sys.platform == 'win32':
core.source.extend([
'model/win32-system-wall-clock-ms.cc',
])
else:
core.source.extend([
'model/unix-system-wall-clock-ms.cc',
])
env = bld.env
if env['INT64X64_USE_DOUBLE']:
headers.source.extend(['model/int64x64-double.h'])
elif env['INT64X64_USE_128']:
headers.source.extend(['model/int64x64-128.h'])
core.source.extend(['model/int64x64-128.cc'])
elif env['INT64X64_USE_CAIRO']:
core.source.extend([
'model/int64x64-cairo.cc',
])
headers.source.extend([
'model/int64x64-cairo.h',
'model/cairo-wideint-private.h',
])
if env['ENABLE_REAL_TIME']:
headers.source.extend([
'model/realtime-simulator-impl.h',
'model/wall-clock-synchronizer.h',
])
core.source.extend([
'model/realtime-simulator-impl.cc',
'model/wall-clock-synchronizer.cc',
])
core.use.append('RT')
core_test.use.append('RT')
if env['ENABLE_THREADING']:
core.source.extend([
'model/unix-fd-reader.cc',
'model/unix-system-thread.cc',
'model/unix-system-mutex.cc',
'model/unix-system-condition.cc',
])
core.use.append('PTHREAD')
core_test.use.append('PTHREAD')
headers.source.extend([
'model/unix-fd-reader.h',
'model/system-mutex.h',
'model/system-thread.h',
'model/system-condition.h',
])
if env['ENABLE_GSL']:
core.use.extend(['GSL', 'GSLCBLAS', 'M'])
core_test.use.extend(['GSL', 'GSLCBLAS', 'M'])
core_test.source.extend(['test/rng-test-suite.cc'])
if (bld.env['ENABLE_EXAMPLES']):
bld.add_subdirs('examples')
pymod = bld.ns3_python_bindings()
if pymod is not None:
pymod.source += ['bindings/module_helpers.cc']
| zy901002-gpsr | src/core/wscript | Python | gpl2 | 10,733 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Giuseppe Piro <g.piro@poliba.it>
*/
#include <ns3/log.h>
#include <cmath>
#include "path-loss-model.h"
#include <ns3/mobility-model.h>
#include <ns3/vector.h>
NS_LOG_COMPONENT_DEFINE ("PathLossModel");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (PathLossModel);
PathLossModel::PathLossModel ()
{
NS_LOG_FUNCTION (this);
SetLastUpdate ();
SetSamplingPeriod (0.5); // defauld value
m_pl = 0;
}
TypeId
PathLossModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::PathLossModel")
.SetParent<DiscreteTimeLossModel> ()
.AddConstructor<PathLossModel> ()
;
return tid;
}
PathLossModel::~PathLossModel ()
{
}
void
PathLossModel::SetValue (double pl)
{
NS_LOG_FUNCTION (this << pl);
m_pl = pl;
}
double
PathLossModel::GetValue (Ptr<const MobilityModel> a, Ptr<const MobilityModel> b)
{
NS_LOG_FUNCTION (this << a << b);
/*
* According to --- insert standard 3gpp ---
* the Path Loss Model For Urban Environment is
* L = I + 37.6log10(R)
* R, in kilometers, is the distance between two nodes
* I = 128.1 at 2GHz
*/
double distance = CalculateDistance (a->GetPosition (), b->GetPosition ());
SetValue (128.1 + (37.6 * log10 (distance * 0.001)));
return m_pl;
}
} // namespace ns3
| zy901002-gpsr | src/lte/model/path-loss-model.cc | C++ | gpl2 | 2,050 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Giuseppe Piro <g.piro@poliba.it>
*/
#ifndef UE_NET_DEVICE_H
#define UE_NET_DEVICE_H
#include "lte-net-device.h"
#include "ns3/event-id.h"
#include "ns3/mac48-address.h"
#include "ns3/traced-callback.h"
#include "ns3/nstime.h"
#include "ns3/log.h"
#include "lte-phy.h"
#include "lte-phy.h"
namespace ns3 {
class Packet;
class PacketBurst;
class Node;
class LtePhy;
class EnbNetDevice;
class UeMacEntity;
/**
* \ingroup lte
*
* The UeNetDevice class implements the UE net device
*/
class UeNetDevice : public LteNetDevice
{
public:
static TypeId GetTypeId (void);
UeNetDevice (void);
/**
* \brief Create an UE net device
* \param node
* \param phy
*/
UeNetDevice (Ptr<Node> node, Ptr<LtePhy> phy);
/**
* \brief Create an UE net device
* \param node
* \param phy
* \param targetEnb the enb where the UE is registered
*/
UeNetDevice (Ptr<Node> node, Ptr<LtePhy> phy, Ptr<EnbNetDevice> targetEnb);
virtual ~UeNetDevice (void);
virtual void DoDispose ();
/**
* \brief Set the MAC entity
* \param m the MAC entity
*/
void SetMacEntity (Ptr<UeMacEntity> m);
/**
* \brief Get the MAC entity
* \return the pointer to the MAC entity
*/
Ptr<UeMacEntity> GetMacEntity (void);
/**
* \brief Initialize the UE
*/
void InitUeNetDevice (void);
void Start (void);
void Stop (void);
/**
* \brief Set the targer eNB where the UE is registered
* \param enb
*/
void SetTargetEnb (Ptr<EnbNetDevice> enb);
/**
* \brief Get the targer eNB where the UE is registered
* \return the pointer to the enb
*/
Ptr<EnbNetDevice> GetTargetEnb (void);
/**
* \brief Start packet transmission.
* This functipon will called when a PDCCH messages is received
* According to the allocated resources in the uplink
* the UE create a packet burst and send it to the phy layer
*/
void StartTransmission (void);
bool SendPacket (Ptr<PacketBurst> p);
private:
bool DoSend (Ptr<Packet> packet,
const Mac48Address& source,
const Mac48Address& dest,
uint16_t protocolNumber);
void DoReceive (Ptr<Packet> p);
Ptr<EnbNetDevice> m_targetEnb;
Ptr<UeMacEntity> m_macEntity;
};
} // namespace ns3
#endif /* UE_NET_DEVICE_H */
| zy901002-gpsr | src/lte/model/ue-net-device.h | C++ | gpl2 | 3,080 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Giuseppe Piro <g.piro@poliba.it>
*/
#include "ue-mac-entity.h"
#include <ns3/log.h>
#include <ns3/pointer.h>
#include <ns3/packet.h>
#include "packet-scheduler.h"
#include "amc-module.h"
#include "ideal-control-messages.h"
#include "lte-net-device.h"
#include "ue-net-device.h"
#include "enb-net-device.h"
#include "ue-phy.h"
NS_LOG_COMPONENT_DEFINE ("UeMacEntity");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (UeMacEntity);
TypeId UeMacEntity::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::UeMacEntity")
.SetParent<MacEntity> ();
return tid;
}
UeMacEntity::UeMacEntity ()
{
SetAmcModule (CreateObject<AmcModule> ());
}
UeMacEntity::~UeMacEntity ()
{
}
Ptr<CqiIdealControlMessage>
UeMacEntity::CreateCqiFeedbacks (std::vector<double> sinr)
{
NS_LOG_FUNCTION (this);
Ptr<UeNetDevice> thisDevice = GetDevice ()->GetObject<UeNetDevice> ();
Ptr<EnbNetDevice> remoteDevice = thisDevice->GetTargetEnb ();
Ptr<UeLtePhy> phy = thisDevice->GetPhy ()->GetObject<UeLtePhy> ();
Ptr<AmcModule> amc = GetAmcModule ();
std::vector<int> cqi = amc->CreateCqiFeedbacks (sinr);
// CREATE CqiIdealControlMessage
Ptr<CqiIdealControlMessage> msg = Create<CqiIdealControlMessage> ();
msg->SetSourceDevice (thisDevice);
msg->SetDestinationDevice (remoteDevice);
int nbSubChannels = cqi.size ();
for (int i = 0; i < nbSubChannels; i++)
{
msg->AddNewRecord (phy->GetDownlinkSubChannels ().at (i), cqi.at (i));
}
return msg;
}
} // namespace ns3
| zy901002-gpsr | src/lte/model/ue-mac-entity.cc | C++ | gpl2 | 2,299 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Giuseppe Piro <g.piro@poliba.it>
*/
#ifndef MULTIPATH_H_
#define MULTIPATH_H_
#include "JakesTraces/multipath_v0_M6.h"
#include "JakesTraces/multipath_v0_M8.h"
#include "JakesTraces/multipath_v0_M10.h"
#include "JakesTraces/multipath_v0_M12.h"
#include "JakesTraces/multipath_v3_M6.h"
#include "JakesTraces/multipath_v3_M8.h"
#include "JakesTraces/multipath_v3_M10.h"
#include "JakesTraces/multipath_v3_M12.h"
#include "JakesTraces/multipath_v30_M6.h"
#include "JakesTraces/multipath_v30_M8.h"
#include "JakesTraces/multipath_v30_M10.h"
#include "JakesTraces/multipath_v30_M12.h"
#include "JakesTraces/multipath_v120_M6.h"
#include "JakesTraces/multipath_v120_M8.h"
#include "JakesTraces/multipath_v120_M10.h"
#include "JakesTraces/multipath_v120_M12.h"
#endif /* MULTIPATH_H_ */
| zy901002-gpsr | src/lte/model/jakes-fading-realizations.h | C | gpl2 | 1,636 |