#include "attribute.h" #include "log.h" #include "fatal-error.h" #include NS_LOG_COMPONENT_DEFINE ("AttributeValue"); namespace ns3 { AttributeValue::AttributeValue () : m_count (1) {} AttributeValue::AttributeValue (const AttributeValue &o) : m_count (1) {} AttributeValue & AttributeValue::operator = (const AttributeValue &o) { return *this; } AttributeValue::~AttributeValue () {} /*************************************************************** * Big interesting warning. * ------------------------ * * One might wonder why we re-implement a smart pointer below * in the Attribute class. This is a very good question and the answer * is unfortunately pretty complicated. * * 1) We could have requested the user to use Ptr and save us * a lot of pain. This, however, does not work because our smart * pointer needs a special constructor which can be used to convert * objects of type Ptr into a PtrValue to hold the pointer. * * 2) We could have made the m_value member variable below a Ptr * rather than store a raw pointer. This, however, does not work * because this would mean that the constructor Attribute (AttributeValue *) * should be morphed into Attribute (Ptr) which, unfortunately, * would conflict with the template constructor Attribute (Ptr)... * * This is definitely not fun. */ Attribute::Attribute () : m_value (0) {} Attribute::Attribute (const Attribute &o) : m_value (o.m_value) { if (m_value != 0) { m_value->m_count++; NS_LOG_DEBUG ("this="<