Alexander Afanasyev | b7ad232 | 2012-01-17 22:54:49 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011,2012 University of California, Los Angeles |
| 4 | * |
| 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 |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef _BATCHES_H_ |
| 22 | #define _BATCHES_H_ |
| 23 | |
| 24 | #include "ns3/attribute.h" |
| 25 | #include "ns3/attribute-helper.h" |
| 26 | #include "ns3/nstime.h" |
| 27 | #include <list> |
| 28 | #include <boost/tuple/tuple.hpp> |
| 29 | |
| 30 | namespace ns3 { |
| 31 | |
| 32 | class Batches : public std::list<boost::tuple<Time, uint32_t> > |
| 33 | { |
| 34 | public: |
| 35 | Batches () { }; |
| 36 | |
| 37 | void |
| 38 | Add (const Time &when, uint32_t amount) |
| 39 | { |
| 40 | push_back (boost::make_tuple<Time, uint32_t> (when, amount)); |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | ATTRIBUTE_HELPER_HEADER (Batches); |
| 45 | |
| 46 | std::ostream & |
| 47 | operator << (std::ostream &os, const Batches &batch); |
| 48 | |
| 49 | /** |
| 50 | * \brief Read components from input and add them to components. Will read input stream till eof |
| 51 | * Substrings separated by slashes will become separate components |
| 52 | */ |
| 53 | std::istream & |
| 54 | operator >> (std::istream &is, Batches &batch); |
| 55 | |
| 56 | } // namespace ns3 |
| 57 | |
| 58 | #endif // _BATCHES_H_ |