LEFT | RIGHT |
(no file at all) | |
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 University of Washington | 3 * Copyright (c) 2009 University of Washington |
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 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 * | 1419 * |
1420 * \param [in] reserve The number of entries to reserve | 1420 * \param [in] reserve The number of entries to reserve |
1421 */ | 1421 */ |
1422 void Reserve (uint32_t reserve); | 1422 void Reserve (uint32_t reserve); |
1423 | 1423 |
1424 /** | 1424 /** |
1425 * \param [in] vector The test vector to add | 1425 * \param [in] vector The test vector to add |
1426 *· | 1426 *· |
1427 * \returns The new test vector index | 1427 * \returns The new test vector index |
1428 */ | 1428 */ |
1429 uint32_t Add (T vector); | 1429 std::size_t Add (T vector); |
1430 | 1430 |
1431 /** | 1431 /** |
1432 * \brief Get the total number of test vectors. | 1432 * \brief Get the total number of test vectors. |
1433 * \return The number of test vectors | 1433 * \return The number of test vectors |
1434 */ | 1434 */ |
1435 uint32_t GetN (void) const; | 1435 std::size_t GetN (void) const; |
1436 /** | 1436 /** |
1437 * \brief Get the i'th test vector | 1437 * \brief Get the i'th test vector |
1438 * \param [in] i The requested vector index | 1438 * \param [in] i The requested vector index |
1439 * \return The requested vector | 1439 * \return The requested vector |
1440 */ | 1440 */ |
1441 T Get (uint32_t i) const; | 1441 T Get (std::size_t i) const; |
1442 | 1442 |
1443 private: | 1443 private: |
1444 typedef std::vector<T> TestVector; //!< Container type | 1444 typedef std::vector<T> TestVector; //!< Container type |
1445 TestVector m_vectors; //!< The list of test vectors | 1445 TestVector m_vectors; //!< The list of test vectors |
1446 }; | 1446 }; |
1447 | 1447 |
1448 template <typename T> | 1448 template <typename T> |
1449 TestVectors<T>::TestVectors () | 1449 TestVectors<T>::TestVectors () |
1450 : m_vectors () | 1450 : m_vectors () |
1451 { | 1451 { |
1452 } | 1452 } |
1453 | 1453 |
1454 template <typename T> | 1454 template <typename T> |
1455 void | 1455 void |
1456 TestVectors<T>::Reserve (uint32_t reserve) | 1456 TestVectors<T>::Reserve (uint32_t reserve) |
1457 { | 1457 { |
1458 m_vectors.reserve (reserve); | 1458 m_vectors.reserve (reserve); |
1459 } | 1459 } |
1460 | 1460 |
1461 template <typename T> | 1461 template <typename T> |
1462 TestVectors<T>::~TestVectors () | 1462 TestVectors<T>::~TestVectors () |
1463 { | 1463 { |
1464 } | 1464 } |
1465 | 1465 |
1466 template <typename T> | 1466 template <typename T> |
1467 uint32_t | 1467 std::size_t |
1468 TestVectors<T>::Add (T vector) | 1468 TestVectors<T>::Add (T vector) |
1469 { | 1469 { |
1470 uint32_t index = m_vectors.size (); | 1470 std::size_t index = m_vectors.size (); |
1471 m_vectors.push_back (vector); | 1471 m_vectors.push_back (vector); |
1472 return index; | 1472 return index; |
1473 } | 1473 } |
1474 | 1474 |
1475 template <typename T> | 1475 template <typename T> |
1476 uint32_t | 1476 std::size_t |
1477 TestVectors<T>::GetN (void) const | 1477 TestVectors<T>::GetN (void) const |
1478 { | 1478 { |
1479 return m_vectors.size (); | 1479 return m_vectors.size (); |
1480 } | 1480 } |
1481 | 1481 |
1482 template <typename T> | 1482 template <typename T> |
1483 T | 1483 T |
1484 TestVectors<T>::Get (uint32_t i) const | 1484 TestVectors<T>::Get (std::size_t i) const |
1485 { | 1485 { |
1486 NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index"); | 1486 NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index"); |
1487 return m_vectors[i]; | 1487 return m_vectors[i]; |
1488 } | 1488 } |
1489 | 1489 |
1490 } // namespace ns3· | 1490 } // namespace ns3· |
1491 | 1491 |
1492 #endif /* NS3_TEST_H */ | 1492 #endif /* NS3_TEST_H */ |
LEFT | RIGHT |