|
101 |
uint32_t flags, |
101 |
uint32_t flags, |
102 |
Ptr<const AttributeValue> initialValue, |
102 |
Ptr<const AttributeValue> initialValue, |
103 |
Ptr<const AttributeAccessor> spec, |
103 |
Ptr<const AttributeAccessor> spec, |
104 |
Ptr<const AttributeChecker> checker); |
104 |
Ptr<const AttributeChecker> checker, |
|
|
105 |
TypeId::SupportLevel supportLevel = TypeId::ACTIVE, |
106 |
const std::string &supportMsg = ""); |
105 |
void SetAttributeInitialValue(uint16_t uid, |
107 |
void SetAttributeInitialValue(uint16_t uid, |
106 |
uint32_t i, |
108 |
uint32_t i, |
107 |
Ptr<const AttributeValue> initialValue); |
109 |
Ptr<const AttributeValue> initialValue); |
108 |
uint32_t GetAttributeN (uint16_t uid) const; |
110 |
uint32_t GetAttributeN (uint16_t uid) const; |
109 |
struct TypeId::AttributeInformation GetAttribute(uint16_t uid, uint32_t i) const; |
111 |
struct TypeId::AttributeInformation GetAttribute(uint16_t uid, uint32_t i) const; |
110 |
void AddTraceSource (uint16_t uid, |
112 |
void AddTraceSource (uint16_t uid, |
111 |
std::string name, |
113 |
std::string name, |
112 |
std::string help, |
114 |
std::string help, |
113 |
Ptr<const TraceSourceAccessor> accessor, |
115 |
Ptr<const TraceSourceAccessor> accessor, |
114 |
std::string callback); |
116 |
std::string callback, |
|
|
117 |
TypeId::SupportLevel supportLevel = TypeId::ACTIVE, |
118 |
const std::string &supportMsg = ""); |
115 |
uint32_t GetTraceSourceN (uint16_t uid) const; |
119 |
uint32_t GetTraceSourceN (uint16_t uid) const; |
116 |
struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, uint32_t i) const; |
120 |
struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, uint32_t i) const; |
117 |
bool MustHideFromDocumentation (uint16_t uid) const; |
121 |
bool MustHideFromDocumentation (uint16_t uid) const; |
Lines 411-427
IidManager::HasAttribute (uint16_t uid,
|
Link Here
|
---|
|
411 |
} |
415 |
} |
412 |
|
416 |
|
413 |
void |
417 |
void |
414 |
IidManager::AddAttribute (uint16_t uid, |
418 |
IidManager::AddAttribute (uint16_t uid, |
415 |
std::string name, |
419 |
std::string name, |
416 |
std::string help, |
420 |
std::string help, |
417 |
uint32_t flags, |
421 |
uint32_t flags, |
418 |
Ptr<const AttributeValue> initialValue, |
422 |
Ptr<const AttributeValue> initialValue, |
419 |
Ptr<const AttributeAccessor> accessor, |
423 |
Ptr<const AttributeAccessor> accessor, |
420 |
Ptr<const AttributeChecker> checker) |
424 |
Ptr<const AttributeChecker> checker, |
|
|
425 |
TypeId::SupportLevel supportLevel, |
426 |
const std::string &supportMsg) |
421 |
{ |
427 |
{ |
422 |
NS_LOG_FUNCTION (this << uid << name << help << flags << initialValue << accessor << checker); |
428 |
NS_LOG_FUNCTION (this << uid << name << help << flags << initialValue << accessor << checker); |
423 |
struct IidInformation *information = LookupInformation (uid); |
429 |
struct IidInformation *information = LookupInformation (uid); |
424 |
if (HasAttribute (uid, name)) |
430 |
if (supportLevel == TypeId::ACTIVE && HasAttribute (uid, name)) |
425 |
{ |
431 |
{ |
426 |
NS_FATAL_ERROR ("Attribute \"" << name << "\" already registered on tid=\"" << |
432 |
NS_FATAL_ERROR ("Attribute \"" << name << "\" already registered on tid=\"" << |
427 |
information->name << "\""); |
433 |
information->name << "\""); |
Lines 434-439
IidManager::AddAttribute (uint16_t uid,
|
Link Here
|
---|
|
434 |
info.originalInitialValue = initialValue; |
440 |
info.originalInitialValue = initialValue; |
435 |
info.accessor = accessor; |
441 |
info.accessor = accessor; |
436 |
info.checker = checker; |
442 |
info.checker = checker; |
|
|
443 |
info.supportLevel = supportLevel; |
444 |
info.supportMsg = supportMsg; |
437 |
information->attributes.push_back (info); |
445 |
information->attributes.push_back (info); |
438 |
} |
446 |
} |
439 |
void |
447 |
void |
Lines 498-508
IidManager::AddTraceSource (uint16_t uid,
|
Link Here
|
---|
|
498 |
std::string name, |
506 |
std::string name, |
499 |
std::string help, |
507 |
std::string help, |
500 |
Ptr<const TraceSourceAccessor> accessor, |
508 |
Ptr<const TraceSourceAccessor> accessor, |
501 |
std::string callback) |
509 |
std::string callback, |
|
|
510 |
TypeId::SupportLevel supportLevel, |
511 |
const std::string &supportMsg) |
502 |
{ |
512 |
{ |
503 |
NS_LOG_FUNCTION (this << uid << name << help << accessor); |
513 |
NS_LOG_FUNCTION (this << uid << name << help << accessor); |
504 |
struct IidInformation *information = LookupInformation (uid); |
514 |
struct IidInformation *information = LookupInformation (uid); |
505 |
if (HasTraceSource (uid, name)) |
515 |
if (supportLevel == TypeId::ACTIVE && HasTraceSource (uid, name)) |
506 |
{ |
516 |
{ |
507 |
NS_FATAL_ERROR ("Trace source \"" << name << "\" already registered on tid=\"" << |
517 |
NS_FATAL_ERROR ("Trace source \"" << name << "\" already registered on tid=\"" << |
508 |
information->name << "\""); |
518 |
information->name << "\""); |
Lines 512-517
IidManager::AddTraceSource (uint16_t uid,
|
Link Here
|
---|
|
512 |
source.help = help; |
522 |
source.help = help; |
513 |
source.accessor = accessor; |
523 |
source.accessor = accessor; |
514 |
source.callback = callback; |
524 |
source.callback = callback; |
|
|
525 |
source.supportLevel = supportLevel; |
526 |
source.supportMsg = supportMsg; |
515 |
information->traceSources.push_back (source); |
527 |
information->traceSources.push_back (source); |
516 |
} |
528 |
} |
517 |
uint32_t |
529 |
uint32_t |
Lines 625-630
TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInforma
|
Link Here
|
---|
|
625 |
struct TypeId::AttributeInformation tmp = tid.GetAttribute(i); |
637 |
struct TypeId::AttributeInformation tmp = tid.GetAttribute(i); |
626 |
if (tmp.name == name) |
638 |
if (tmp.name == name) |
627 |
{ |
639 |
{ |
|
|
640 |
if (tmp.supportLevel == TypeId::DEPRECATED) |
641 |
{ |
642 |
NS_LOG_UNCOND ("Attribute " << name << " is deprecated: " << |
643 |
tmp.supportMsg); |
644 |
/** should return true or false? */ |
645 |
} |
646 |
else if (tmp.supportLevel == TypeId::OBSOLETED) |
647 |
{ |
648 |
NS_FATAL_ERROR ("Attribute " << name << |
649 |
" is obsolete, with no fallback: " << tmp.supportMsg); |
650 |
} |
628 |
*info = tmp; |
651 |
*info = tmp; |
629 |
return true; |
652 |
return true; |
630 |
} |
653 |
} |
Lines 726-752
TypeId::DoAddConstructor (Callback<ObjectBase *> cb)
|
Link Here
|
---|
|
726 |
} |
749 |
} |
727 |
|
750 |
|
728 |
TypeId |
751 |
TypeId |
729 |
TypeId::AddAttribute (std::string name, |
752 |
TypeId::AddAttribute (std::string name, std::string help, |
730 |
std::string help, |
|
|
731 |
const AttributeValue &initialValue, |
753 |
const AttributeValue &initialValue, |
732 |
Ptr<const AttributeAccessor> accessor, |
754 |
Ptr<const AttributeAccessor> accessor, |
733 |
Ptr<const AttributeChecker> checker) |
755 |
Ptr<const AttributeChecker> checker, |
|
|
756 |
SupportLevel supportLevel, |
757 |
const std::string &supportMsg) |
734 |
{ |
758 |
{ |
735 |
NS_LOG_FUNCTION (this << name << help << &initialValue << accessor << checker); |
759 |
NS_LOG_FUNCTION (this << name << help << &initialValue << accessor << checker); |
736 |
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue.Copy (), accessor, checker); |
760 |
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, |
|
|
761 |
initialValue.Copy (), accessor, |
762 |
checker, supportLevel, supportMsg); |
737 |
return *this; |
763 |
return *this; |
738 |
} |
764 |
} |
739 |
|
765 |
|
740 |
TypeId |
766 |
TypeId |
741 |
TypeId::AddAttribute (std::string name, |
767 |
TypeId::AddAttribute (std::string name, std::string help, uint32_t flags, |
742 |
std::string help, |
|
|
743 |
uint32_t flags, |
744 |
const AttributeValue &initialValue, |
768 |
const AttributeValue &initialValue, |
745 |
Ptr<const AttributeAccessor> accessor, |
769 |
Ptr<const AttributeAccessor> accessor, |
746 |
Ptr<const AttributeChecker> checker) |
770 |
Ptr<const AttributeChecker> checker, |
|
|
771 |
SupportLevel supportLevel, |
772 |
const std::string &supportMsg) |
747 |
{ |
773 |
{ |
748 |
NS_LOG_FUNCTION (this << name << help << flags << &initialValue << accessor << checker); |
774 |
NS_LOG_FUNCTION (this << name << help << flags << &initialValue << accessor << checker); |
749 |
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, initialValue.Copy (), accessor, checker); |
775 |
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, |
|
|
776 |
initialValue.Copy (), accessor, |
777 |
checker, supportLevel, supportMsg); |
750 |
return *this; |
778 |
return *this; |
751 |
} |
779 |
} |
752 |
|
780 |
|
|
822 |
TypeId::AddTraceSource (std::string name, |
850 |
TypeId::AddTraceSource (std::string name, |
823 |
std::string help, |
851 |
std::string help, |
824 |
Ptr<const TraceSourceAccessor> accessor, |
852 |
Ptr<const TraceSourceAccessor> accessor, |
825 |
std::string callback) |
853 |
std::string callback, SupportLevel supportLevel, |
|
|
854 |
const std::string &supportMsg) |
826 |
{ |
855 |
{ |
827 |
NS_LOG_FUNCTION (this << name << help << accessor); |
856 |
NS_LOG_FUNCTION (this << name << help << accessor); |
828 |
Singleton<IidManager>::Get ()->AddTraceSource (m_tid, name, help, accessor, callback); |
857 |
Singleton<IidManager>::Get ()->AddTraceSource (m_tid, name, help, accessor, |
|
|
858 |
callback, supportLevel, |
859 |
supportMsg); |
829 |
return *this; |
860 |
return *this; |
830 |
} |
861 |
} |
831 |
|
862 |
|
Lines 851-856
TypeId::LookupTraceSourceByName (std::string name) const
|
Link Here
|
---|
|
851 |
struct TypeId::TraceSourceInformation info = tid.GetTraceSource (i); |
882 |
struct TypeId::TraceSourceInformation info = tid.GetTraceSource (i); |
852 |
if (info.name == name) |
883 |
if (info.name == name) |
853 |
{ |
884 |
{ |
|
|
885 |
if (info.supportLevel == TypeId::DEPRECATED) |
886 |
{ |
887 |
NS_LOG_UNCOND ("TraceSource " << name << " is deprecated: " << |
888 |
info.supportMsg); |
889 |
} |
890 |
else if (info.supportLevel == TypeId::OBSOLETED) |
891 |
{ |
892 |
NS_FATAL_ERROR ("TraceSource " << name << |
893 |
" is obsolete, with no fallback: " << info.supportMsg); |
894 |
} |
895 |
|
854 |
return info.accessor; |
896 |
return info.accessor; |
855 |
} |
897 |
} |
856 |
} |
898 |
} |