src/core/attribute-list.cc
changeset 3892 f985e116b696
parent 3190 51fe9001a679
child 4252 c82988c68a35
equal deleted inserted replaced
3891:590b21d7fcdd 3892:f985e116b696
   254   } while (cur != str.size ());
   254   } while (cur != str.size ());
   255 
   255 
   256   return true;
   256   return true;
   257 }
   257 }
   258 
   258 
       
   259 UnsafeAttributeList::UnsafeAttributeList ()
       
   260 {}
       
   261 UnsafeAttributeList::UnsafeAttributeList (const UnsafeAttributeList &o)
       
   262 {
       
   263   for (uint32_t i = 0; i < o.m_attributes.size (); ++i)
       
   264     {
       
   265       Set (o.m_attributes[i].first, *(o.m_attributes[i].second));
       
   266     }
       
   267 }
       
   268 UnsafeAttributeList &
       
   269 UnsafeAttributeList::operator = (const UnsafeAttributeList &o)
       
   270 {
       
   271   m_attributes.clear ();
       
   272   for (uint32_t i = 0; i < o.m_attributes.size (); ++i)
       
   273     {
       
   274       Set (o.m_attributes[i].first, *(o.m_attributes[i].second));
       
   275     }
       
   276   return *this;
       
   277 }
       
   278 
       
   279 UnsafeAttributeList::~UnsafeAttributeList ()
       
   280 {
       
   281   m_attributes.clear ();
       
   282 }
       
   283 void 
       
   284 UnsafeAttributeList::Set (std::string name, const AttributeValue &param)
       
   285 {
       
   286   if (name == "")
       
   287     {
       
   288       return;
       
   289     }
       
   290   for (uint32_t i = 0; i < m_attributes.size (); ++i)
       
   291     {
       
   292       if (m_attributes[i].first == name)
       
   293         {
       
   294           m_attributes[i].second = param.Copy ();
       
   295           return;
       
   296         }
       
   297     }
       
   298   m_attributes.push_back (std::make_pair (name, param.Copy ()));
       
   299 }
       
   300 
       
   301 AttributeList 
       
   302 UnsafeAttributeList::GetSafe (std::string tidName) const
       
   303 {
       
   304   AttributeList list;
       
   305   for (uint32_t i = 0; i < m_attributes.size (); ++i)
       
   306     {
       
   307       TypeId tid = TypeId::LookupByName (tidName);
       
   308       list.SetWithTid (tid, m_attributes[i].first, *m_attributes[i].second);
       
   309     }
       
   310   return list;
       
   311 }
       
   312 
       
   313 
   259 } // namespace ns3
   314 } // namespace ns3