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) 2009 The Georgia Institute of Technology· | 3 * Copyright (c) 2009 The Georgia Institute of Technology· |
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 m_used += numberOfBits; | 209 m_used += numberOfBits; |
210 return extractedBits; | 210 return extractedBits; |
211 } | 211 } |
212 | 212 |
213 uint32_t | 213 uint32_t |
214 NixVector::GetSerializedSize (void) const | 214 NixVector::GetSerializedSize (void) const |
215 { | 215 { |
216 NS_LOG_FUNCTION (this); | 216 NS_LOG_FUNCTION (this); |
217 uint32_t totalSizeInBytes = 0; | 217 uint32_t totalSizeInBytes = 0; |
218 totalSizeInBytes = sizeof (m_used) + sizeof (m_currentVectorBitSize) +· | 218 totalSizeInBytes = sizeof (m_used) + sizeof (m_currentVectorBitSize) +· |
219 sizeof (m_totalBitSize) + (4 * m_nixVector.size ()); | 219 sizeof (m_totalBitSize) + static_cast<uint32_t> ((4 * m_nixVector.size ())); |
220 | 220 |
221 return totalSizeInBytes; | 221 return totalSizeInBytes; |
222 } | 222 } |
223 | 223 |
224 uint32_t | 224 uint32_t |
225 NixVector::Serialize (uint32_t* buffer, uint32_t maxSize) const | 225 NixVector::Serialize (uint32_t* buffer, uint32_t maxSize) const |
226 { | 226 { |
227 NS_LOG_FUNCTION (this << buffer << maxSize); | 227 NS_LOG_FUNCTION (this << buffer << maxSize); |
228 uint32_t* p = buffer; | 228 uint32_t* p = buffer; |
229 uint32_t size = 0; | 229 uint32_t size = 0; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 // return zero if an entire nix-vector was· | 313 // return zero if an entire nix-vector was· |
314 // not deserialized | 314 // not deserialized |
315 return (sizeCheck != 0) ? 0 : 1; | 315 return (sizeCheck != 0) ? 0 : 1; |
316 } | 316 } |
317 | 317 |
318 void | 318 void |
319 NixVector::DumpNixVector (std::ostream &os) const | 319 NixVector::DumpNixVector (std::ostream &os) const |
320 { | 320 { |
321 NS_LOG_FUNCTION (this << &os); | 321 NS_LOG_FUNCTION (this << &os); |
322 uint32_t i = m_nixVector.size (); | 322 uint32_t i = static_cast<uint32_t> (m_nixVector.size ()); |
323 std::vector<uint32_t>::const_reverse_iterator rIter; | 323 std::vector<uint32_t>::const_reverse_iterator rIter; |
324 for (rIter = m_nixVector.rbegin (); rIter != m_nixVector.rend (); rIter++) | 324 for (rIter = m_nixVector.rbegin (); rIter != m_nixVector.rend (); rIter++) |
325 { | 325 { |
326 uint32_t numBits = BitCount (*rIter); | 326 uint32_t numBits = BitCount (*rIter); |
327 | 327 |
328 // all this work just to get the nix· | 328 // all this work just to get the nix· |
329 // vector to print out neat | 329 // vector to print out neat |
330 | 330 |
331 // if it's not the first entry in the vector,· | 331 // if it's not the first entry in the vector,· |
332 // we may have to add some zeros and fill· | 332 // we may have to add some zeros and fill· |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 os << 1; | 435 os << 1; |
436 } | 436 } |
437 else | 437 else |
438 { | 438 { |
439 PrintDec2BinNixFill (decimalNum / 2, bitCount, os); | 439 PrintDec2BinNixFill (decimalNum / 2, bitCount, os); |
440 os << decimalNum % 2; | 440 os << decimalNum % 2; |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 } // namespace ns3 | 444 } // namespace ns3 |
OLD | NEW |