Bug 1717 - Detect unsettable attributes

This commit is contained in:
Mitch Watrous committed 2014-04-29 22:38:13 +02:00
1 parent 9caeebf0e1
commit 6318da07a6
2 files changed
+22 -5

No files matched your search

+1
View File
@@ -46,6 +46,7 @@ Bugs fixed
- Bug 1276 - optimize NistErrorRateModel
- Bug 1294 - New PeekU8 () and Read (Buffer::Iterator start, uint32_t size) methods in Buffer::Iterator
- Bug 1653 - Extension of CommandLine interface: restored operator << (CommandLine)
- Bug 1717 - Detect unsettable attributes
- Bug 1739 - The endpoint is not deallocated for UDP sockets
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
- Bug 1787 - Runtime error when using AnimationInterface::EnablePacketMetadata() to fetch metadata of CSMA packet
+21 -5
View File
@@ -75,13 +75,29 @@ ObjectBase::ConstructSelf (const AttributeConstructionList &attributes)
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);
// See if this attribute should not be set here in the
// constructor.
if (!(info.flags & TypeId::ATTR_CONSTRUCT))
{
// Handle this attribute if it should not be
// set here.
if (value == 0)
{
// Skip this attribute if it's not in the
// AttributeConstructionList.
continue;
}
else
{
// This is an error because this attribute is not
// settable in its constructor but is present in
// the AttributeConstructionList.
NS_FATAL_ERROR ("Attribute name="<<info.name<<" tid="<<tid.GetName () << ": initial value cannot be set using attributes");
}
}
bool found = false;
if (value != 0)
{
// We have a matching attribute value.