LEFT | RIGHT |
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) 2007 INRIA, Mathieu Lacage | 3 * Copyright (c) 2007 INRIA, Mathieu Lacage |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 ObjectPtrContainerValue::Iterator | 44 ObjectPtrContainerValue::Iterator |
45 ObjectPtrContainerValue::End (void) const | 45 ObjectPtrContainerValue::End (void) const |
46 { | 46 { |
47 NS_LOG_FUNCTION (this); | 47 NS_LOG_FUNCTION (this); |
48 return m_objects.end (); | 48 return m_objects.end (); |
49 } | 49 } |
50 std::size_t | 50 std::size_t |
51 ObjectPtrContainerValue::GetN (void) const | 51 ObjectPtrContainerValue::GetN (void) const |
52 { | 52 { |
53 NS_LOG_FUNCTION (this); | 53 NS_LOG_FUNCTION (this); |
54 return static_cast<uint32_t>(m_objects.size ()); | 54 return m_objects.size (); |
55 } | 55 } |
56 Ptr<Object> | 56 Ptr<Object> |
57 ObjectPtrContainerValue::Get(std::size_t i) const | 57 ObjectPtrContainerValue::Get (std::size_t i) const |
58 { | 58 { |
59 NS_LOG_FUNCTION (this << i); | 59 NS_LOG_FUNCTION (this << i); |
60 const unsigned int j = static_cast<const unsigned int> (i); | 60 Iterator it = m_objects.find (i);· |
61 Iterator it = m_objects.find (j);· | |
62 Ptr<Object> value = 0; | 61 Ptr<Object> value = 0; |
63 if ( it != m_objects.end () ) | 62 if ( it != m_objects.end () ) |
64 { | 63 { |
65 value = m_objects.find (j)->second; | 64 value = m_objects.find (i)->second; |
66 } | 65 } |
67 return value; | 66 return value; |
68 } | 67 } |
69 | 68 |
70 Ptr<AttributeValue> | 69 Ptr<AttributeValue> |
71 ObjectPtrContainerValue::Copy (void) const | 70 ObjectPtrContainerValue::Copy (void) const |
72 { | 71 { |
73 NS_LOG_FUNCTION (this); | 72 NS_LOG_FUNCTION (this); |
74 return ns3::Create<ObjectPtrContainerValue> (*this); | 73 return ns3::Create<ObjectPtrContainerValue> (*this); |
75 } | 74 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 { | 112 { |
114 return false; | 113 return false; |
115 } | 114 } |
116 v->m_objects.clear (); | 115 v->m_objects.clear (); |
117 std::size_t n; | 116 std::size_t n; |
118 bool ok = DoGetN (object, &n); | 117 bool ok = DoGetN (object, &n); |
119 if (!ok) | 118 if (!ok) |
120 { | 119 { |
121 return false; | 120 return false; |
122 } | 121 } |
123 for (uint32_t i = 0; i < n; i++) | 122 for (std::size_t i = 0; i < n; i++) |
124 { | 123 { |
125 std::size_t index; | 124 std::size_t index; |
126 Ptr<Object> o = DoGet (object, i, &index); | 125 Ptr<Object> o = DoGet (object, i, &index); |
127 v->m_objects.insert (std::pair <uint32_t, Ptr<Object> > (static_cast<uint3
2_t> (index), o)); | 126 v->m_objects[index] = o; |
128 } | 127 } |
129 return true; | 128 return true; |
130 } | 129 } |
131 bool· | 130 bool· |
132 ObjectPtrContainerAccessor::HasGetter (void) const | 131 ObjectPtrContainerAccessor::HasGetter (void) const |
133 { | 132 { |
134 NS_LOG_FUNCTION (this); | 133 NS_LOG_FUNCTION (this); |
135 return true; | 134 return true; |
136 } | 135 } |
137 bool· | 136 bool· |
138 ObjectPtrContainerAccessor::HasSetter (void) const | 137 ObjectPtrContainerAccessor::HasSetter (void) const |
139 { | 138 { |
140 NS_LOG_FUNCTION (this); | 139 NS_LOG_FUNCTION (this); |
141 return false; | 140 return false; |
142 } | 141 } |
143 | 142 |
144 } // name | 143 } // name |
LEFT | RIGHT |