|
195 |
* subclass. |
195 |
* subclass. |
196 |
* \param [in] checker An instance of the associated AttributeChecker |
196 |
* \param [in] checker An instance of the associated AttributeChecker |
197 |
* subclass. |
197 |
* subclass. |
|
|
198 |
* \param [in] supportLevel The support/deprecation status for this attribute. |
199 |
* \param [in] supportMsg Upgrade hint if this attribute is no longer supported. |
198 |
*/ |
200 |
*/ |
199 |
void AddAttribute (uint16_t uid, |
201 |
void AddAttribute (uint16_t uid, |
200 |
std::string name, |
202 |
std::string name, |
|
202 |
uint32_t flags, |
204 |
uint32_t flags, |
203 |
Ptr<const AttributeValue> initialValue, |
205 |
Ptr<const AttributeValue> initialValue, |
204 |
Ptr<const AttributeAccessor> accessor, |
206 |
Ptr<const AttributeAccessor> accessor, |
205 |
Ptr<const AttributeChecker> checker); |
207 |
Ptr<const AttributeChecker> checker, |
|
|
208 |
TypeId::SupportLevel supportLevel = TypeId::SUPPORTED, |
209 |
const std::string &supportMsg = ""); |
206 |
/** |
210 |
/** |
207 |
* Set the initial value of an Attribute. |
211 |
* Set the initial value of an Attribute. |
208 |
* \param [in] uid The id. |
212 |
* \param [in] uid The id. |
|
236 |
* \param [in] callback Fully qualified typedef name for the callback |
240 |
* \param [in] callback Fully qualified typedef name for the callback |
237 |
* signature. Generally this should begin with the |
241 |
* signature. Generally this should begin with the |
238 |
* "ns3::" namespace qualifier. |
242 |
* "ns3::" namespace qualifier. |
|
|
243 |
* \param [in] supportLevel The support/deprecation status for this attribute. |
244 |
* \param [in] supportMsg Upgrade hint if this attribute is no longer supported. |
239 |
* \returns This TypeId instance. |
245 |
* \returns This TypeId instance. |
240 |
*/ |
246 |
*/ |
241 |
void AddTraceSource (uint16_t uid, |
247 |
void AddTraceSource (uint16_t uid, |
242 |
std::string name, |
248 |
std::string name, |
243 |
std::string help, |
249 |
std::string help, |
244 |
Ptr<const TraceSourceAccessor> accessor, |
250 |
Ptr<const TraceSourceAccessor> accessor, |
245 |
std::string callback); |
251 |
std::string callback, |
|
|
252 |
TypeId::SupportLevel supportLevel = TypeId::SUPPORTED, |
253 |
const std::string &supportMsg = ""); |
246 |
/** |
254 |
/** |
247 |
* Get the number of Trace sources. |
255 |
* Get the number of Trace sources. |
248 |
* \param [in] uid The id. |
256 |
* \param [in] uid The id. |
|
307 |
std::vector<struct TypeId::AttributeInformation> attributes; |
315 |
std::vector<struct TypeId::AttributeInformation> attributes; |
308 |
/** The container of TraceSources. */ |
316 |
/** The container of TraceSources. */ |
309 |
std::vector<struct TypeId::TraceSourceInformation> traceSources; |
317 |
std::vector<struct TypeId::TraceSourceInformation> traceSources; |
|
|
318 |
/** Support level/deprecation. */ |
319 |
TypeId::SupportLevel supportLevel; |
320 |
/** Support message. */ |
321 |
std::string supportMsg; |
310 |
}; |
322 |
}; |
311 |
/** Iterator type. */ |
323 |
/** Iterator type. */ |
312 |
typedef std::vector<struct IidInformation>::const_iterator Iterator; |
324 |
typedef std::vector<struct IidInformation>::const_iterator Iterator; |
|
617 |
} |
629 |
} |
618 |
|
630 |
|
619 |
void |
631 |
void |
620 |
IidManager::AddAttribute (uint16_t uid, |
632 |
IidManager::AddAttribute (uint16_t uid, |
621 |
std::string name, |
633 |
std::string name, |
622 |
std::string help, |
634 |
std::string help, |
623 |
uint32_t flags, |
635 |
uint32_t flags, |
624 |
Ptr<const AttributeValue> initialValue, |
636 |
Ptr<const AttributeValue> initialValue, |
625 |
Ptr<const AttributeAccessor> accessor, |
637 |
Ptr<const AttributeAccessor> accessor, |
626 |
Ptr<const AttributeChecker> checker) |
638 |
Ptr<const AttributeChecker> checker, |
|
|
639 |
TypeId::SupportLevel supportLevel, |
640 |
const std::string &supportMsg) |
627 |
{ |
641 |
{ |
628 |
NS_LOG_FUNCTION (this << uid << name << help << flags << initialValue << accessor << checker); |
642 |
NS_LOG_FUNCTION (IID << uid << name << help << flags |
|
|
643 |
<< initialValue << accessor << checker |
644 |
<< supportLevel << supportMsg); |
629 |
struct IidInformation *information = LookupInformation (uid); |
645 |
struct IidInformation *information = LookupInformation (uid); |
630 |
if (HasAttribute (uid, name)) |
646 |
if (HasAttribute (uid, name)) |
631 |
{ |
647 |
{ |
|
640 |
info.originalInitialValue = initialValue; |
656 |
info.originalInitialValue = initialValue; |
641 |
info.accessor = accessor; |
657 |
info.accessor = accessor; |
642 |
info.checker = checker; |
658 |
info.checker = checker; |
|
|
659 |
info.supportLevel = supportLevel; |
660 |
info.supportMsg = supportMsg; |
643 |
information->attributes.push_back (info); |
661 |
information->attributes.push_back (info); |
644 |
NS_LOG_LOGIC (IIDL << information->attributes.size () - 1); |
662 |
NS_LOG_LOGIC (IIDL << information->attributes.size () - 1); |
645 |
} |
663 |
} |
|
711 |
std::string name, |
729 |
std::string name, |
712 |
std::string help, |
730 |
std::string help, |
713 |
Ptr<const TraceSourceAccessor> accessor, |
731 |
Ptr<const TraceSourceAccessor> accessor, |
714 |
std::string callback) |
732 |
std::string callback, |
|
|
733 |
TypeId::SupportLevel supportLevel, |
734 |
const std::string &supportMsg) |
715 |
{ |
735 |
{ |
716 |
NS_LOG_FUNCTION (this << uid << name << help << accessor); |
736 |
NS_LOG_FUNCTION (IID << uid << name << help |
|
|
737 |
<< accessor << callback |
738 |
<< supportLevel << supportMsg); |
717 |
struct IidInformation *information = LookupInformation (uid); |
739 |
struct IidInformation *information = LookupInformation (uid); |
718 |
if (HasTraceSource (uid, name)) |
740 |
if (HasTraceSource (uid, name)) |
719 |
{ |
741 |
{ |
|
725 |
source.help = help; |
747 |
source.help = help; |
726 |
source.accessor = accessor; |
748 |
source.accessor = accessor; |
727 |
source.callback = callback; |
749 |
source.callback = callback; |
|
|
750 |
source.supportLevel = supportLevel; |
751 |
source.supportMsg = supportMsg; |
728 |
information->traceSources.push_back (source); |
752 |
information->traceSources.push_back (source); |
729 |
NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1); |
753 |
NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1); |
730 |
} |
754 |
} |
|
845 |
struct TypeId::AttributeInformation tmp = tid.GetAttribute(i); |
869 |
struct TypeId::AttributeInformation tmp = tid.GetAttribute(i); |
846 |
if (tmp.name == name) |
870 |
if (tmp.name == name) |
847 |
{ |
871 |
{ |
848 |
*info = tmp; |
872 |
if (tmp.supportLevel == TypeId::SUPPORTED) |
849 |
return true; |
873 |
{ |
|
|
874 |
*info = tmp; |
875 |
return true; |
876 |
} |
877 |
else if (tmp.supportLevel == TypeId::DEPRECATED) |
878 |
{ |
879 |
NS_LOG_UNCOND ("Attribute '" << name << "' is deprecated: " |
880 |
<< tmp.supportMsg); |
881 |
*info = tmp; |
882 |
return true; |
883 |
} |
884 |
else if (tmp.supportLevel == TypeId::OBSOLETE) |
885 |
{ |
886 |
NS_FATAL_ERROR ("Attribute '" << name |
887 |
<< "' is obsolete, with no fallback: " |
888 |
<< tmp.supportMsg); |
889 |
} |
850 |
} |
890 |
} |
851 |
} |
891 |
} |
852 |
nextTid = tid.GetParent (); |
892 |
nextTid = tid.GetParent (); |
|
950 |
std::string help, |
990 |
std::string help, |
951 |
const AttributeValue &initialValue, |
991 |
const AttributeValue &initialValue, |
952 |
Ptr<const AttributeAccessor> accessor, |
992 |
Ptr<const AttributeAccessor> accessor, |
953 |
Ptr<const AttributeChecker> checker) |
993 |
Ptr<const AttributeChecker> checker, |
|
|
994 |
SupportLevel supportLevel, |
995 |
const std::string &supportMsg) |
954 |
{ |
996 |
{ |
955 |
NS_LOG_FUNCTION (this << name << help << &initialValue << accessor << checker); |
997 |
NS_LOG_FUNCTION (this << name << help |
956 |
IidManager::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue.Copy (), accessor, checker); |
998 |
<< &initialValue << accessor << checker |
|
|
999 |
<< supportLevel << supportMsg); |
1000 |
IidManager::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, |
1001 |
initialValue.Copy (), accessor, checker, |
1002 |
supportLevel, supportMsg); |
957 |
return *this; |
1003 |
return *this; |
958 |
} |
1004 |
} |
959 |
|
1005 |
|
|
963 |
uint32_t flags, |
1009 |
uint32_t flags, |
964 |
const AttributeValue &initialValue, |
1010 |
const AttributeValue &initialValue, |
965 |
Ptr<const AttributeAccessor> accessor, |
1011 |
Ptr<const AttributeAccessor> accessor, |
966 |
Ptr<const AttributeChecker> checker) |
1012 |
Ptr<const AttributeChecker> checker, |
|
|
1013 |
SupportLevel supportLevel, |
1014 |
const std::string &supportMsg) |
967 |
{ |
1015 |
{ |
968 |
NS_LOG_FUNCTION (this << name << help << flags << &initialValue << accessor << checker); |
1016 |
NS_LOG_FUNCTION (this << name << help << flags |
969 |
IidManager::Get ()->AddAttribute (m_tid, name, help, flags, initialValue.Copy (), accessor, checker); |
1017 |
<< &initialValue << accessor << checker |
|
|
1018 |
<< supportLevel << supportMsg); |
1019 |
IidManager::Get ()->AddAttribute (m_tid, name, help, flags, |
1020 |
initialValue.Copy (), accessor, checker, |
1021 |
supportLevel, supportMsg); |
970 |
return *this; |
1022 |
return *this; |
971 |
} |
1023 |
} |
972 |
|
1024 |
|
|
1042 |
TypeId::AddTraceSource (std::string name, |
1094 |
TypeId::AddTraceSource (std::string name, |
1043 |
std::string help, |
1095 |
std::string help, |
1044 |
Ptr<const TraceSourceAccessor> accessor, |
1096 |
Ptr<const TraceSourceAccessor> accessor, |
1045 |
std::string callback) |
1097 |
std::string callback, |
|
|
1098 |
SupportLevel supportLevel, |
1099 |
const std::string &supportMsg) |
1046 |
{ |
1100 |
{ |
1047 |
NS_LOG_FUNCTION (this << name << help << accessor); |
1101 |
NS_LOG_FUNCTION (this << name << help |
1048 |
IidManager::Get ()->AddTraceSource (m_tid, name, help, accessor, callback); |
1102 |
<< accessor << callback |
|
|
1103 |
<< supportLevel << supportMsg); |
1104 |
IidManager::Get ()->AddTraceSource (m_tid, name, help, |
1105 |
accessor, callback, |
1106 |
supportLevel, supportMsg); |
1049 |
return *this; |
1107 |
return *this; |
1050 |
} |
1108 |
} |
1051 |
|
1109 |
|
|
1071 |
struct TypeId::TraceSourceInformation tmp = tid.GetTraceSource (i); |
1129 |
struct TypeId::TraceSourceInformation tmp = tid.GetTraceSource (i); |
1072 |
if (tmp.name == name) |
1130 |
if (tmp.name == name) |
1073 |
{ |
1131 |
{ |
1074 |
return info.accessor; |
1132 |
if (tmp.supportLevel == TypeId::SUPPORTED) |
|
|
1133 |
{ |
1134 |
*info = tmp; |
1135 |
return tmp.accessor; |
1136 |
} |
1137 |
else if (tmp.supportLevel == TypeId::DEPRECATED) |
1138 |
{ |
1139 |
NS_LOG_UNCOND ("TraceSource '" << name << "' is deprecated: " |
1140 |
<< tmp.supportMsg); |
1141 |
*info = tmp; |
1142 |
return tmp.accessor; |
1143 |
} |
1144 |
else if (tmp.supportLevel == TypeId::OBSOLETE) |
1145 |
{ |
1146 |
NS_FATAL_ERROR ("TraceSource '" << name |
1147 |
<< "' is obsolete, with no fallback: " |
1148 |
<< tmp.supportMsg); |
1149 |
} |
1075 |
} |
1150 |
} |
1076 |
} |
1151 |
} |
1077 |
nextTid = tid.GetParent (); |
1152 |
nextTid = tid.GetParent (); |