Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 /** | 164 /** |
165 * Check if a type id has a constructor Callback. | 165 * Check if a type id has a constructor Callback. |
166 * \param [in] uid The id. | 166 * \param [in] uid The id. |
167 * \returns \c true if the type id has a constructor Callback. | 167 * \returns \c true if the type id has a constructor Callback. |
168 */ | 168 */ |
169 bool HasConstructor (uint16_t uid) const; | 169 bool HasConstructor (uint16_t uid) const; |
170 /** | 170 /** |
171 * Get the total number of type ids. | 171 * Get the total number of type ids. |
172 * \returns The total number. | 172 * \returns The total number. |
173 */ | 173 */ |
174 uint32_t GetRegisteredN (void) const; | 174 uint16_t GetRegisteredN (void) const; |
175 /** | 175 /** |
176 * Get a type id by index. | 176 * Get a type id by index. |
177 * | 177 * |
178 * The type id value 0 indicates not registerd, so there is an offset | 178 * The type id value 0 indicates not registerd, so there is an offset |
179 * of 1 between the index and the type id value. This function converts | 179 * of 1 between the index and the type id value. This function converts |
180 * from an index to the type id value. | 180 * from an index to the type id value. |
181 * \param [in] i The index. | 181 * \param [in] i The index. |
182 * \returns The type id. | 182 * \returns The type id. |
183 */ | 183 */ |
184 uint16_t GetRegistered (uint32_t i) const; | 184 uint16_t GetRegistered (uint16_t i) const; |
185 /** | 185 /** |
186 * Record a new attribute in a type id. | 186 * Record a new attribute in a type id. |
187 * \param [in] uid The id. | 187 * \param [in] uid The id. |
188 * \param [in] name The name of the new attribute | 188 * \param [in] name The name of the new attribute |
189 * \param [in] help Some help text which describes the purpose of this | 189 * \param [in] help Some help text which describes the purpose of this |
190 * attribute. | 190 * attribute. |
191 * \param [in] flags Flags which describe how this attribute can be | 191 * \param [in] flags Flags which describe how this attribute can be |
192 * read and/or written. | 192 * read and/or written. |
193 * \param [in] initialValue The initial value for this attribute. | 193 * \param [in] initialValue The initial value for this attribute. |
194 * \param [in] accessor An instance of the associated AttributeAccessor | 194 * \param [in] accessor An instance of the associated AttributeAccessor |
(...skipping 11 matching lines...) Expand all Loading... | |
206 Ptr<const AttributeAccessor> accessor, | 206 Ptr<const AttributeAccessor> accessor, |
207 Ptr<const AttributeChecker> checker, | 207 Ptr<const AttributeChecker> checker, |
208 TypeId::SupportLevel supportLevel = TypeId::SUPPORTED, | 208 TypeId::SupportLevel supportLevel = TypeId::SUPPORTED, |
209 const std::string &supportMsg = ""); | 209 const std::string &supportMsg = ""); |
210 /** | 210 /** |
211 * Set the initial value of an Attribute. | 211 * Set the initial value of an Attribute. |
212 * \param [in] uid The id. | 212 * \param [in] uid The id. |
213 * \param [in] i The attribute to manipulate | 213 * \param [in] i The attribute to manipulate |
214 * \param [in] initialValue The new initial value to use for this attribute. | 214 * \param [in] initialValue The new initial value to use for this attribute. |
215 */ | 215 */ |
216 void SetAttributeInitialValue(uint16_t uid, | 216 void SetAttributeInitialValue (uint16_t uid, |
217 uint32_t i, | 217 std::size_t i, |
218 Ptr<const AttributeValue> initialValue); | 218 Ptr<const AttributeValue> initialValue); |
219 /** | 219 /** |
220 * Get the number of attributes. | 220 * Get the number of attributes. |
221 * \param [in] uid The id. | 221 * \param [in] uid The id. |
222 * \returns The number of attributes associated to this TypeId | 222 * \returns The number of attributes associated to this TypeId |
223 */ | 223 */ |
224 uint32_t GetAttributeN (uint16_t uid) const; | 224 std::size_t GetAttributeN (uint16_t uid) const; |
225 /** | 225 /** |
226 * Get Attribute information by index. | 226 * Get Attribute information by index. |
227 * \param [in] uid The id. | 227 * \param [in] uid The id. |
228 * \param [in] i Index into attribute array | 228 * \param [in] i Index into attribute array |
229 * \returns The information associated to attribute whose index is \p i. | 229 * \returns The information associated to attribute whose index is \p i. |
230 */ | 230 */ |
231 struct TypeId::AttributeInformation GetAttribute(uint16_t uid, uint32_t i) con st; | 231 struct TypeId::AttributeInformation GetAttribute (uint16_t uid, std::size_t i) const; |
232 /** | 232 /** |
233 * Record a new TraceSource. | 233 * Record a new TraceSource. |
234 * \param [in] uid The id. | 234 * \param [in] uid The id. |
235 * \param [in] name The name of the new trace source | 235 * \param [in] name The name of the new trace source |
236 * \param [in] help Some help text which describes the purpose of this | 236 * \param [in] help Some help text which describes the purpose of this |
237 * trace source. | 237 * trace source. |
238 * \param [in] accessor A pointer to a TraceSourceAccessor which can be | 238 * \param [in] accessor A pointer to a TraceSourceAccessor which can be |
239 * used to connect/disconnect sinks to this trace source. | 239 * used to connect/disconnect sinks to this trace source. |
240 * \param [in] callback Fully qualified typedef name for the callback | 240 * \param [in] callback Fully qualified typedef name for the callback |
241 * signature. Generally this should begin with the | 241 * signature. Generally this should begin with the |
242 * "ns3::" namespace qualifier.·· | 242 * "ns3::" namespace qualifier.·· |
243 * \param [in] supportLevel The support/deprecation status for this attribute. | 243 * \param [in] supportLevel The support/deprecation status for this attribute. |
244 * \param [in] supportMsg Upgrade hint if this attribute is no longer supporte d. | 244 * \param [in] supportMsg Upgrade hint if this attribute is no longer supporte d. |
245 * \returns This TypeId instance. | 245 * \returns This TypeId instance. |
246 */ | 246 */ |
247 void AddTraceSource (uint16_t uid, | 247 void AddTraceSource (uint16_t uid, |
248 std::string name,· | 248 std::string name,· |
249 std::string help, | 249 std::string help, |
250 Ptr<const TraceSourceAccessor> accessor, | 250 Ptr<const TraceSourceAccessor> accessor, |
251 std::string callback, | 251 std::string callback, |
252 TypeId::SupportLevel supportLevel = TypeId::SUPPORTED, | 252 TypeId::SupportLevel supportLevel = TypeId::SUPPORTED, |
253 const std::string &supportMsg = ""); | 253 const std::string &supportMsg = ""); |
254 /** | 254 /** |
255 * Get the number of Trace sources. | 255 * Get the number of Trace sources. |
256 * \param [in] uid The id. | 256 * \param [in] uid The id. |
257 * \returns The number of trace sources defined in this TypeId. | 257 * \returns The number of trace sources defined in this TypeId. |
258 */ | 258 */ |
259 uint32_t GetTraceSourceN (uint16_t uid) const; | 259 std::size_t GetTraceSourceN (uint16_t uid) const; |
260 /** | 260 /** |
261 * Get the trace source by index. | 261 * Get the trace source by index. |
262 * \param [in] uid The id. | 262 * \param [in] uid The id. |
263 * \param [in] i Index into trace source array. | 263 * \param [in] i Index into trace source array. |
264 * \returns Detailed information about the requested trace source. | 264 * \returns Detailed information about the requested trace source. |
265 */ | 265 */ |
266 struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, uint32_t i) const; | 266 struct TypeId::TraceSourceInformation GetTraceSource (uint16_t uid, std::size_ t i) const; |
267 /** | 267 /** |
268 * Check if this TypeId should not be listed in documentation. | 268 * Check if this TypeId should not be listed in documentation. |
269 * \param [in] uid The id. | 269 * \param [in] uid The id. |
270 * \returns \c true if this TypeId should be hidden from the user. | 270 * \returns \c true if this TypeId should be hidden from the user. |
271 */ | 271 */ |
272 bool MustHideFromDocumentation (uint16_t uid) const; | 272 bool MustHideFromDocumentation (uint16_t uid) const; |
273 | 273 |
274 private: | 274 private: |
275 /** | 275 /** |
276 * Check if a type id has a given TraceSource. | 276 * Check if a type id has a given TraceSource. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 // Alphabetize the two types, so it's deterministic | 416 // Alphabetize the two types, so it's deterministic |
417 struct IidInformation * hinfo = LookupInformation (GetUid (hash)); | 417 struct IidInformation * hinfo = LookupInformation (GetUid (hash)); |
418 if (name > hinfo->name) | 418 if (name > hinfo->name) |
419 { // new type gets chained | 419 { // new type gets chained |
420 NS_LOG_LOGIC (IIDL << "New TypeId '" << name << "' getting chained."); | 420 NS_LOG_LOGIC (IIDL << "New TypeId '" << name << "' getting chained."); |
421 hash = hash | HashChainFlag; | 421 hash = hash | HashChainFlag; |
422 } | 422 } |
423 else | 423 else |
424 { // chain old type | 424 { // chain old type |
425 NS_LOG_LOGIC (IIDL << "Old TypeId '" << hinfo->name << "' getting chaine d."); | 425 NS_LOG_LOGIC (IIDL << "Old TypeId '" << hinfo->name << "' getting chaine d."); |
426 uint32_t oldUid = GetUid (hinfo->hash); | 426 uint16_t oldUid = GetUid (hinfo->hash); |
427 m_hashmap.erase (m_hashmap.find (hinfo->hash)); | 427 m_hashmap.erase (m_hashmap.find (hinfo->hash)); |
428 hinfo->hash = hash | HashChainFlag; | 428 hinfo->hash = hash | HashChainFlag; |
429 m_hashmap.insert (std::make_pair (hinfo->hash, oldUid)); | 429 m_hashmap.insert (std::make_pair (hinfo->hash, oldUid)); |
430 // leave new hash unchained | 430 // leave new hash unchained |
431 } | 431 } |
432 } | 432 } |
433 | 433 |
434 struct IidInformation information; | 434 struct IidInformation information; |
435 information.name = name; | 435 information.name = name; |
436 information.hash = hash; | 436 information.hash = hash; |
437 information.parent = 0; | 437 information.parent = 0; |
438 information.groupName = ""; | 438 information.groupName = ""; |
439 information.size = (std::size_t)(-1); | 439 information.size = (std::size_t)(-1); |
440 information.hasConstructor = false; | 440 information.hasConstructor = false; |
441 information.mustHideFromDocumentation = false; | 441 information.mustHideFromDocumentation = false; |
442 m_information.push_back (information); | 442 m_information.push_back (information); |
443 uint32_t uid = m_information.size (); | 443 std::size_t tuid = m_information.size(); |
444 NS_ASSERT (uid <= 0xffff); | 444 NS_ASSERT (tuid <= 0xffff); |
445 uint16_t uid = static_cast<uint16_t> (tuid); | |
445 | 446 |
446 // Add to both maps: | 447 // Add to both maps: |
447 m_namemap.insert (std::make_pair (name, uid)); | 448 m_namemap.insert (std::make_pair (name, uid)); |
448 m_hashmap.insert (std::make_pair (hash, uid)); | 449 m_hashmap.insert (std::make_pair (hash, uid)); |
449 NS_LOG_LOGIC (IIDL << uid); | 450 NS_LOG_LOGIC (IIDL << uid); |
450 return uid; | 451 return static_cast<uint16_t> (uid); |
Peter Barnes
2018/05/11 21:58:12
Unnecessary cast; uid is already uint16_t
ammo6818-vandals.uidaho.edu
2018/05/16 15:06:29
Removed
| |
451 } | 452 } |
452 | 453 |
453 struct IidManager::IidInformation * | 454 struct IidManager::IidInformation * |
454 IidManager::LookupInformation (uint16_t uid) const | 455 IidManager::LookupInformation (uint16_t uid) const |
455 { | 456 { |
456 NS_LOG_FUNCTION (IID << uid); | 457 NS_LOG_FUNCTION (IID << uid); |
457 NS_ASSERT (uid <= m_information.size () && uid != 0); | 458 NS_ASSERT (uid <= m_information.size () && uid != 0); |
458 NS_LOG_LOGIC (IIDL << m_information[uid-1].name); | 459 NS_LOG_LOGIC (IIDL << m_information[uid-1].name); |
459 return const_cast<struct IidInformation *> (&m_information[uid-1]); | 460 return const_cast<struct IidInformation *> (&m_information[uid-1]); |
460 } | 461 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
587 bool· | 588 bool· |
588 IidManager::HasConstructor (uint16_t uid) const | 589 IidManager::HasConstructor (uint16_t uid) const |
589 { | 590 { |
590 NS_LOG_FUNCTION (IID << uid); | 591 NS_LOG_FUNCTION (IID << uid); |
591 struct IidInformation *information = LookupInformation (uid); | 592 struct IidInformation *information = LookupInformation (uid); |
592 bool hasC = information->hasConstructor; | 593 bool hasC = information->hasConstructor; |
593 NS_LOG_LOGIC (IIDL << hasC); | 594 NS_LOG_LOGIC (IIDL << hasC); |
594 return hasC; | 595 return hasC; |
595 } | 596 } |
596 | 597 |
597 uint32_t· | 598 uint16_t· |
598 IidManager::GetRegisteredN (void) const | 599 IidManager::GetRegisteredN (void) const |
599 { | 600 { |
600 NS_LOG_FUNCTION (IID << m_information.size ()); | 601 NS_LOG_FUNCTION (IID << m_information.size ()); |
601 return m_information.size (); | 602 return static_cast<uint16_t> (m_information.size ()); |
602 } | 603 } |
603 uint16_t· | 604 uint16_t· |
604 IidManager::GetRegistered (uint32_t i) const | 605 IidManager::GetRegistered (uint16_t i) const |
605 { | 606 { |
606 NS_LOG_FUNCTION (IID << i); | 607 NS_LOG_FUNCTION (IID << i); |
607 return i + 1; | 608 return i + 1; |
608 } | 609 } |
609 | 610 |
610 bool | 611 bool |
611 IidManager::HasAttribute (uint16_t uid, | 612 IidManager::HasAttribute (uint16_t uid, |
612 std::string name) | 613 std::string name) |
613 { | 614 { |
614 NS_LOG_FUNCTION (IID << uid << name); | 615 NS_LOG_FUNCTION (IID << uid << name); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 info.initialValue = initialValue; | 672 info.initialValue = initialValue; |
672 info.originalInitialValue = initialValue; | 673 info.originalInitialValue = initialValue; |
673 info.accessor = accessor; | 674 info.accessor = accessor; |
674 info.checker = checker; | 675 info.checker = checker; |
675 info.supportLevel = supportLevel; | 676 info.supportLevel = supportLevel; |
676 info.supportMsg = supportMsg; | 677 info.supportMsg = supportMsg; |
677 information->attributes.push_back (info); | 678 information->attributes.push_back (info); |
678 NS_LOG_LOGIC (IIDL << information->attributes.size () - 1); | 679 NS_LOG_LOGIC (IIDL << information->attributes.size () - 1); |
679 } | 680 } |
680 void· | 681 void· |
681 IidManager::SetAttributeInitialValue(uint16_t uid, | 682 IidManager::SetAttributeInitialValue (uint16_t uid, |
682 uint32_t i, | 683 std::size_t i, |
683 Ptr<const AttributeValue> initialValue) | 684 Ptr<const AttributeValue> initialValue) |
684 { | 685 { |
685 NS_LOG_FUNCTION (IID << uid << i << initialValue); | 686 NS_LOG_FUNCTION (IID << uid << i << initialValue); |
686 struct IidInformation *information = LookupInformation (uid); | 687 struct IidInformation *information = LookupInformation (uid); |
687 NS_ASSERT (i < information->attributes.size ()); | 688 NS_ASSERT (i < information->attributes.size ()); |
688 information->attributes[i].initialValue = initialValue; | 689 information->attributes[i].initialValue = initialValue; |
689 } | 690 } |
690 | 691 |
691 | 692 |
692 | 693 |
693 uint32_t | 694 std::size_t |
694 IidManager::GetAttributeN (uint16_t uid) const | 695 IidManager::GetAttributeN (uint16_t uid) const |
695 { | 696 { |
696 NS_LOG_FUNCTION (IID << uid); | 697 NS_LOG_FUNCTION (IID << uid); |
697 struct IidInformation *information = LookupInformation (uid); | 698 struct IidInformation *information = LookupInformation (uid); |
698 uint32_t size = information->attributes.size (); | 699 std::size_t size = information->attributes.size (); |
699 NS_LOG_LOGIC (IIDL << size); | 700 NS_LOG_LOGIC (IIDL << size); |
700 return size; | 701 return size; |
701 } | 702 } |
702 struct TypeId::AttributeInformation· | 703 struct TypeId::AttributeInformation· |
703 IidManager::GetAttribute(uint16_t uid, uint32_t i) const | 704 IidManager::GetAttribute (uint16_t uid, std::size_t i) const |
704 { | 705 { |
705 NS_LOG_FUNCTION (IID << uid << i); | 706 NS_LOG_FUNCTION (IID << uid << i); |
706 struct IidInformation *information = LookupInformation (uid); | 707 struct IidInformation *information = LookupInformation (uid); |
707 NS_ASSERT (i < information->attributes.size ()); | 708 NS_ASSERT (i < information->attributes.size ()); |
708 NS_LOG_LOGIC (IIDL << information->name); | 709 NS_LOG_LOGIC (IIDL << information->name); |
709 return information->attributes[i]; | 710 return information->attributes[i]; |
710 } | 711 } |
711 | 712 |
712 bool | 713 bool |
713 IidManager::HasTraceSource (uint16_t uid, | 714 IidManager::HasTraceSource (uint16_t uid, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 struct TypeId::TraceSourceInformation source; | 762 struct TypeId::TraceSourceInformation source; |
762 source.name = name; | 763 source.name = name; |
763 source.help = help; | 764 source.help = help; |
764 source.accessor = accessor; | 765 source.accessor = accessor; |
765 source.callback = callback; | 766 source.callback = callback; |
766 source.supportLevel = supportLevel; | 767 source.supportLevel = supportLevel; |
767 source.supportMsg = supportMsg; | 768 source.supportMsg = supportMsg; |
768 information->traceSources.push_back (source); | 769 information->traceSources.push_back (source); |
769 NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1); | 770 NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1); |
770 } | 771 } |
771 uint32_t | 772 std::size_t |
772 IidManager::GetTraceSourceN (uint16_t uid) const | 773 IidManager::GetTraceSourceN (uint16_t uid) const |
773 { | 774 { |
774 NS_LOG_FUNCTION (IID << uid); | 775 NS_LOG_FUNCTION (IID << uid); |
775 struct IidInformation *information = LookupInformation (uid); | 776 struct IidInformation *information = LookupInformation (uid); |
776 uint32_t size = information->traceSources.size (); | 777 std::size_t size = information->traceSources.size (); |
777 NS_LOG_LOGIC (IIDL << size); | 778 NS_LOG_LOGIC (IIDL << size); |
778 return size; | 779 return size; |
779 } | 780 } |
780 struct TypeId::TraceSourceInformation· | 781 struct TypeId::TraceSourceInformation· |
781 IidManager::GetTraceSource(uint16_t uid, uint32_t i) const | 782 IidManager::GetTraceSource (uint16_t uid, std::size_t i) const |
782 { | 783 { |
783 NS_LOG_FUNCTION (IID << uid << i); | 784 NS_LOG_FUNCTION (IID << uid << i); |
784 struct IidInformation *information = LookupInformation (uid); | 785 struct IidInformation *information = LookupInformation (uid); |
785 NS_ASSERT (i < information->traceSources.size ()); | 786 NS_ASSERT (i < information->traceSources.size ()); |
786 NS_LOG_LOGIC (IIDL << information->name); | 787 NS_LOG_LOGIC (IIDL << information->name); |
787 return information->traceSources[i]; | 788 return information->traceSources[i]; |
788 } | 789 } |
789 bool· | 790 bool· |
790 IidManager::MustHideFromDocumentation (uint16_t uid) const | 791 IidManager::MustHideFromDocumentation (uint16_t uid) const |
791 { | 792 { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
852 { | 853 { |
853 uint16_t uid = IidManager::Get ()->GetUid (hash); | 854 uint16_t uid = IidManager::Get ()->GetUid (hash); |
854 if (uid == 0) | 855 if (uid == 0) |
855 { | 856 { |
856 return false; | 857 return false; |
857 } | 858 } |
858 *tid = TypeId (uid); | 859 *tid = TypeId (uid); |
859 return true; | 860 return true; |
860 } | 861 } |
861 | 862 |
862 uint32_t· | 863 uint16_t· |
863 TypeId::GetRegisteredN (void) | 864 TypeId::GetRegisteredN (void) |
864 { | 865 { |
865 NS_LOG_FUNCTION_NOARGS (); | 866 NS_LOG_FUNCTION_NOARGS (); |
866 return IidManager::Get ()->GetRegisteredN (); | 867 return IidManager::Get ()->GetRegisteredN (); |
867 } | 868 } |
868 TypeId· | 869 TypeId· |
869 TypeId::GetRegistered (uint32_t i) | 870 TypeId::GetRegistered (uint16_t i) |
870 { | 871 { |
871 NS_LOG_FUNCTION (i); | 872 NS_LOG_FUNCTION (i); |
872 return TypeId (IidManager::Get ()->GetRegistered (i)); | 873 return TypeId (IidManager::Get ()->GetRegistered (i)); |
873 } | 874 } |
874 | 875 |
875 bool | 876 bool |
876 TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInforma tion *info) const | 877 TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInforma tion *info) const |
877 { | 878 { |
878 NS_LOG_FUNCTION (this << name << info); | 879 NS_LOG_FUNCTION (this << name << info); |
879 TypeId tid; | 880 TypeId tid; |
880 TypeId nextTid = *this; | 881 TypeId nextTid = *this; |
881 do { | 882 do { |
882 tid = nextTid; | 883 tid = nextTid; |
883 for (uint32_t i = 0; i < tid.GetAttributeN (); i++) | 884 for (std::size_t i = 0; i < tid.GetAttributeN (); i++) |
884 { | 885 { |
885 struct TypeId::AttributeInformation tmp = tid.GetAttribute(i); | 886 struct TypeId::AttributeInformation tmp = tid.GetAttribute (i); |
886 if (tmp.name == name) | 887 if (tmp.name == name) |
887 { | 888 { |
888 if (tmp.supportLevel == TypeId::SUPPORTED) | 889 if (tmp.supportLevel == TypeId::SUPPORTED) |
889 { | 890 { |
890 *info = tmp; | 891 *info = tmp; |
891 return true; | 892 return true; |
892 } | 893 } |
893 else if (tmp.supportLevel == TypeId::DEPRECATED) | 894 else if (tmp.supportLevel == TypeId::DEPRECATED) |
894 { | 895 { |
895 std::cerr << "Attribute '" << name << "' is deprecated: " | 896 std::cerr << "Attribute '" << name << "' is deprecated: " |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1032 NS_LOG_FUNCTION (this << name << help << flags | 1033 NS_LOG_FUNCTION (this << name << help << flags |
1033 << &initialValue << accessor << checker | 1034 << &initialValue << accessor << checker |
1034 << supportLevel << supportMsg); | 1035 << supportLevel << supportMsg); |
1035 IidManager::Get ()->AddAttribute (m_tid, name, help, flags, | 1036 IidManager::Get ()->AddAttribute (m_tid, name, help, flags, |
1036 initialValue.Copy (), accessor, checker, | 1037 initialValue.Copy (), accessor, checker, |
1037 supportLevel, supportMsg); | 1038 supportLevel, supportMsg); |
1038 return *this; | 1039 return *this; |
1039 } | 1040 } |
1040 | 1041 |
1041 bool· | 1042 bool· |
1042 TypeId::SetAttributeInitialValue(uint32_t i,· | 1043 TypeId::SetAttributeInitialValue (std::size_t i, |
1043 Ptr<const AttributeValue> initialValue) | 1044 Ptr<const AttributeValue> initialValue) |
1044 { | 1045 { |
1045 NS_LOG_FUNCTION (this << i << initialValue); | 1046 NS_LOG_FUNCTION (this << i << initialValue); |
1046 IidManager::Get ()->SetAttributeInitialValue (m_tid, i, initialValue); | 1047 IidManager::Get ()->SetAttributeInitialValue (m_tid, i, initialValue); |
1047 return true; | 1048 return true; |
1048 } | 1049 } |
1049 | 1050 |
1050 | 1051 |
1051 Callback<ObjectBase *>· | 1052 Callback<ObjectBase *>· |
1052 TypeId::GetConstructor (void) const | 1053 TypeId::GetConstructor (void) const |
1053 { | 1054 { |
1054 NS_LOG_FUNCTION (this); | 1055 NS_LOG_FUNCTION (this); |
1055 Callback<ObjectBase *> cb = IidManager::Get ()->GetConstructor (m_tid); | 1056 Callback<ObjectBase *> cb = IidManager::Get ()->GetConstructor (m_tid); |
1056 return cb; | 1057 return cb; |
1057 } | 1058 } |
1058 | 1059 |
1059 bool· | 1060 bool· |
1060 TypeId::MustHideFromDocumentation (void) const | 1061 TypeId::MustHideFromDocumentation (void) const |
1061 { | 1062 { |
1062 NS_LOG_FUNCTION (this); | 1063 NS_LOG_FUNCTION (this); |
1063 bool mustHide = IidManager::Get ()->MustHideFromDocumentation (m_tid); | 1064 bool mustHide = IidManager::Get ()->MustHideFromDocumentation (m_tid); |
1064 return mustHide; | 1065 return mustHide; |
1065 } | 1066 } |
1066 | 1067 |
1067 uint32_t | 1068 std::size_t |
1068 TypeId::GetAttributeN (void) const | 1069 TypeId::GetAttributeN (void) const |
1069 { | 1070 { |
1070 NS_LOG_FUNCTION (this); | 1071 NS_LOG_FUNCTION (this); |
1071 uint32_t n = IidManager::Get ()->GetAttributeN (m_tid); | 1072 std::size_t n = IidManager::Get()->GetAttributeN (m_tid); |
1072 return n; | 1073 return n; |
1073 } | 1074 } |
1074 struct TypeId::AttributeInformation· | 1075 struct TypeId::AttributeInformation· |
1075 TypeId::GetAttribute(uint32_t i) const | 1076 TypeId::GetAttribute (std::size_t i) const |
1076 { | 1077 { |
1077 NS_LOG_FUNCTION (this << i); | 1078 NS_LOG_FUNCTION (this << i); |
1078 return IidManager::Get ()->GetAttribute(m_tid, i); | 1079 return IidManager::Get ()->GetAttribute (m_tid, i); |
1079 } | 1080 } |
1080 std::string· | 1081 std::string· |
1081 TypeId::GetAttributeFullName (uint32_t i) const | 1082 TypeId::GetAttributeFullName (std::size_t i) const |
1082 { | 1083 { |
1083 NS_LOG_FUNCTION (this << i); | 1084 NS_LOG_FUNCTION (this << i); |
1084 struct TypeId::AttributeInformation info = GetAttribute(i); | 1085 struct TypeId::AttributeInformation info = GetAttribute (i); |
1085 return GetName () + "::" + info.name; | 1086 return GetName () + "::" + info.name; |
1086 } | 1087 } |
1087 | 1088 |
1088 uint32_t | 1089 std::size_t |
1089 TypeId::GetTraceSourceN (void) const | 1090 TypeId::GetTraceSourceN (void) const |
1090 { | 1091 { |
1091 NS_LOG_FUNCTION (this); | 1092 NS_LOG_FUNCTION (this); |
1092 return IidManager::Get ()->GetTraceSourceN (m_tid); | 1093 return IidManager::Get ()->GetTraceSourceN (m_tid); |
1093 } | 1094 } |
1094 struct TypeId::TraceSourceInformation· | 1095 struct TypeId::TraceSourceInformation· |
1095 TypeId::GetTraceSource(uint32_t i) const | 1096 TypeId::GetTraceSource (std::size_t i) const |
1096 { | 1097 { |
1097 NS_LOG_FUNCTION (this << i); | 1098 NS_LOG_FUNCTION (this << i); |
1098 return IidManager::Get ()->GetTraceSource(m_tid, i); | 1099 return IidManager::Get ()->GetTraceSource(m_tid, i); |
1099 } | 1100 } |
1100 | 1101 |
1101 TypeId· | 1102 TypeId· |
1102 TypeId::AddTraceSource (std::string name, | 1103 TypeId::AddTraceSource (std::string name, |
1103 std::string help, | 1104 std::string help, |
1104 Ptr<const TraceSourceAccessor> accessor) | 1105 Ptr<const TraceSourceAccessor> accessor) |
1105 { | 1106 { |
(...skipping 28 matching lines...) Expand all Loading... | |
1134 Ptr<const TraceSourceAccessor> | 1135 Ptr<const TraceSourceAccessor> |
1135 TypeId::LookupTraceSourceByName (std::string name, | 1136 TypeId::LookupTraceSourceByName (std::string name, |
1136 struct TraceSourceInformation *info) const | 1137 struct TraceSourceInformation *info) const |
1137 { | 1138 { |
1138 NS_LOG_FUNCTION (this << name); | 1139 NS_LOG_FUNCTION (this << name); |
1139 TypeId tid; | 1140 TypeId tid; |
1140 TypeId nextTid = *this; | 1141 TypeId nextTid = *this; |
1141 struct TypeId::TraceSourceInformation tmp; | 1142 struct TypeId::TraceSourceInformation tmp; |
1142 do { | 1143 do { |
1143 tid = nextTid; | 1144 tid = nextTid; |
1144 for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++) | 1145 for (std::size_t i = 0; i < tid.GetTraceSourceN(); i++) |
1145 { | 1146 { |
1146 tmp = tid.GetTraceSource (i); | 1147 tmp = tid.GetTraceSource (i); |
1147 if (tmp.name == name) | 1148 if (tmp.name == name) |
1148 { | 1149 { |
1149 if (tmp.supportLevel == TypeId::SUPPORTED) | 1150 if (tmp.supportLevel == TypeId::SUPPORTED) |
1150 { | 1151 { |
1151 *info = tmp; | 1152 *info = tmp; |
1152 return tmp.accessor; | 1153 return tmp.accessor; |
1153 } | 1154 } |
1154 else if (tmp.supportLevel == TypeId::DEPRECATED) | 1155 else if (tmp.supportLevel == TypeId::DEPRECATED) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1222 | 1223 |
1223 | 1224 |
1224 ATTRIBUTE_HELPER_CPP (TypeId); | 1225 ATTRIBUTE_HELPER_CPP (TypeId); |
1225 | 1226 |
1226 bool operator < (TypeId a, TypeId b) | 1227 bool operator < (TypeId a, TypeId b) |
1227 { | 1228 { |
1228 return a.m_tid < b.m_tid; | 1229 return a.m_tid < b.m_tid; |
1229 } | 1230 } |
1230 | 1231 |
1231 } // namespace ns3 | 1232 } // namespace ns3 |
OLD | NEW |