InterfaceId -> TypeId
This commit is contained in:
@@ -95,7 +95,7 @@ ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address)
|
||||
static Ptr<Socket>
|
||||
SetupPacketReceive (Ptr<Node> node, uint16_t port)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::LookupByName ("Packet");
|
||||
TypeId iid = TypeId::LookupByName ("Packet");
|
||||
Ptr<SocketFactory> socketFactory = node->QueryInterface<SocketFactory> (iid);
|
||||
Ptr<Socket> sink = socketFactory->CreateSocket ();
|
||||
sink->Bind ();
|
||||
|
||||
@@ -42,7 +42,7 @@ RunSimulation (void)
|
||||
{
|
||||
Ptr<Node> a = CreateObject<InternetNode> ();
|
||||
|
||||
InterfaceId iid = InterfaceId::LookupByName ("Udp");
|
||||
TypeId iid = TypeId::LookupByName ("Udp");
|
||||
Ptr<SocketFactory> socketFactory = a->QueryInterface<SocketFactory> (iid);
|
||||
|
||||
Ptr<Socket> sink = socketFactory->CreateSocket ();
|
||||
|
||||
@@ -154,7 +154,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Start
|
||||
// Create the socket if not already
|
||||
if (!m_socket)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::LookupByName (m_iid);
|
||||
TypeId iid = TypeId::LookupByName (m_iid);
|
||||
Ptr<SocketFactory> socketFactory = GetNode ()->QueryInterface<SocketFactory> (iid);
|
||||
m_socket = socketFactory->CreateSocket ();
|
||||
m_socket->Bind ();
|
||||
|
||||
@@ -73,7 +73,7 @@ void PacketSink::StartApplication() // Called at time specified by Start
|
||||
// Create the socket if not already
|
||||
if (!m_socket)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::LookupByName (m_iid);
|
||||
TypeId iid = TypeId::LookupByName (m_iid);
|
||||
Ptr<SocketFactory> socketFactory =
|
||||
GetNode ()->QueryInterface<SocketFactory> (iid);
|
||||
m_socket = socketFactory->CreateSocket ();
|
||||
|
||||
@@ -91,7 +91,7 @@ UdpEchoClient::StartApplication (void)
|
||||
|
||||
if (!m_socket)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::LookupByName ("Udp");
|
||||
TypeId iid = TypeId::LookupByName ("Udp");
|
||||
Ptr<SocketFactory> socketFactory =
|
||||
GetNode ()->QueryInterface<SocketFactory> (iid);
|
||||
m_socket = socketFactory->CreateSocket ();
|
||||
|
||||
@@ -77,7 +77,7 @@ UdpEchoServer::StartApplication (void)
|
||||
|
||||
if (!m_socket)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::LookupByName ("Udp");
|
||||
TypeId iid = TypeId::LookupByName ("Udp");
|
||||
Ptr<SocketFactory> socketFactory =
|
||||
GetNode ()->QueryInterface<SocketFactory> (iid);
|
||||
m_socket = socketFactory->CreateSocket ();
|
||||
|
||||
@@ -34,16 +34,16 @@ NS_LOG_COMPONENT_DEFINE ("ErrorModel");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
static InterfaceIdDefaultValue g_interfaceIdErrorModelDefaultValue ("ErrorModel",
|
||||
static TypeIdDefaultValue g_interfaceIdErrorModelDefaultValue ("ErrorModel",
|
||||
"Error Model",
|
||||
ErrorModel::iid (),
|
||||
"RateErrorModel");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (ErrorModel);
|
||||
|
||||
InterfaceId ErrorModel::iid (void)
|
||||
TypeId ErrorModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("ErrorModel")
|
||||
static TypeId iid = TypeId ("ErrorModel")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ Ptr<ErrorModel>
|
||||
ErrorModel::CreateDefault (void)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
InterfaceId interfaceId = g_interfaceIdErrorModelDefaultValue.GetValue ();
|
||||
TypeId interfaceId = g_interfaceIdErrorModelDefaultValue.GetValue ();
|
||||
Ptr<ErrorModel> em = interfaceId.CreateObject ()->QueryInterface<ErrorModel> ();
|
||||
return em;
|
||||
}
|
||||
@@ -125,9 +125,9 @@ static EnumDefaultValue<enum ErrorUnit>
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (RateErrorModel);
|
||||
|
||||
InterfaceId RateErrorModel::iid (void)
|
||||
TypeId RateErrorModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RateErrorModel")
|
||||
static TypeId iid = TypeId ("RateErrorModel")
|
||||
.SetParent<ErrorModel> ()
|
||||
.AddConstructor<RateErrorModel> ();
|
||||
return iid;
|
||||
@@ -246,9 +246,9 @@ RateErrorModel::DoReset (void)
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (ListErrorModel);
|
||||
|
||||
InterfaceId ListErrorModel::iid (void)
|
||||
TypeId ListErrorModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("ListErrorModel")
|
||||
static TypeId iid = TypeId ("ListErrorModel")
|
||||
.SetParent<ErrorModel> ()
|
||||
.AddConstructor<ListErrorModel> ();
|
||||
return iid;
|
||||
|
||||
@@ -66,7 +66,7 @@ class RandomVariable;
|
||||
class ErrorModel : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* A factory method to generate a preconfigured default ErrorModel for use
|
||||
* \return an ErrorModel smart pointer that is the default ErrorModel
|
||||
@@ -136,7 +136,7 @@ enum ErrorUnit
|
||||
class RateErrorModel : public ErrorModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
RateErrorModel ();
|
||||
virtual ~RateErrorModel ();
|
||||
@@ -202,7 +202,7 @@ private:
|
||||
class ListErrorModel : public ErrorModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
ListErrorModel ();
|
||||
virtual ~ListErrorModel ();
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
InterfaceIdDefaultValue::InterfaceIdDefaultValue (std::string name,
|
||||
TypeIdDefaultValue::TypeIdDefaultValue (std::string name,
|
||||
std::string help,
|
||||
InterfaceId iid,
|
||||
TypeId iid,
|
||||
std::string defaultValue)
|
||||
: DefaultValueBase (name, help),
|
||||
m_defaultName (defaultValue),
|
||||
@@ -13,33 +13,33 @@ InterfaceIdDefaultValue::InterfaceIdDefaultValue (std::string name,
|
||||
{
|
||||
DefaultValueList::Add (this);
|
||||
}
|
||||
InterfaceId
|
||||
InterfaceIdDefaultValue::GetValue (void) const
|
||||
TypeId
|
||||
TypeIdDefaultValue::GetValue (void) const
|
||||
{
|
||||
return InterfaceId::LookupByName (m_name);
|
||||
return TypeId::LookupByName (m_name);
|
||||
}
|
||||
void
|
||||
InterfaceIdDefaultValue::SetValue (InterfaceId interfaceId)
|
||||
TypeIdDefaultValue::SetValue (TypeId interfaceId)
|
||||
{
|
||||
m_name = interfaceId.GetName ();
|
||||
}
|
||||
void
|
||||
InterfaceIdDefaultValue::SetValue (std::string name)
|
||||
TypeIdDefaultValue::SetValue (std::string name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
bool
|
||||
InterfaceIdDefaultValue::DoParseValue (const std::string &value)
|
||||
TypeIdDefaultValue::DoParseValue (const std::string &value)
|
||||
{
|
||||
for (uint32_t i = 0; i < InterfaceId::GetRegisteredN (); i++)
|
||||
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::GetRegistered (i);
|
||||
TypeId iid = TypeId::GetRegistered (i);
|
||||
do {
|
||||
if (iid.GetName () == value &&
|
||||
iid.HasConstructor ())
|
||||
{
|
||||
// check that it really supports the requested interface.
|
||||
InterfaceId tmp = iid;
|
||||
TypeId tmp = iid;
|
||||
do {
|
||||
if (tmp == m_interfaceId)
|
||||
{
|
||||
@@ -56,18 +56,18 @@ InterfaceIdDefaultValue::DoParseValue (const std::string &value)
|
||||
}
|
||||
|
||||
std::string
|
||||
InterfaceIdDefaultValue::DoGetType (void) const
|
||||
TypeIdDefaultValue::DoGetType (void) const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "(";
|
||||
bool first = true;
|
||||
for (uint32_t i = 0; i < InterfaceId::GetRegisteredN (); i++)
|
||||
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::GetRegistered (i);
|
||||
TypeId iid = TypeId::GetRegistered (i);
|
||||
// can this interface id be used to create objects ?
|
||||
if (iid.HasConstructor ())
|
||||
{
|
||||
InterfaceId tmp = iid;
|
||||
TypeId tmp = iid;
|
||||
// does this interface id supports the requested interface id ?
|
||||
do {
|
||||
if (tmp == m_interfaceId)
|
||||
@@ -88,7 +88,7 @@ InterfaceIdDefaultValue::DoGetType (void) const
|
||||
}
|
||||
|
||||
std::string
|
||||
InterfaceIdDefaultValue::DoGetDefaultValue (void) const
|
||||
TypeIdDefaultValue::DoGetDefaultValue (void) const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class InterfaceIdDefaultValue : public DefaultValueBase
|
||||
class TypeIdDefaultValue : public DefaultValueBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -17,20 +17,20 @@ public:
|
||||
* \param defaultValue the name of the object to create
|
||||
* by default.
|
||||
*/
|
||||
InterfaceIdDefaultValue (std::string name,
|
||||
TypeIdDefaultValue (std::string name,
|
||||
std::string help,
|
||||
InterfaceId iid,
|
||||
TypeId iid,
|
||||
std::string defaultValue);
|
||||
/**
|
||||
* \returns the InterfaceId of the object selected by the user.
|
||||
* \returns the TypeId of the object selected by the user.
|
||||
*/
|
||||
InterfaceId GetValue (void) const;
|
||||
TypeId GetValue (void) const;
|
||||
/**
|
||||
* \param interfaceId the new ClassId selected.
|
||||
*
|
||||
* Override the currently-selected value.
|
||||
*/
|
||||
void SetValue (InterfaceId interfaceId);
|
||||
void SetValue (TypeId interfaceId);
|
||||
/**
|
||||
* \param name the new object selected.
|
||||
*
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
virtual std::string DoGetDefaultValue (void) const;
|
||||
std::string m_defaultName;
|
||||
std::string m_name;
|
||||
InterfaceId m_interfaceId;
|
||||
TypeId m_interfaceId;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -183,15 +183,15 @@ IidManager::GetRegistered (uint32_t i)
|
||||
} // anonymous namespace
|
||||
|
||||
/*********************************************************************
|
||||
* The InterfaceId TraceResolver
|
||||
* The TypeId TraceResolver
|
||||
*********************************************************************/
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class InterfaceIdTraceResolver : public TraceResolver
|
||||
class TypeIdTraceResolver : public TraceResolver
|
||||
{
|
||||
public:
|
||||
InterfaceIdTraceResolver (Ptr<const Object> aggregate);
|
||||
TypeIdTraceResolver (Ptr<const Object> aggregate);
|
||||
virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context);
|
||||
virtual void Disconnect (std::string path, CallbackBase const &cb);
|
||||
virtual void CollectSources (std::string path, const TraceContext &context,
|
||||
@@ -202,11 +202,11 @@ private:
|
||||
Ptr<const Object> m_aggregate;
|
||||
};
|
||||
|
||||
InterfaceIdTraceResolver::InterfaceIdTraceResolver (Ptr<const Object> aggregate)
|
||||
TypeIdTraceResolver::TypeIdTraceResolver (Ptr<const Object> aggregate)
|
||||
: m_aggregate (aggregate)
|
||||
{}
|
||||
Ptr<const Object>
|
||||
InterfaceIdTraceResolver::ParseForInterface (std::string path)
|
||||
TypeIdTraceResolver::ParseForInterface (std::string path)
|
||||
{
|
||||
std::string element = GetElement (path);
|
||||
std::string::size_type dollar_pos = element.find ("$");
|
||||
@@ -215,12 +215,12 @@ InterfaceIdTraceResolver::ParseForInterface (std::string path)
|
||||
return 0;
|
||||
}
|
||||
std::string interfaceName = element.substr (1, std::string::npos);
|
||||
InterfaceId interfaceId = InterfaceId::LookupByName (interfaceName);
|
||||
TypeId interfaceId = TypeId::LookupByName (interfaceName);
|
||||
Ptr<Object> interface = m_aggregate->QueryInterface<Object> (interfaceId);
|
||||
return interface;
|
||||
}
|
||||
void
|
||||
InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
|
||||
TypeIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
|
||||
{
|
||||
Ptr<const Object> interface = ParseForInterface (path);
|
||||
if (interface != 0)
|
||||
@@ -229,7 +229,7 @@ InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, con
|
||||
}
|
||||
}
|
||||
void
|
||||
InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb)
|
||||
TypeIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb)
|
||||
{
|
||||
Ptr<const Object> interface = ParseForInterface (path);
|
||||
if (interface != 0)
|
||||
@@ -238,22 +238,22 @@ InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb)
|
||||
}
|
||||
}
|
||||
void
|
||||
InterfaceIdTraceResolver::CollectSources (std::string path, const TraceContext &context,
|
||||
TypeIdTraceResolver::CollectSources (std::string path, const TraceContext &context,
|
||||
SourceCollection *collection)
|
||||
{
|
||||
m_aggregate->DoCollectSources (path, context, collection);
|
||||
}
|
||||
void
|
||||
InterfaceIdTraceResolver::TraceAll (std::ostream &os, const TraceContext &context)
|
||||
TypeIdTraceResolver::TraceAll (std::ostream &os, const TraceContext &context)
|
||||
{
|
||||
m_aggregate->DoTraceAll (os, context);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* The InterfaceId class
|
||||
* The TypeId class
|
||||
*********************************************************************/
|
||||
|
||||
InterfaceId::InterfaceId (std::string name)
|
||||
TypeId::TypeId (std::string name)
|
||||
{
|
||||
uint16_t uid = Singleton<IidManager>::Get ()->AllocateUid (name);
|
||||
NS_ASSERT (uid != 0);
|
||||
@@ -261,70 +261,70 @@ InterfaceId::InterfaceId (std::string name)
|
||||
}
|
||||
|
||||
|
||||
InterfaceId::InterfaceId (uint16_t iid)
|
||||
TypeId::TypeId (uint16_t iid)
|
||||
: m_iid (iid)
|
||||
{}
|
||||
InterfaceId::~InterfaceId ()
|
||||
TypeId::~TypeId ()
|
||||
{}
|
||||
InterfaceId
|
||||
InterfaceId::LookupByName (std::string name)
|
||||
TypeId
|
||||
TypeId::LookupByName (std::string name)
|
||||
{
|
||||
uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name);
|
||||
NS_ASSERT (uid != 0);
|
||||
return InterfaceId (uid);
|
||||
return TypeId (uid);
|
||||
}
|
||||
uint32_t
|
||||
InterfaceId::GetRegisteredN (void)
|
||||
TypeId::GetRegisteredN (void)
|
||||
{
|
||||
return Singleton<IidManager>::Get ()->GetRegisteredN ();
|
||||
}
|
||||
InterfaceId
|
||||
InterfaceId::GetRegistered (uint32_t i)
|
||||
TypeId
|
||||
TypeId::GetRegistered (uint32_t i)
|
||||
{
|
||||
return InterfaceId (Singleton<IidManager>::Get ()->GetRegistered (i));
|
||||
return TypeId (Singleton<IidManager>::Get ()->GetRegistered (i));
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
InterfaceId::SetParent (InterfaceId iid)
|
||||
TypeId
|
||||
TypeId::SetParent (TypeId iid)
|
||||
{
|
||||
Singleton<IidManager>::Get ()->SetParent (m_iid, iid.m_iid);
|
||||
return *this;
|
||||
}
|
||||
InterfaceId
|
||||
InterfaceId::GetParent (void) const
|
||||
TypeId
|
||||
TypeId::GetParent (void) const
|
||||
{
|
||||
uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_iid);
|
||||
return InterfaceId (parent);
|
||||
return TypeId (parent);
|
||||
}
|
||||
std::string
|
||||
InterfaceId::GetName (void) const
|
||||
TypeId::GetName (void) const
|
||||
{
|
||||
std::string name = Singleton<IidManager>::Get ()->GetName (m_iid);
|
||||
return name;
|
||||
}
|
||||
|
||||
bool
|
||||
InterfaceId::HasConstructor (void) const
|
||||
TypeId::HasConstructor (void) const
|
||||
{
|
||||
bool hasConstructor = Singleton<IidManager>::Get ()->HasConstructor (m_iid);
|
||||
return hasConstructor;
|
||||
}
|
||||
|
||||
void
|
||||
InterfaceId::DoAddConstructor (CallbackBase cb, uint32_t nArguments)
|
||||
TypeId::DoAddConstructor (CallbackBase cb, uint32_t nArguments)
|
||||
{
|
||||
Singleton<IidManager>::Get ()->AddConstructor (m_iid, cb, nArguments);
|
||||
}
|
||||
|
||||
CallbackBase
|
||||
InterfaceId::LookupConstructor (uint32_t nArguments)
|
||||
TypeId::LookupConstructor (uint32_t nArguments)
|
||||
{
|
||||
CallbackBase constructor = Singleton<IidManager>::Get ()->GetConstructor (m_iid, nArguments);
|
||||
return constructor;
|
||||
}
|
||||
|
||||
Ptr<Object>
|
||||
InterfaceId::CreateObject (void)
|
||||
TypeId::CreateObject (void)
|
||||
{
|
||||
CallbackBase cb = LookupConstructor (0);
|
||||
Callback<Ptr<Object> > realCb;
|
||||
@@ -333,12 +333,12 @@ InterfaceId::CreateObject (void)
|
||||
return object;
|
||||
}
|
||||
|
||||
bool operator == (InterfaceId a, InterfaceId b)
|
||||
bool operator == (TypeId a, TypeId b)
|
||||
{
|
||||
return a.m_iid == b.m_iid;
|
||||
}
|
||||
|
||||
bool operator != (InterfaceId a, InterfaceId b)
|
||||
bool operator != (TypeId a, TypeId b)
|
||||
{
|
||||
return a.m_iid != b.m_iid;
|
||||
}
|
||||
@@ -349,18 +349,18 @@ bool operator != (InterfaceId a, InterfaceId b)
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Object);
|
||||
|
||||
static InterfaceId
|
||||
static TypeId
|
||||
GetObjectIid (void)
|
||||
{
|
||||
InterfaceId iid = InterfaceId ("Object");
|
||||
TypeId iid = TypeId ("Object");
|
||||
iid.SetParent (iid);
|
||||
return iid;
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Object::iid (void)
|
||||
{
|
||||
static InterfaceId iid = GetObjectIid ();
|
||||
static TypeId iid = GetObjectIid ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -377,13 +377,13 @@ Object::~Object ()
|
||||
m_next = 0;
|
||||
}
|
||||
Ptr<Object>
|
||||
Object::DoQueryInterface (InterfaceId iid) const
|
||||
Object::DoQueryInterface (TypeId iid) const
|
||||
{
|
||||
NS_ASSERT (CheckLoose ());
|
||||
const Object *currentObject = this;
|
||||
do {
|
||||
NS_ASSERT (currentObject != 0);
|
||||
InterfaceId cur = currentObject->m_iid;
|
||||
TypeId cur = currentObject->m_iid;
|
||||
while (cur != iid && cur != Object::iid ())
|
||||
{
|
||||
cur = cur.GetParent ();
|
||||
@@ -438,7 +438,7 @@ Object::TraceDisconnect (std::string path, const CallbackBase &cb) const
|
||||
}
|
||||
|
||||
void
|
||||
Object::SetInterfaceId (InterfaceId iid)
|
||||
Object::SetTypeId (TypeId iid)
|
||||
{
|
||||
NS_ASSERT (Check ());
|
||||
m_iid = iid;
|
||||
@@ -454,8 +454,8 @@ Ptr<TraceResolver>
|
||||
Object::GetTraceResolver (void) const
|
||||
{
|
||||
NS_ASSERT (CheckLoose ());
|
||||
Ptr<InterfaceIdTraceResolver> resolver =
|
||||
Create<InterfaceIdTraceResolver> (this);
|
||||
Ptr<TypeIdTraceResolver> resolver =
|
||||
Create<TypeIdTraceResolver> (this);
|
||||
return resolver;
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ Object::DoCollectSources (std::string path, const TraceContext &context,
|
||||
{
|
||||
NS_ASSERT (current != 0);
|
||||
NS_LOG_LOGIC ("collect current=" << current);
|
||||
InterfaceId cur = current->m_iid;
|
||||
TypeId cur = current->m_iid;
|
||||
while (cur != Object::iid ())
|
||||
{
|
||||
std::string name = cur.GetName ();
|
||||
@@ -591,8 +591,8 @@ namespace {
|
||||
class BaseA : public ns3::Object
|
||||
{
|
||||
public:
|
||||
static ns3::InterfaceId iid (void) {
|
||||
static ns3::InterfaceId iid = ns3::InterfaceId ("BaseA")
|
||||
static ns3::TypeId iid (void) {
|
||||
static ns3::TypeId iid = ns3::TypeId ("BaseA")
|
||||
.SetParent (Object::iid ())
|
||||
.AddConstructor<BaseA> ();
|
||||
return iid;
|
||||
@@ -616,8 +616,8 @@ public:
|
||||
class DerivedA : public BaseA
|
||||
{
|
||||
public:
|
||||
static ns3::InterfaceId iid (void) {
|
||||
static ns3::InterfaceId iid = ns3::InterfaceId ("DerivedA")
|
||||
static ns3::TypeId iid (void) {
|
||||
static ns3::TypeId iid = ns3::TypeId ("DerivedA")
|
||||
.SetParent (BaseA::iid ())
|
||||
.AddConstructor<DerivedA,int> ();
|
||||
return iid;
|
||||
@@ -643,8 +643,8 @@ public:
|
||||
class BaseB : public ns3::Object
|
||||
{
|
||||
public:
|
||||
static ns3::InterfaceId iid (void) {
|
||||
static ns3::InterfaceId iid = ns3::InterfaceId ("BaseB")
|
||||
static ns3::TypeId iid (void) {
|
||||
static ns3::TypeId iid = ns3::TypeId ("BaseB")
|
||||
.SetParent (Object::iid ())
|
||||
.AddConstructor<BaseB> ();
|
||||
return iid;
|
||||
@@ -668,8 +668,8 @@ public:
|
||||
class DerivedB : public BaseB
|
||||
{
|
||||
public:
|
||||
static ns3::InterfaceId iid (void) {
|
||||
static ns3::InterfaceId iid = ns3::InterfaceId ("DerivedB")
|
||||
static ns3::TypeId iid (void) {
|
||||
static ns3::TypeId iid = ns3::TypeId ("DerivedB")
|
||||
.SetParent (BaseB::iid ())
|
||||
.AddConstructor<DerivedB,int> ()
|
||||
.AddConstructor<DerivedB,int,int &> ();
|
||||
@@ -861,7 +861,7 @@ ObjectTest::RunTests (void)
|
||||
NS_TEST_ASSERT (m_derivedATrace);
|
||||
baseB->TraceDisconnect ("/$DerivedA/*", MakeCallback (&ObjectTest::BaseATrace, this));
|
||||
|
||||
// Test the object creation code of InterfaceId
|
||||
// Test the object creation code of TypeId
|
||||
Ptr<Object> a = BaseA::iid ().CreateObject ();
|
||||
NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (), a);
|
||||
NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (DerivedA::iid ()), 0);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
static struct X##type##RegistrationClass \
|
||||
{ \
|
||||
X##type##RegistrationClass () { \
|
||||
ns3::InterfaceId iid = type::iid (); \
|
||||
ns3::TypeId iid = type::iid (); \
|
||||
iid.GetParent (); \
|
||||
} \
|
||||
} x_##type##RegistrationVariable
|
||||
@@ -48,7 +48,7 @@ class Object;
|
||||
* \brief a unique identifier for an interface.
|
||||
*
|
||||
*/
|
||||
class InterfaceId
|
||||
class TypeId
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -59,9 +59,9 @@ public:
|
||||
* This method cannot fail: it will crash if the input
|
||||
* name is not a valid interface name.
|
||||
*/
|
||||
static InterfaceId LookupByName (std::string name);
|
||||
static TypeId LookupByName (std::string name);
|
||||
static uint32_t GetRegisteredN (void);
|
||||
static InterfaceId GetRegistered (uint32_t i);
|
||||
static TypeId GetRegistered (uint32_t i);
|
||||
/**
|
||||
* \param iid a unique id
|
||||
* \returns the parent of the requested id
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
* This method cannot fail: it will crash if the input
|
||||
* id is not a valid interface id.
|
||||
*/
|
||||
InterfaceId GetParent (void) const;
|
||||
TypeId GetParent (void) const;
|
||||
|
||||
/**
|
||||
* \returns the name of this interface.
|
||||
@@ -77,28 +77,28 @@ public:
|
||||
std::string GetName (void) const;
|
||||
|
||||
/**
|
||||
* \returns true if this InterfaceId has a constructor
|
||||
* \returns true if this TypeId has a constructor
|
||||
*/
|
||||
bool HasConstructor (void) const;
|
||||
|
||||
InterfaceId (std::string);
|
||||
TypeId (std::string);
|
||||
|
||||
InterfaceId SetParent (InterfaceId iid);
|
||||
TypeId SetParent (TypeId iid);
|
||||
template <typename T>
|
||||
InterfaceId SetParent (void);
|
||||
TypeId SetParent (void);
|
||||
|
||||
template <typename T>
|
||||
InterfaceId AddConstructor (void);
|
||||
TypeId AddConstructor (void);
|
||||
template <typename T, typename T1>
|
||||
InterfaceId AddConstructor (void);
|
||||
TypeId AddConstructor (void);
|
||||
template <typename T, typename T1, typename T2>
|
||||
InterfaceId AddConstructor (void);
|
||||
TypeId AddConstructor (void);
|
||||
template <typename T, typename T1, typename T2, typename T3>
|
||||
InterfaceId AddConstructor (void);
|
||||
TypeId AddConstructor (void);
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4>
|
||||
InterfaceId AddConstructor (void);
|
||||
TypeId AddConstructor (void);
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
InterfaceId AddConstructor (void);
|
||||
TypeId AddConstructor (void);
|
||||
|
||||
|
||||
Ptr<Object> CreateObject (void);
|
||||
@@ -113,12 +113,12 @@ public:
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
Ptr<Object> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
|
||||
|
||||
~InterfaceId ();
|
||||
~TypeId ();
|
||||
private:
|
||||
friend bool operator == (InterfaceId a, InterfaceId b);
|
||||
friend bool operator != (InterfaceId a, InterfaceId b);
|
||||
friend bool operator == (TypeId a, TypeId b);
|
||||
friend bool operator != (TypeId a, TypeId b);
|
||||
|
||||
explicit InterfaceId (uint16_t iid);
|
||||
explicit TypeId (uint16_t iid);
|
||||
void DoAddConstructor (CallbackBase callback, uint32_t nArguments);
|
||||
CallbackBase LookupConstructor (uint32_t nArguments);
|
||||
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
Object ();
|
||||
virtual ~Object ();
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
* \returns a pointer to the requested interface or zero if it could not be found.
|
||||
*/
|
||||
template <typename T>
|
||||
Ptr<T> QueryInterface (InterfaceId iid) const;
|
||||
Ptr<T> QueryInterface (TypeId iid) const;
|
||||
/**
|
||||
* Run the DoDispose methods of this object and all the
|
||||
* objects aggregated to it.
|
||||
@@ -213,7 +213,7 @@ protected:
|
||||
*/
|
||||
virtual void DoDispose (void);
|
||||
private:
|
||||
friend class InterfaceIdTraceResolver;
|
||||
friend class TypeIdTraceResolver;
|
||||
template <typename T>
|
||||
friend Ptr<T> CreateObject (void);
|
||||
template <typename T, typename T1>
|
||||
@@ -231,7 +231,7 @@ private:
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
|
||||
|
||||
Ptr<Object> DoQueryInterface (InterfaceId iid) const;
|
||||
Ptr<Object> DoQueryInterface (TypeId iid) const;
|
||||
void DoCollectSources (std::string path, const TraceContext &context,
|
||||
TraceResolver::SourceCollection *collection) const;
|
||||
void DoTraceAll (std::ostream &os, const TraceContext &context) const;
|
||||
@@ -239,16 +239,16 @@ private:
|
||||
bool CheckLoose (void) const;
|
||||
void MaybeDelete (void) const;
|
||||
/**
|
||||
* \param iid an InterfaceId
|
||||
* \param iid an TypeId
|
||||
*
|
||||
* Every subclass which defines a new InterfaceId for itself
|
||||
* should register this InterfaceId by calling this method
|
||||
* Every subclass which defines a new TypeId for itself
|
||||
* should register this TypeId by calling this method
|
||||
* from its constructor.
|
||||
*/
|
||||
void SetInterfaceId (InterfaceId iid);
|
||||
void SetTypeId (TypeId iid);
|
||||
|
||||
mutable uint32_t m_count;
|
||||
InterfaceId m_iid;
|
||||
TypeId m_iid;
|
||||
bool m_disposed;
|
||||
mutable bool m_collecting;
|
||||
Object *m_next;
|
||||
@@ -283,15 +283,15 @@ Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
|
||||
namespace ns3 {
|
||||
|
||||
template <typename T>
|
||||
InterfaceId
|
||||
InterfaceId::SetParent (void)
|
||||
TypeId
|
||||
TypeId::SetParent (void)
|
||||
{
|
||||
return SetParent (T::iid ());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
InterfaceId
|
||||
InterfaceId::AddConstructor (void)
|
||||
TypeId
|
||||
TypeId::AddConstructor (void)
|
||||
{
|
||||
struct Maker {
|
||||
static Ptr<Object> Create (void) {
|
||||
@@ -303,8 +303,8 @@ InterfaceId::AddConstructor (void)
|
||||
return *this;
|
||||
}
|
||||
template <typename T, typename T1>
|
||||
InterfaceId
|
||||
InterfaceId::AddConstructor (void)
|
||||
TypeId
|
||||
TypeId::AddConstructor (void)
|
||||
{
|
||||
struct Maker {
|
||||
static Ptr<Object> Create (T1 a1) {
|
||||
@@ -316,8 +316,8 @@ InterfaceId::AddConstructor (void)
|
||||
return *this;
|
||||
}
|
||||
template <typename T, typename T1, typename T2>
|
||||
InterfaceId
|
||||
InterfaceId::AddConstructor (void)
|
||||
TypeId
|
||||
TypeId::AddConstructor (void)
|
||||
{
|
||||
struct Maker {
|
||||
static Ptr<Object> Create (T1 a1, T2 a2) {
|
||||
@@ -329,8 +329,8 @@ InterfaceId::AddConstructor (void)
|
||||
return *this;
|
||||
}
|
||||
template <typename T, typename T1, typename T2, typename T3>
|
||||
InterfaceId
|
||||
InterfaceId::AddConstructor (void)
|
||||
TypeId
|
||||
TypeId::AddConstructor (void)
|
||||
{
|
||||
struct Maker {
|
||||
static Ptr<Object> Create (T1 a1, T2 a2, T3 a3) {
|
||||
@@ -342,8 +342,8 @@ InterfaceId::AddConstructor (void)
|
||||
return *this;
|
||||
}
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4>
|
||||
InterfaceId
|
||||
InterfaceId::AddConstructor (void)
|
||||
TypeId
|
||||
TypeId::AddConstructor (void)
|
||||
{
|
||||
struct Maker {
|
||||
static Ptr<Object> Create (T1 a1, T2 a2, T3 a3, T4 a4) {
|
||||
@@ -355,8 +355,8 @@ InterfaceId::AddConstructor (void)
|
||||
return *this;
|
||||
}
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
InterfaceId
|
||||
InterfaceId::AddConstructor (void)
|
||||
TypeId
|
||||
TypeId::AddConstructor (void)
|
||||
{
|
||||
struct Maker {
|
||||
static Ptr<Object> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
|
||||
@@ -370,7 +370,7 @@ InterfaceId::AddConstructor (void)
|
||||
|
||||
template <typename T1>
|
||||
Ptr<Object>
|
||||
InterfaceId::CreateObject (T1 a1)
|
||||
TypeId::CreateObject (T1 a1)
|
||||
{
|
||||
CallbackBase cb = LookupConstructor (1);
|
||||
Callback<Ptr<Object>,T1> realCb;
|
||||
@@ -380,7 +380,7 @@ InterfaceId::CreateObject (T1 a1)
|
||||
}
|
||||
template <typename T1, typename T2>
|
||||
Ptr<Object>
|
||||
InterfaceId::CreateObject (T1 a1, T2 a2)
|
||||
TypeId::CreateObject (T1 a1, T2 a2)
|
||||
{
|
||||
CallbackBase cb = LookupConstructor (2);
|
||||
Callback<Ptr<Object>,T1,T2> realCb;
|
||||
@@ -390,7 +390,7 @@ InterfaceId::CreateObject (T1 a1, T2 a2)
|
||||
}
|
||||
template <typename T1, typename T2, typename T3>
|
||||
Ptr<Object>
|
||||
InterfaceId::CreateObject (T1 a1, T2 a2, T3 a3)
|
||||
TypeId::CreateObject (T1 a1, T2 a2, T3 a3)
|
||||
{
|
||||
CallbackBase cb = LookupConstructor (3);
|
||||
Callback<Ptr<Object>,T1,T2,T3> realCb;
|
||||
@@ -400,7 +400,7 @@ InterfaceId::CreateObject (T1 a1, T2 a2, T3 a3)
|
||||
}
|
||||
template <typename T1, typename T2, typename T3, typename T4>
|
||||
Ptr<Object>
|
||||
InterfaceId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
TypeId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
{
|
||||
CallbackBase cb = LookupConstructor (4);
|
||||
Callback<Ptr<Object>,T1,T2,T3,T4> realCb;
|
||||
@@ -410,7 +410,7 @@ InterfaceId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
}
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
Ptr<Object>
|
||||
InterfaceId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
TypeId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
{
|
||||
CallbackBase cb = LookupConstructor (5);
|
||||
Callback<Ptr<Object>,T1,T2,T3,T4,T5> realCb;
|
||||
@@ -451,7 +451,7 @@ Object::QueryInterface () const
|
||||
|
||||
template <typename T>
|
||||
Ptr<T>
|
||||
Object::QueryInterface (InterfaceId iid) const
|
||||
Object::QueryInterface (TypeId iid) const
|
||||
{
|
||||
Ptr<Object> found = DoQueryInterface (iid);
|
||||
if (found != 0)
|
||||
@@ -465,7 +465,7 @@ template <typename T>
|
||||
Ptr<T> CreateObject (void)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ template <typename T, typename T1>
|
||||
Ptr<T> CreateObject (T1 a1)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ template <typename T, typename T1, typename T2>
|
||||
Ptr<T> CreateObject (T1 a1, T2 a2)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1, a2), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ template <typename T, typename T1, typename T2, typename T3>
|
||||
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1, a2, a3), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ template <typename T, typename T1, typename T2, typename T3, typename T4>
|
||||
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ template <typename T, typename T1, typename T2, typename T3, typename T4, typena
|
||||
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ template <typename T, typename T1, typename T2, typename T3, typename T4, typena
|
||||
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ template <typename T, typename T1, typename T2, typename T3, typename T4, typena
|
||||
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false);
|
||||
p->SetInterfaceId (T::iid ());
|
||||
p->SetTypeId (T::iid ());
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ CsmaTopology::ConnectPacketSocket(Ptr<PacketSocketApp> app,
|
||||
Ptr<Socket>
|
||||
CsmaTopology::CreatePacketSocket(Ptr<Node> n1, std::string iid_name)
|
||||
{
|
||||
InterfaceId iid = InterfaceId::LookupByName (iid_name);
|
||||
TypeId iid = TypeId::LookupByName (iid_name);
|
||||
|
||||
Ptr<SocketFactory> socketFactory =
|
||||
n1->QueryInterface<SocketFactory> (iid);
|
||||
|
||||
@@ -37,10 +37,10 @@ const uint16_t ArpL3Protocol::PROT_NUMBER = 0x0806;
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (ArpL3Protocol);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
ArpL3Protocol::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("ArpL3Protocol")
|
||||
static TypeId iid = TypeId ("ArpL3Protocol")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class TraceContext;
|
||||
class ArpL3Protocol : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
static const uint16_t PROT_NUMBER;
|
||||
/**
|
||||
* \brief Constructor
|
||||
|
||||
@@ -44,10 +44,10 @@ const uint16_t Ipv4L3Protocol::PROT_NUMBER = 0x0800;
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4L3Protocol);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Ipv4L3Protocol::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Ipv4L3Protocol")
|
||||
static TypeId iid = TypeId ("Ipv4L3Protocol")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
class Ipv4L3Protocol : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
static const uint16_t PROT_NUMBER;
|
||||
|
||||
Ipv4L3Protocol(Ptr<Node> node);
|
||||
|
||||
@@ -60,10 +60,10 @@ Ipv4L4ProtocolTraceContextElement::GetTypeName (void) const
|
||||
return "ns3::Ipv4L4ProtocolTraceContextElement";
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Ipv4L4Demux::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Ipv4L4Demux")
|
||||
static TypeId iid = TypeId ("Ipv4L4Demux")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
class Ipv4L4Demux : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
Ipv4L4Demux (Ptr<Node> node);
|
||||
virtual ~Ipv4L4Demux();
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ GridTopology::GridTopology (double xMin, double yMin, uint32_t n, double deltaX,
|
||||
m_n (n),
|
||||
m_deltaX (deltaX),
|
||||
m_deltaY (deltaY),
|
||||
m_positionInterfaceId (StaticMobilityModel::iid ())
|
||||
m_positionTypeId (StaticMobilityModel::iid ())
|
||||
{}
|
||||
|
||||
void
|
||||
GridTopology::SetMobilityModel (InterfaceId interfaceId)
|
||||
GridTopology::SetMobilityModel (TypeId interfaceId)
|
||||
{
|
||||
m_positionInterfaceId = interfaceId;
|
||||
m_positionTypeId = interfaceId;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -43,7 +43,7 @@ GridTopology::LayoutOneRowFirst (Ptr<Object> object, uint32_t i)
|
||||
double x, y;
|
||||
x = m_xMin + m_deltaX * (i % m_n);
|
||||
y = m_yMin + m_deltaY * (i / m_n);
|
||||
Ptr<MobilityModel> mobility = m_positionInterfaceId.CreateObject ()->QueryInterface<MobilityModel> ();
|
||||
Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->QueryInterface<MobilityModel> ();
|
||||
object->AddInterface (mobility);
|
||||
mobility->SetPosition (Vector (x, y, 0.0));
|
||||
}
|
||||
@@ -54,7 +54,7 @@ GridTopology::LayoutOneColumnFirst (Ptr<Object> object, uint32_t i)
|
||||
double x, y;
|
||||
x = m_xMin + m_deltaX * (i / m_n);
|
||||
y = m_yMin + m_deltaY * (i % m_n);
|
||||
Ptr<MobilityModel> mobility = m_positionInterfaceId.CreateObject ()->QueryInterface<MobilityModel> ();
|
||||
Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->QueryInterface<MobilityModel> ();
|
||||
object->AddInterface (mobility);
|
||||
mobility->SetPosition (Vector (x, y, 0.0));
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ class GridTopology
|
||||
* \param interfaceId the interfaceId of the position object to attach to each
|
||||
* input object.
|
||||
*/
|
||||
void SetMobilityModel (InterfaceId interfaceId);
|
||||
void SetMobilityModel (TypeId interfaceId);
|
||||
|
||||
/**
|
||||
* \param begin an iterator to the first object to layout.
|
||||
* \param end an iterator to the last object to layout.
|
||||
*
|
||||
* Attach a position (the type of position is specified through
|
||||
* the InterfaceId given to SetMobilityModelModel) to each input object
|
||||
* the TypeId given to SetMobilityModelModel) to each input object
|
||||
* and configure its initial location with a set
|
||||
* of coordinates arranged according to a regular rectangular grid,
|
||||
* one row after the other.
|
||||
@@ -67,7 +67,7 @@ class GridTopology
|
||||
* \param end an iterator to the last object to layout.
|
||||
*
|
||||
* Attach a position (the type of position is specified through
|
||||
* the InterfaceId given to SetMobilityModelModel) to each input object
|
||||
* the TypeId given to SetMobilityModelModel) to each input object
|
||||
* and configure its initial location with a set
|
||||
* of coordinates arranged according to a regular rectangular grid,
|
||||
* one column after the other.
|
||||
@@ -83,7 +83,7 @@ class GridTopology
|
||||
uint32_t m_n;
|
||||
double m_deltaX;
|
||||
double m_deltaY;
|
||||
InterfaceId m_positionInterfaceId;
|
||||
TypeId m_positionTypeId;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (HierarchicalMobilityModel);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
HierarchicalMobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("HierarchicalMobilityModel")
|
||||
static TypeId iid = TypeId ("HierarchicalMobilityModel")
|
||||
.SetParent<MobilityModel> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ns3 {
|
||||
class HierarchicalMobilityModel : public MobilityModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
/**
|
||||
* \param child the "relative" mobility model
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
MobilityModelNotifier::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("MobilityModelNotifier")
|
||||
static TypeId iid = TypeId ("MobilityModelNotifier")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<MobilityModelNotifier> ();
|
||||
return iid;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ns3 {
|
||||
class MobilityModelNotifier : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
/**
|
||||
* Create a new position notifier
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
MobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("MobilityModel")
|
||||
static TypeId iid = TypeId ("MobilityModel")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ns3 {
|
||||
class MobilityModel : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
MobilityModel ();
|
||||
virtual ~MobilityModel () = 0;
|
||||
|
||||
|
||||
@@ -110,10 +110,10 @@ RandomDirection2dMobilityModelParameters::GetCurrent (void)
|
||||
return parameters;
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
RandomDirection2dMobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RandomDirection2dMobilityModel")
|
||||
static TypeId iid = TypeId ("RandomDirection2dMobilityModel")
|
||||
.SetParent<MobilityModel> ()
|
||||
.AddConstructor<RandomDirection2dMobilityModel> ()
|
||||
.AddConstructor<RandomDirection2dMobilityModel,Ptr<RandomDirection2dMobilityModelParameters> > ();
|
||||
|
||||
@@ -89,7 +89,7 @@ class RandomDirection2dMobilityModelParameters : public Object
|
||||
class RandomDirection2dMobilityModel : public MobilityModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
/**
|
||||
* Create from \valueref{RandomDirection2dSpeed},
|
||||
|
||||
@@ -60,10 +60,10 @@ g_discY ("RandomDiscPositionY",
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (RandomPosition);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
RandomPosition::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RandomPosition")
|
||||
static TypeId iid = TypeId ("RandomPosition")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
@@ -77,10 +77,10 @@ RandomPosition::~RandomPosition ()
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (RandomRectanglePosition);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
RandomRectanglePosition::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RandomRectanglePosition")
|
||||
static TypeId iid = TypeId ("RandomRectanglePosition")
|
||||
.SetParent<RandomPosition> ()
|
||||
.AddConstructor<RandomRectanglePosition> ()
|
||||
.AddConstructor<RandomRectanglePosition, const RandomVariable &, const RandomVariable &> ();
|
||||
@@ -113,10 +113,10 @@ RandomRectanglePosition::Get (void) const
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (RandomDiscPosition);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
RandomDiscPosition::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RandomDiscPosition")
|
||||
static TypeId iid = TypeId ("RandomDiscPosition")
|
||||
.SetParent<RandomPosition> ()
|
||||
.AddConstructor<RandomDiscPosition> ()
|
||||
.AddConstructor<RandomDiscPosition, const RandomVariable &, const RandomVariable &, double, double> ();
|
||||
|
||||
@@ -35,7 +35,7 @@ class RandomVariable;
|
||||
class RandomPosition : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
RandomPosition ();
|
||||
virtual ~RandomPosition ();
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
class RandomRectanglePosition : public RandomPosition
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* Create a random position model with construction
|
||||
* values from \valueref{RandomRectanglePositionX}, and
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
class RandomDiscPosition : public RandomPosition
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* Create a random position model with construction
|
||||
* values from \valueref{RandomDiscPositionTheta},
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
static InterfaceIdDefaultValue
|
||||
static TypeIdDefaultValue
|
||||
g_position ("RandomTopologyPositionType",
|
||||
"The type of initial random position in a 3d topology.",
|
||||
RandomPosition::iid (),
|
||||
"RandomRectanglePosition");
|
||||
|
||||
static InterfaceIdDefaultValue
|
||||
static TypeIdDefaultValue
|
||||
g_mobility ("RandomTopologyMobilityType",
|
||||
"The type of mobility model attached to an object in a 3d topology.",
|
||||
MobilityModel::iid (),
|
||||
@@ -43,7 +43,7 @@ RandomTopology::RandomTopology ()
|
||||
{
|
||||
m_positionModel = g_position.GetValue ().CreateObject ()->QueryInterface<RandomPosition> ();
|
||||
}
|
||||
RandomTopology::RandomTopology (Ptr<RandomPosition> positionModel, InterfaceId mobilityModel)
|
||||
RandomTopology::RandomTopology (Ptr<RandomPosition> positionModel, TypeId mobilityModel)
|
||||
: m_positionModel (positionModel),
|
||||
m_mobilityModel (mobilityModel)
|
||||
{}
|
||||
@@ -53,7 +53,7 @@ RandomTopology::~RandomTopology ()
|
||||
}
|
||||
|
||||
void
|
||||
RandomTopology::SetMobilityModel (InterfaceId interfaceId)
|
||||
RandomTopology::SetMobilityModel (TypeId interfaceId)
|
||||
{
|
||||
m_mobilityModel = interfaceId;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class RandomTopology
|
||||
* specified position and mobility models.
|
||||
*/
|
||||
RandomTopology (Ptr<RandomPosition> positionModel,
|
||||
InterfaceId mobilityModel);
|
||||
TypeId mobilityModel);
|
||||
|
||||
~RandomTopology ();
|
||||
|
||||
@@ -62,7 +62,7 @@ class RandomTopology
|
||||
* \param interfaceId the type of mobility model attached to each
|
||||
* input object if it does not have one already.
|
||||
*/
|
||||
void SetMobilityModel (InterfaceId interfaceId);
|
||||
void SetMobilityModel (TypeId interfaceId);
|
||||
/**
|
||||
* \param positionModel the position model used to initialize
|
||||
* the position of each object.
|
||||
@@ -90,7 +90,7 @@ class RandomTopology
|
||||
void Layout (const T &begin, const T &end);
|
||||
private:
|
||||
Ptr<RandomPosition> m_positionModel;
|
||||
InterfaceId m_mobilityModel;
|
||||
TypeId m_mobilityModel;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -129,10 +129,10 @@ RandomWalk2dMobilityModelParameters::GetCurrent (void)
|
||||
return parameters;
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
RandomWalk2dMobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RandomWalkMobilityModel")
|
||||
static TypeId iid = TypeId ("RandomWalkMobilityModel")
|
||||
.SetParent<MobilityModel> ()
|
||||
.AddConstructor<RandomWalk2dMobilityModel> ()
|
||||
.AddConstructor<RandomWalk2dMobilityModel,Ptr<RandomWalk2dMobilityModelParameters> > ();
|
||||
|
||||
@@ -115,7 +115,7 @@ class RandomWalk2dMobilityModelParameters : public Object
|
||||
class RandomWalk2dMobilityModel : public MobilityModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* Instantiate a set of RandomWalk parameters initialized
|
||||
* with construction values from \valueref{RandomWalk2dMode},
|
||||
|
||||
@@ -39,7 +39,7 @@ g_pause ("RandomWaypointPause",
|
||||
"A random variable used to pick the pause of a random waypoint model.",
|
||||
"Constant:2");
|
||||
|
||||
static InterfaceIdDefaultValue
|
||||
static TypeIdDefaultValue
|
||||
g_position ("RandomWaypointPosition",
|
||||
"A random position model used to pick the next waypoint position.",
|
||||
RandomPosition::iid (),
|
||||
@@ -100,10 +100,10 @@ RandomWaypointMobilityModelParameters::GetCurrent (void)
|
||||
return parameters;
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
RandomWaypointMobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("RandomWaypointMobilityModel")
|
||||
static TypeId iid = TypeId ("RandomWaypointMobilityModel")
|
||||
.SetParent<MobilityModel> ()
|
||||
.AddConstructor<RandomWaypointMobilityModel> ()
|
||||
.AddConstructor<RandomWaypointMobilityModel,Ptr<RandomWaypointMobilityModelParameters> > ();
|
||||
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
class RandomWaypointMobilityModel : public MobilityModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* Default parameters from \valueref{RandomWaypointPause},
|
||||
* and, \valueref{RandomWaypointPosition}.
|
||||
|
||||
@@ -23,10 +23,10 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (StaticMobilityModel);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
StaticMobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("StaticMobilityModel")
|
||||
static TypeId iid = TypeId ("StaticMobilityModel")
|
||||
.SetParent<MobilityModel> ()
|
||||
.AddConstructor<StaticMobilityModel> ()
|
||||
.AddConstructor<StaticMobilityModel,const Vector &> ();
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ns3 {
|
||||
class StaticMobilityModel : public MobilityModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* Create a position located at coordinates (0,0,0)
|
||||
*/
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (StaticSpeedMobilityModel);
|
||||
|
||||
InterfaceId StaticSpeedMobilityModel::iid (void)
|
||||
TypeId StaticSpeedMobilityModel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("StaticSpeedMobilityModel")
|
||||
static TypeId iid = TypeId ("StaticSpeedMobilityModel")
|
||||
.SetParent<MobilityModel> ()
|
||||
.AddConstructor<StaticSpeedMobilityModel> ()
|
||||
.AddConstructor<StaticSpeedMobilityModel,const Vector &> ()
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ns3 {
|
||||
class StaticSpeedMobilityModel : public MobilityModel
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* Create position located at coordinates (0,0,0) with
|
||||
* speed (0,0,0).
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Channel);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Channel::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Channel")
|
||||
static TypeId iid = TypeId ("Channel")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class NetDevice;
|
||||
class Channel : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
Channel ();
|
||||
Channel (std::string name);
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (DropTailQueue);
|
||||
|
||||
InterfaceId DropTailQueue::iid (void)
|
||||
TypeId DropTailQueue::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("DropTailQueue")
|
||||
static TypeId iid = TypeId ("DropTailQueue")
|
||||
.SetParent<Queue> ()
|
||||
.AddConstructor<DropTailQueue> ();
|
||||
return iid;
|
||||
|
||||
@@ -35,7 +35,7 @@ const int DTQ_NPACKETS_MAX_DEFAULT = 100;
|
||||
*/
|
||||
class DropTailQueue : public Queue {
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
/**
|
||||
* \brief DropTailQueue Constructor
|
||||
*
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Ipv4::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Ipv4")
|
||||
static TypeId iid = TypeId ("Ipv4")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
class Ipv4 : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
Ipv4 ();
|
||||
virtual ~Ipv4 ();
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (NetDevice);
|
||||
|
||||
InterfaceId NetDevice::iid (void)
|
||||
TypeId NetDevice::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("NetDevice")
|
||||
static TypeId iid = TypeId ("NetDevice")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Packet;
|
||||
class NetDevice : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
virtual ~NetDevice();
|
||||
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace ns3{
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Node);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Node::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Node")
|
||||
static TypeId iid = TypeId ("Node")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
class Node : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
/**
|
||||
* Must be invoked by subclasses only.
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (PacketSocketFactory);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
PacketSocketFactory::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Packet")
|
||||
static TypeId iid = TypeId ("Packet")
|
||||
.SetParent<SocketFactory> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Socket;
|
||||
class PacketSocketFactory : public SocketFactory
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
PacketSocketFactory ();
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ NS_LOG_COMPONENT_DEFINE ("Queue");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
static InterfaceIdDefaultValue g_interfaceIdDefaultValue ("Queue", "Packet Queue",
|
||||
static TypeIdDefaultValue g_interfaceIdDefaultValue ("Queue", "Packet Queue",
|
||||
Queue::iid (), "DropTailQueue");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Queue);
|
||||
@@ -98,10 +98,10 @@ QueueTraceType::Print (std::ostream &os) const
|
||||
}
|
||||
}
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Queue::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Queue")
|
||||
static TypeId iid = TypeId ("Queue")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ Ptr<Queue>
|
||||
Queue::CreateDefault (void)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
InterfaceId interfaceId = g_interfaceIdDefaultValue.GetValue ();
|
||||
TypeId interfaceId = g_interfaceIdDefaultValue.GetValue ();
|
||||
Ptr<Queue> queue = interfaceId.CreateObject ()->QueryInterface<Queue> ();
|
||||
return queue;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
class Queue : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
Queue ();
|
||||
virtual ~Queue ();
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (SocketFactory);
|
||||
|
||||
InterfaceId SocketFactory::iid (void)
|
||||
TypeId SocketFactory::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("SocketFactory")
|
||||
static TypeId iid = TypeId ("SocketFactory")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class Socket;
|
||||
class SocketFactory : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
SocketFactory ();
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Udp);
|
||||
|
||||
InterfaceId Udp::iid (void)
|
||||
TypeId Udp::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("Udp")
|
||||
static TypeId iid = TypeId ("Udp")
|
||||
.SetParent<SocketFactory> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class Socket;
|
||||
class Udp : public SocketFactory
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
Udp ();
|
||||
|
||||
|
||||
@@ -151,14 +151,14 @@ SPFVertex::GetDistanceFromRoot (void) const
|
||||
}
|
||||
|
||||
void
|
||||
SPFVertex::SetOutgoingInterfaceId (uint32_t id)
|
||||
SPFVertex::SetOutgoingTypeId (uint32_t id)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
m_rootOif = id;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SPFVertex::GetOutgoingInterfaceId (void) const
|
||||
SPFVertex::GetOutgoingTypeId (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
return m_rootOif;
|
||||
@@ -784,14 +784,14 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
|
||||
// from the perspective of <v> -- remember that <l> is the link "from"
|
||||
// <v> "to" <w>.
|
||||
//
|
||||
w->SetOutgoingInterfaceId (
|
||||
FindOutgoingInterfaceId (l->GetLinkData ()));
|
||||
w->SetOutgoingTypeId (
|
||||
FindOutgoingTypeId (l->GetLinkData ()));
|
||||
w->SetDistanceFromRoot (distance);
|
||||
w->SetParent (v);
|
||||
NS_LOG_LOGIC ("Next hop from " <<
|
||||
v->GetVertexId () << " to " << w->GetVertexId () <<
|
||||
" goes through next hop " << w->GetNextHop () <<
|
||||
" via outgoing interface " << w->GetOutgoingInterfaceId () <<
|
||||
" via outgoing interface " << w->GetOutgoingTypeId () <<
|
||||
" with distance " << distance);
|
||||
} // end W is a router vertes
|
||||
else
|
||||
@@ -801,14 +801,14 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
|
||||
GlobalRoutingLSA* w_lsa = w->GetLSA ();
|
||||
NS_ASSERT (w_lsa->GetLSType () == GlobalRoutingLSA::NetworkLSA);
|
||||
// Find outgoing interface ID for this network
|
||||
w->SetOutgoingInterfaceId (
|
||||
FindOutgoingInterfaceId (w_lsa->GetLinkStateId (),
|
||||
w->SetOutgoingTypeId (
|
||||
FindOutgoingTypeId (w_lsa->GetLinkStateId (),
|
||||
w_lsa->GetNetworkLSANetworkMask () ));
|
||||
w->SetDistanceFromRoot (distance);
|
||||
w->SetParent (v);
|
||||
NS_LOG_LOGIC ("Next hop from " <<
|
||||
v->GetVertexId () << " to network " << w->GetVertexId () <<
|
||||
" via outgoing interface " << w->GetOutgoingInterfaceId () <<
|
||||
" via outgoing interface " << w->GetOutgoingTypeId () <<
|
||||
" with distance " << distance);
|
||||
return 1;
|
||||
}
|
||||
@@ -833,17 +833,17 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
|
||||
* it can be inherited from the parent network).
|
||||
*/
|
||||
w->SetNextHop(linkRemote->GetLinkData ());
|
||||
w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ());
|
||||
w->SetOutgoingTypeId (v->GetOutgoingTypeId ());
|
||||
NS_LOG_LOGIC ("Next hop from " <<
|
||||
v->GetVertexId () << " to " << w->GetVertexId () <<
|
||||
" goes through next hop " << w->GetNextHop () <<
|
||||
" via outgoing interface " << w->GetOutgoingInterfaceId ());
|
||||
" via outgoing interface " << w->GetOutgoingTypeId ());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
w->SetNextHop (v->GetNextHop ());
|
||||
w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ());
|
||||
w->SetOutgoingTypeId (v->GetOutgoingTypeId ());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -862,7 +862,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
|
||||
// (are inherited).
|
||||
//
|
||||
w->SetNextHop (v->GetNextHop ());
|
||||
w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ());
|
||||
w->SetOutgoingTypeId (v->GetOutgoingTypeId ());
|
||||
}
|
||||
//
|
||||
// In all cases, we need valid values for the distance metric and a parent.
|
||||
@@ -1122,7 +1122,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
// have to find the right node pointer to pass to that function.
|
||||
//
|
||||
uint32_t
|
||||
GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask)
|
||||
GlobalRouteManagerImpl::FindOutgoingTypeId (Ipv4Address a, Ipv4Mask amask)
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
//
|
||||
@@ -1165,7 +1165,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask)
|
||||
//
|
||||
Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4,
|
||||
"GlobalRouteManagerImpl::FindOutgoingInterfaceId (): "
|
||||
"GlobalRouteManagerImpl::FindOutgoingTypeId (): "
|
||||
"QI for <Ipv4> interface failed");
|
||||
//
|
||||
// Look through the interfaces on this node for one that has the IP address
|
||||
@@ -1290,7 +1290,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
|
||||
NS_LOG_LOGIC (" Node " << node->GetId () <<
|
||||
" add route to " << lr->GetLinkData () <<
|
||||
" using next hop " << v->GetNextHop () <<
|
||||
" via interface " << v->GetOutgoingInterfaceId ());
|
||||
" via interface " << v->GetOutgoingTypeId ());
|
||||
//
|
||||
// Here's why we did all of that work. We're going to add a host route to the
|
||||
// host address found in the m_linkData field of the point-to-point link
|
||||
@@ -1305,7 +1305,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
|
||||
// which the packets should be send for forwarding.
|
||||
//
|
||||
ipv4->AddHostRouteTo (lr->GetLinkData (), v->GetNextHop (),
|
||||
v->GetOutgoingInterfaceId ());
|
||||
v->GetOutgoingTypeId ());
|
||||
}
|
||||
//
|
||||
// Done adding the routes for the selected node.
|
||||
@@ -1387,11 +1387,11 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
|
||||
Ipv4Address tempip = lsa->GetLinkStateId ();
|
||||
tempip = tempip.CombineMask (tempmask);
|
||||
ipv4->AddNetworkRouteTo (tempip, tempmask, v->GetNextHop (),
|
||||
v->GetOutgoingInterfaceId ());
|
||||
v->GetOutgoingTypeId ());
|
||||
NS_LOG_LOGIC ("Node " << node->GetId () <<
|
||||
" add network route to " << tempip <<
|
||||
" using next hop " << v->GetNextHop () <<
|
||||
" via interface " << v->GetOutgoingInterfaceId ());
|
||||
" via interface " << v->GetOutgoingTypeId ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
* @returns The interface index to use when forwarding packets to the host
|
||||
* or network represented by "this" SPFVertex.
|
||||
*/
|
||||
uint32_t GetOutgoingInterfaceId (void) const;
|
||||
uint32_t GetOutgoingTypeId (void) const;
|
||||
|
||||
/**
|
||||
* @brief Set the interface ID that should be used to begin forwarding packets
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
* @param id The interface index to use when forwarding packets to the host or
|
||||
* network represented by "this" SPFVertex.
|
||||
*/
|
||||
void SetOutgoingInterfaceId (uint32_t id);
|
||||
void SetOutgoingTypeId (uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Get the IP address that should be used to begin forwarding packets
|
||||
@@ -759,7 +759,7 @@ private:
|
||||
GlobalRoutingLinkRecord* prev_link);
|
||||
void SPFIntraAddRouter (SPFVertex* v);
|
||||
void SPFIntraAddTransit (SPFVertex* v);
|
||||
uint32_t FindOutgoingInterfaceId (Ipv4Address a,
|
||||
uint32_t FindOutgoingTypeId (Ipv4Address a,
|
||||
Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
|
||||
};
|
||||
|
||||
|
||||
@@ -433,10 +433,10 @@ std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa)
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (GlobalRouter);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
GlobalRouter::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("GlobalRouter")
|
||||
static TypeId iid = TypeId ("GlobalRouter")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ public:
|
||||
*
|
||||
* @see Object::QueryInterface ()
|
||||
*/
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
/**
|
||||
* @brief Create a Global Router class
|
||||
|
||||
@@ -150,10 +150,10 @@ NS_LOG_COMPONENT_DEFINE ("OlsrAgent");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (AgentImpl);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
AgentImpl::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("OlsrAgentImpl")
|
||||
static TypeId iid = TypeId ("OlsrAgentImpl")
|
||||
.SetParent<Agent> ()
|
||||
.AddConstructor<AgentImpl,Ptr<Node> > ();
|
||||
return iid;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace olsr {
|
||||
class AgentImpl : public Agent
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
AgentImpl (Ptr<Node> node);
|
||||
|
||||
|
||||
@@ -24,18 +24,18 @@
|
||||
namespace ns3 {
|
||||
namespace olsr {
|
||||
|
||||
static InterfaceIdDefaultValue g_defaultImpl =
|
||||
InterfaceIdDefaultValue ("OlsrAgentType",
|
||||
static TypeIdDefaultValue g_defaultImpl =
|
||||
TypeIdDefaultValue ("OlsrAgentType",
|
||||
"The type of OlsrAgent implementation",
|
||||
Agent::iid (),
|
||||
"OlsrAgentImpl");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Agent);
|
||||
|
||||
InterfaceId
|
||||
TypeId
|
||||
Agent::iid (void)
|
||||
{
|
||||
static InterfaceId iid = InterfaceId ("OlsrAgent")
|
||||
static TypeId iid = TypeId ("OlsrAgent")
|
||||
.SetParent<Object> ();
|
||||
return iid;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ Agent::iid (void)
|
||||
Ptr<Agent>
|
||||
Agent::CreateDefault (Ptr<Node> node)
|
||||
{
|
||||
InterfaceId iid = g_defaultImpl.GetValue ();
|
||||
TypeId iid = g_defaultImpl.GetValue ();
|
||||
Ptr<Agent> agent = iid.CreateObject (node)->QueryInterface<Agent> ();
|
||||
return agent;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace olsr {
|
||||
class Agent : public Object
|
||||
{
|
||||
public:
|
||||
static InterfaceId iid (void);
|
||||
static TypeId iid (void);
|
||||
|
||||
static Ptr<Agent> CreateDefault (Ptr<Node> node);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user