--- a/src/core/object.cc Wed Jan 30 17:28:18 2008 +0100
+++ b/src/core/object.cc Wed Jan 30 19:13:06 2008 +0100
@@ -22,8 +22,11 @@
#include "assert.h"
#include "singleton.h"
#include "trace-resolver.h"
+#include "value.h"
+#include "param-spec.h"
#include "log.h"
#include <vector>
+#include <sstream>
NS_LOG_COMPONENT_DEFINE ("Object");
@@ -36,25 +39,51 @@
class IidManager
{
public:
+ IidManager ();
uint16_t AllocateUid (std::string name);
void SetParent (uint16_t uid, uint16_t parent);
+ void SetTypeName (uint16_t uid, std::string typeName);
+ void SetGroupName (uint16_t uid, std::string groupName);
void AddConstructor (uint16_t uid, ns3::CallbackBase callback, uint32_t nArguments);
uint16_t GetUid (std::string name) const;
std::string GetName (uint16_t uid) const;
uint16_t GetParent (uint16_t uid) const;
+ std::string GetTypeName (uint16_t uid) const;
+ std::string GetGroupName (uint16_t uid) const;
ns3::CallbackBase GetConstructor (uint16_t uid, uint32_t nArguments);
bool HasConstructor (uint16_t uid);
uint32_t GetRegisteredN (void);
uint16_t GetRegistered (uint32_t i);
+ void AddParameter (uint16_t uid,
+ std::string name,
+ std::string help,
+ uint32_t flags,
+ ns3::Ptr<const ns3::ParamSpec> spec);
+ uint32_t GetParametersN (uint16_t uid) const;
+ std::string GetParameterName (uint16_t uid, uint32_t i) const;
+ uint32_t GetParameterFlags (uint16_t uid, uint32_t i) const;
+ const ns3::Value *GetParameterInitialValue (uint16_t uid, uint32_t i) const;
+ uint32_t GetParameterUid (uint16_t uid, uint32_t i) const;
+ ns3::Ptr<const ns3::ParamSpec> GetParameterParamSpec (uint16_t uid, uint32_t i) const;
private:
struct ConstructorInformation {
ns3::CallbackBase cb;
uint32_t nArguments;
};
+ struct ParameterInformation {
+ std::string name;
+ std::string help;
+ uint32_t flags;
+ uint32_t uid;
+ ns3::Ptr<const ns3::ParamSpec> param;
+ };
struct IidInformation {
std::string name;
uint16_t parent;
+ std::string typeName;
+ std::string groupName;
std::vector<struct ConstructorInformation> constructors;
+ std::vector<struct ParameterInformation> parameters;
};
typedef std::vector<struct IidInformation>::const_iterator Iterator;
@@ -63,6 +92,9 @@
std::vector<struct IidInformation> m_information;
};
+IidManager::IidManager ()
+{}
+
uint16_t
IidManager::AllocateUid (std::string name)
{
@@ -79,6 +111,8 @@
struct IidInformation information;
information.name = name;
information.parent = 0;
+ information.typeName = "";
+ information.groupName = "";
m_information.push_back (information);
uint32_t uid = m_information.size ();
NS_ASSERT (uid <= 0xffff);
@@ -100,6 +134,19 @@
information->parent = parent;
}
void
+IidManager::SetTypeName (uint16_t uid, std::string typeName)
+{
+ struct IidInformation *information = LookupInformation (uid);
+ information->typeName = typeName;
+}
+void
+IidManager::SetGroupName (uint16_t uid, std::string groupName)
+{
+ struct IidInformation *information = LookupInformation (uid);
+ information->groupName = groupName;
+}
+
+void
IidManager::AddConstructor (uint16_t uid, ns3::CallbackBase callback, uint32_t nArguments)
{
struct IidInformation *information = LookupInformation (uid);
@@ -145,6 +192,19 @@
struct IidInformation *information = LookupInformation (uid);
return information->parent;
}
+std::string
+IidManager::GetTypeName (uint16_t uid) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ return information->typeName;
+}
+std::string
+IidManager::GetGroupName (uint16_t uid) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ return information->groupName;
+}
+
ns3::CallbackBase
IidManager::GetConstructor (uint16_t uid, uint32_t nArguments)
{
@@ -179,6 +239,60 @@
return i + 1;
}
+void
+IidManager::AddParameter (uint16_t uid,
+ std::string name,
+ std::string help,
+ uint32_t flags,
+ ns3::Ptr<const ns3::ParamSpec> spec)
+{
+ struct IidInformation *information = LookupInformation (uid);
+ for (std::vector<struct ParameterInformation>::const_iterator j = information->parameters.begin ();
+ j != information->parameters.end (); j++)
+ {
+ if (j->name == name)
+ {
+ NS_FATAL_ERROR ("Registered the same parameter twice name=\""<<name<<"\" in TypeId=\""<<information->name<<"\"");
+ return;
+ }
+ }
+ struct ParameterInformation param;
+ param.name = name;
+ param.help = help;
+ param.flags = flags;
+ param.param = spec;
+ information->parameters.push_back (param);
+}
+
+
+uint32_t
+IidManager::GetParametersN (uint16_t uid) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ return information->parameters.size ();
+}
+std::string
+IidManager::GetParameterName (uint16_t uid, uint32_t i) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ NS_ASSERT (i < information->parameters.size ());
+ return information->parameters[i].name;
+}
+uint32_t
+IidManager::GetParameterFlags (uint16_t uid, uint32_t i) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ NS_ASSERT (i < information->parameters.size ());
+ return information->parameters[i].flags;
+}
+ns3::Ptr<const ns3::ParamSpec>
+IidManager::GetParameterParamSpec (uint16_t uid, uint32_t i) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ NS_ASSERT (i < information->parameters.size ());
+ return information->parameters[i].param;
+}
+
} // anonymous namespace
@@ -273,6 +387,19 @@
NS_ASSERT (uid != 0);
return TypeId (uid);
}
+Ptr<const ParamSpec>
+TypeId::LookupParamSpecByFullName (std::string fullName)
+{
+ std::string::size_type pos = fullName.find ("::");
+ if (pos == std::string::npos)
+ {
+ return 0;
+ }
+ std::string tidName = fullName.substr (0, pos);
+ std::string paramName = fullName.substr (pos+2, fullName.size () - (pos+2));
+ TypeId tid = LookupByName (tidName);
+ return tid.LookupParamSpecByName (paramName);
+}
uint32_t
TypeId::GetRegisteredN (void)
{
@@ -284,6 +411,41 @@
return TypeId (Singleton<IidManager>::Get ()->GetRegistered (i));
}
+Ptr<const ParamSpec>
+TypeId::LookupParamSpecByName (std::string name) const
+{
+ for (uint32_t i = 0; i < GetParametersN (); i++)
+ {
+ std::string paramName = GetParameterName (i);
+ if (paramName == name)
+ {
+ return GetParameterParamSpec (i);
+ }
+ }
+ return 0;
+}
+Ptr<const ParamSpec>
+TypeId::LookupParamSpecByPosition (uint32_t i) const
+{
+ uint32_t cur = 0;
+ TypeId tid = TypeId (0);
+ TypeId nextTid = *this;
+ do {
+ tid = nextTid;
+ for (uint32_t j = 0; j < tid.GetParametersN (); j++)
+ {
+ if (cur == i)
+ {
+ return tid.GetParameterParamSpec (j);
+ }
+ cur++;
+ }
+ nextTid = tid.GetParent ();
+ } while (nextTid != tid);
+ return 0;
+}
+
+
TypeId
TypeId::SetParent (TypeId tid)
{
@@ -291,12 +453,37 @@
return *this;
}
TypeId
+TypeId::SetGroupName (std::string groupName)
+{
+ Singleton<IidManager>::Get ()->SetGroupName (m_tid, groupName);
+ return *this;
+}
+TypeId
+TypeId::SetTypeName (std::string typeName)
+{
+ Singleton<IidManager>::Get ()->SetTypeName (m_tid, typeName);
+ return *this;
+}
+TypeId
TypeId::GetParent (void) const
{
uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_tid);
return TypeId (parent);
}
std::string
+TypeId::GetGroupName (void) const
+{
+ std::string groupName = Singleton<IidManager>::Get ()->GetGroupName (m_tid);
+ return groupName;
+}
+std::string
+TypeId::GetTypeName (void) const
+{
+ std::string typeName = Singleton<IidManager>::Get ()->GetTypeName (m_tid);
+ return typeName;
+}
+
+std::string
TypeId::GetName (void) const
{
std::string name = Singleton<IidManager>::Get ()->GetName (m_tid);
@@ -316,22 +503,73 @@
Singleton<IidManager>::Get ()->AddConstructor (m_tid, cb, nArguments);
}
+TypeId
+TypeId::AddParameter (std::string name,
+ std::string help,
+ Ptr<const ParamSpec> param)
+{
+ Singleton<IidManager>::Get ()->AddParameter (m_tid, name, help, 0, param);
+ return *this;
+}
+
+TypeId
+TypeId::AddParameter (std::string name,
+ std::string help,
+ uint32_t flags,
+ Ptr<const ParamSpec> param)
+{
+ Singleton<IidManager>::Get ()->AddParameter (m_tid, name, help, flags, param);
+ return *this;
+}
+
+
CallbackBase
-TypeId::LookupConstructor (uint32_t nArguments)
+TypeId::LookupConstructor (uint32_t nArguments) const
{
CallbackBase constructor = Singleton<IidManager>::Get ()->GetConstructor (m_tid, nArguments);
return constructor;
}
Ptr<Object>
-TypeId::CreateObject (void)
+TypeId::CreateObject (void) const
+{
+ return CreateObject (Parameters ());
+}
+Ptr<Object>
+TypeId::CreateObject (const Parameters ¶meters) const
{
CallbackBase cb = LookupConstructor (0);
- Callback<Ptr<Object> > realCb;
+ Callback<Ptr<Object>,const Parameters &> realCb;
realCb.Assign (cb);
- Ptr<Object> object = realCb ();
- return object;
+ Ptr<Object> object = realCb (parameters);
+ return object;
+}
+
+uint32_t
+TypeId::GetParametersN (void) const
+{
+ uint32_t n = Singleton<IidManager>::Get ()->GetParametersN (m_tid);
+ return n;
}
+std::string
+TypeId::GetParameterName (uint32_t i) const
+{
+ std::string name = Singleton<IidManager>::Get ()->GetParameterName (m_tid, i);
+ return name;
+}
+std::string
+TypeId::GetParameterFullName (uint32_t i) const
+{
+ return GetName () + "::" + GetParameterName (i);
+}
+Ptr<const ParamSpec>
+TypeId::GetParameterParamSpec (uint32_t i) const
+{
+ // Used exclusively by the Object class.
+ Ptr<const ParamSpec> param = Singleton<IidManager>::Get ()->GetParameterParamSpec (m_tid, i);
+ return param;
+}
+
bool operator == (TypeId a, TypeId b)
{
@@ -344,6 +582,236 @@
}
/*********************************************************************
+ * The Parameters container implementation
+ *********************************************************************/
+
+Parameters::Parameters ()
+{}
+
+Parameters::Parameters (const Parameters &o)
+{
+ for (Params::const_iterator i = o.m_parameters.begin (); i != o.m_parameters.end (); i++)
+ {
+ struct Param param;
+ param.spec = i->spec;
+ param.value = i->value->Copy ();
+ m_parameters.push_back (param);
+ }
+}
+Parameters &
+Parameters::operator = (const Parameters &o)
+{
+ Reset ();
+ for (Params::const_iterator i = o.m_parameters.begin (); i != o.m_parameters.end (); i++)
+ {
+ struct Param param;
+ param.spec = i->spec;
+ param.value = i->value->Copy ();
+ m_parameters.push_back (param);
+ }
+ return *this;
+}
+Parameters::~Parameters ()
+{
+ Reset ();
+}
+
+bool
+Parameters::Set (std::string name, Ptr<const Value> value)
+{
+ Ptr<const ParamSpec> spec = TypeId::LookupParamSpecByFullName (name);
+ bool ok = DoSet (spec, value);
+ return ok;
+}
+bool
+Parameters::Set (std::string name, std::string value)
+{
+ Ptr<const ParamSpec> spec = TypeId::LookupParamSpecByFullName (name);
+ bool ok = DoSet (spec,value);
+ return ok;
+}
+void
+Parameters::SetWithTid (TypeId tid, std::string name, std::string value)
+{
+ Ptr<const ParamSpec> spec = tid.LookupParamSpecByName (name);
+ DoSet (spec, value);
+}
+void
+Parameters::SetWithTid (TypeId tid, std::string name, Ptr<const Value> value)
+{
+ Ptr<const ParamSpec> spec = tid.LookupParamSpecByName (name);
+ DoSet (spec, value);
+}
+void
+Parameters::SetWithTid (TypeId tid, uint32_t position, std::string value)
+{
+ Ptr<const ParamSpec> spec = tid.LookupParamSpecByPosition (position);
+ DoSet (spec, value);
+}
+void
+Parameters::SetWithTid (TypeId tid, uint32_t position, Ptr<const Value> value)
+{
+ Ptr<const ParamSpec> spec = tid.LookupParamSpecByPosition (position);
+ DoSet (spec, value);
+}
+
+void
+Parameters::DoSetOne (Ptr<const ParamSpec> spec, Ptr<const Value> value)
+{
+ // get rid of any previous value stored in this
+ // vector of values.
+ for (Params::iterator k = m_parameters.begin (); k != m_parameters.end (); k++)
+ {
+ if (k->spec == spec)
+ {
+ m_parameters.erase (k);
+ break;
+ }
+ }
+ // store the new value.
+ struct Param p;
+ p.spec = spec;
+ p.value = value->Copy ();
+ m_parameters.push_back (p);
+}
+bool
+Parameters::DoSet (Ptr<const ParamSpec> spec, Ptr<const Value> value)
+{
+ if (spec == 0)
+ {
+ return false;
+ }
+ bool ok = spec->Check (value);
+ if (!ok)
+ {
+ return false;
+ }
+ DoSetOne (spec, value);
+ return true;
+}
+bool
+Parameters::DoSet (Ptr<const ParamSpec> spec, std::string value)
+{
+ if (spec == 0)
+ {
+ return false;
+ }
+ Ptr<Value> v = spec->CreateInitialValue ();
+ bool ok = v->DeserializeFromString (value, spec);
+ if (!ok)
+ {
+ return false;
+ }
+ ok = spec->Check (v);
+ if (!ok)
+ {
+ return false;
+ }
+ DoSetOne (spec, v);
+ return true;
+}
+void
+Parameters::Reset (void)
+{
+ m_parameters.clear ();
+}
+Parameters *
+Parameters::GetGlobal (void)
+{
+ return Singleton<Parameters>::Get ();
+}
+
+std::string
+Parameters::LookupParameterFullNameByParamSpec (Ptr<const ParamSpec> spec) const
+{
+ for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++)
+ {
+ TypeId tid = TypeId::GetRegistered (i);
+ for (uint32_t j = 0; j < tid.GetParametersN (); j++)
+ {
+ if (spec == tid.GetParameterParamSpec (j))
+ {
+ return tid.GetParameterFullName (j);
+ }
+ }
+ }
+ NS_FATAL_ERROR ("Could not find requested ParamSpec.");
+ // quiet compiler.
+ return "";
+}
+
+std::string
+Parameters::SerializeToString (void) const
+{
+ std::ostringstream oss;
+ for (Params::const_iterator i = m_parameters.begin (); i != m_parameters.end (); i++)
+ {
+ std::string name = LookupParameterFullNameByParamSpec (i->spec);
+ oss << name << "=" << i->value->SerializeToString (PeekPointer (i->spec));
+ if (i != m_parameters.end ())
+ {
+ oss << "|";
+ }
+ }
+ return oss.str ();
+}
+bool
+Parameters::DeserializeFromString (std::string str)
+{
+ Reset ();
+
+ std::string::size_type cur;
+ cur = 0;
+ do {
+ std::string::size_type equal = str.find ("=", cur);
+ if (equal == std::string::npos)
+ {
+ // XXX: invalid parameter.
+ break;
+ }
+ else
+ {
+ std::string name = str.substr (cur, equal-cur);
+ Ptr<const ParamSpec> spec = TypeId::LookupParamSpecByFullName (name);
+ if (spec == 0)
+ {
+ // XXX invalid name.
+ break;
+ }
+ else
+ {
+ std::string::size_type next = str.find ("|", cur);
+ std::string value;
+ if (next == std::string::npos)
+ {
+ value = str.substr (equal+1, str.size () - (equal+1));
+ cur = str.size ();
+ }
+ else
+ {
+ value = str.substr (equal+1, next - (equal+1));
+ cur++;
+ }
+ Ptr<Value> val = spec->CreateInitialValue ();
+ bool ok = val->DeserializeFromString (value, spec);
+ if (!ok)
+ {
+ // XXX invalid value
+ break;
+ }
+ else
+ {
+ DoSetOne (spec, val);
+ }
+ }
+ }
+ } while (cur != str.size ());
+
+ return true;
+}
+
+
+/*********************************************************************
* The Object implementation
*********************************************************************/
@@ -376,6 +844,152 @@
{
m_next = 0;
}
+void
+Object::Construct (const Parameters ¶meters)
+{
+ // loop over the inheritance tree back to the Object base class.
+ TypeId tid = m_tid;
+ do {
+ // loop over all parameters in object type
+ NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetParametersN ());
+ for (uint32_t i = 0; i < tid.GetParametersN (); i++)
+ {
+ Ptr<const ParamSpec> paramSpec = tid.GetParameterParamSpec (i);
+ NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<<
+ tid.GetParameterName (i)<<"\"");
+ bool found = false;
+ // is this parameter stored in this Parameters instance ?
+ for (Parameters::Params::const_iterator j = parameters.m_parameters.begin ();
+ j != parameters.m_parameters.end (); j++)
+ {
+ if (j->spec == paramSpec)
+ {
+ // We have a matching parameter value.
+ paramSpec->Set (this, j->value);
+ NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
+ tid.GetParameterName (i)<<"\"");
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ // is this parameter stored in the global instance instance ?
+ for (Parameters::Params::const_iterator j = Parameters::GetGlobal ()->m_parameters.begin ();
+ j != Parameters::GetGlobal ()->m_parameters.end (); j++)
+ {
+ if (j->spec == paramSpec)
+ {
+ // We have a matching parameter value.
+ paramSpec->Set (this, j->value);
+ NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
+ tid.GetParameterName (i)<<"\" from global");
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found)
+ {
+ // No matching parameter value so we set the default value.
+ Ptr<Value> initial = paramSpec->CreateInitialValue ();
+ paramSpec->Set (this, initial);
+ NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
+ tid.GetParameterName (i)<<"\" from local");
+ }
+ }
+ tid = tid.GetParent ();
+ } while (tid != Object::GetTypeId ());
+ NotifyConstructionCompleted ();
+}
+bool
+Object::DoSet (std::string name, Ptr<const Value> value)
+{
+ Ptr<const ParamSpec> spec = m_tid.LookupParamSpecByName (name);
+ if (spec == 0)
+ {
+ return false;
+ }
+ bool ok = spec->Set (this, value);
+ if (!ok)
+ {
+ return false;
+ }
+ return true;
+}
+bool
+Object::Set (std::string name, Ptr<const Value> value)
+{
+ return DoSet (name, value);
+}
+bool
+Object::Set (std::string name, std::string value)
+{
+ Ptr<const ParamSpec> spec = m_tid.LookupParamSpecByName (name);
+ if (spec == 0)
+ {
+ return false;
+ }
+ Ptr<Value> parameter = spec->CreateInitialValue ();
+ bool ok = parameter->DeserializeFromString (value, spec);
+ if (!ok)
+ {
+ return false;
+ }
+ spec->Set (this, parameter);
+ if (!ok)
+ {
+ return false;
+ }
+ return true;
+}
+bool
+Object::Get (std::string name, std::string &value) const
+{
+ Ptr<const ParamSpec> paramSpec = m_tid.LookupParamSpecByName (name);
+ if (paramSpec == 0)
+ {
+ return false;
+ }
+ Ptr<Value> parameter = paramSpec->CreateInitialValue ();
+ bool ok = paramSpec->Get (this, parameter);
+ if (ok)
+ {
+ value = parameter->SerializeToString (paramSpec);
+ }
+ return ok;
+}
+
+Ptr<const Value>
+Object::Get (std::string name) const
+{
+ Ptr<const ParamSpec> paramSpec = m_tid.LookupParamSpecByName (name);
+ if (paramSpec == 0)
+ {
+ return 0;
+ }
+ Ptr<Value> value = paramSpec->CreateInitialValue ();
+ bool ok = paramSpec->Get (this, value);
+ if (!ok)
+ {
+ return 0;
+ }
+ return value;
+}
+
+bool
+Object::DoGet (std::string name, Ptr<Value> parameter) const
+{
+ Ptr<const ParamSpec> paramSpec = m_tid.LookupParamSpecByName (name);
+ if (paramSpec == 0)
+ {
+ return false;
+ }
+ bool ok = paramSpec->Get (this, parameter);
+ return ok;
+}
+
+
Ptr<Object>
Object::DoQueryInterface (TypeId tid) const
{
@@ -408,7 +1022,9 @@
current = current->m_next;
} while (current != this);
}
-
+void
+Object::NotifyConstructionCompleted (void)
+{}
void
Object::AddInterface (Ptr<Object> o)
{
@@ -619,10 +1235,10 @@
static ns3::TypeId GetTypeId (void) {
static ns3::TypeId tid = ns3::TypeId ("DerivedA")
.SetParent (BaseA::GetTypeId ())
- .AddConstructor<DerivedA,int> ();
+ .AddConstructor<DerivedA> ();
return tid;
}
- DerivedA (int v)
+ DerivedA ()
{}
void DerivedGenerateTrace (int16_t v)
{ m_sourceDerived = v; }
@@ -671,13 +1287,10 @@
static ns3::TypeId GetTypeId (void) {
static ns3::TypeId tid = ns3::TypeId ("DerivedB")
.SetParent (BaseB::GetTypeId ())
- .AddConstructor<DerivedB,int> ()
- .AddConstructor<DerivedB,int,int &> ();
+ .AddConstructor<DerivedB> ();
return tid;
}
- DerivedB (int v)
- {}
- DerivedB (int v1, int &v2)
+ DerivedB ()
{}
void DerivedGenerateTrace (int16_t v)
{ m_sourceDerived = v; }
@@ -754,7 +1367,7 @@
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::GetTypeId ()), 0);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<DerivedA> (), 0);
- baseA = CreateObject<DerivedA> (10);
+ baseA = CreateObject<DerivedA> ();
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (), baseA);
NS_TEST_ASSERT_EQUAL (baseA->QueryInterface<BaseA> (DerivedA::GetTypeId ()), baseA);
NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedA> (), 0);
@@ -773,8 +1386,8 @@
NS_TEST_ASSERT_EQUAL (baseB->QueryInterface<DerivedA> (), 0);
NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface<BaseA> (), 0);
- baseA = CreateObject<DerivedA> (1);
- baseB = CreateObject<DerivedB> (1);
+ baseA = CreateObject<DerivedA> ();
+ baseB = CreateObject<DerivedB> ();
baseBCopy = baseB;
baseA->AddInterface (baseB);
NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface<DerivedB> (), 0);
@@ -836,7 +1449,7 @@
baseA->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
Ptr<DerivedA> derivedA;
- derivedA = CreateObject<DerivedA> (1);
+ derivedA = CreateObject<DerivedA> ();
baseB = CreateObject<BaseB> ();
derivedA->AddInterface (baseB);
baseB->TraceConnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::DerivedATrace, this));
@@ -866,7 +1479,7 @@
NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (), a);
NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (DerivedA::GetTypeId ()), 0);
NS_TEST_ASSERT_EQUAL (a->QueryInterface<DerivedA> (), 0);
- a = DerivedA::GetTypeId ().CreateObject (10);
+ a = DerivedA::GetTypeId ().CreateObject ();
NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (), a);
NS_TEST_ASSERT_EQUAL (a->QueryInterface<BaseA> (DerivedA::GetTypeId ()), a);
NS_TEST_ASSERT_UNEQUAL (a->QueryInterface<DerivedA> (), 0);