src/core/object-factory.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 26 Feb 2008 22:39:57 +0100
changeset 2488 c35c4f282206
parent 2433 3a98e1db7f80
child 2502 50d0da37f02f
permissions -rw-r--r--
add an extra overload of SetTypeId to avoid overload resolution confusions.

#include "object-factory.h"
#include <sstream>

namespace ns3 {

ObjectFactory::ObjectFactory ()
{}

void 
ObjectFactory::SetTypeId (TypeId tid)
{
  m_tid = tid;
}
void 
ObjectFactory::SetTypeId (std::string tid)
{
  m_tid = TypeId::LookupByName (tid);
}
void 
ObjectFactory::SetTypeId (const char *tid)
{
  m_tid = TypeId::LookupByName (tid);
}
void 
ObjectFactory::Set (std::string name, Attribute value)
{
  m_parameters.SetWithTid (m_tid, name, value);
}

void 
ObjectFactory::Set (std::string name, std::string value)
{
  m_parameters.SetWithTid (m_tid, name, value);
}

TypeId 
ObjectFactory::GetTypeId (void) const
{
  return m_tid;
}

Ptr<Object> 
ObjectFactory::Create (void) const
{
  Ptr<Object> object = m_tid.CreateObject (m_parameters);
  return object;
}

} // namespace ns3