NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
batches.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "batches.hpp"
21 
22 namespace ns3 {
23 
24 ATTRIBUTE_HELPER_CPP(Batches);
25 
26 std::ostream&
27 operator<<(std::ostream& os, const Batches& batch)
28 {
29  for (Batches::const_iterator i = batch.begin(); i != batch.end(); i++)
30  os << std::get<0>(*i) << " " << std::get<1>(*i) << " ";
31 
32  return os;
33 }
34 
39 std::istream&
40 operator>>(std::istream& is, Batches& batch)
41 {
42  Time time;
43  uint32_t amount;
44  while (!is.eof()) {
45  is >> time >> amount;
46  batch.Add(time, amount);
47  // std::cout << time << ", " << amount << ". \n";
48  }
49 
50  return is;
51 }
52 }
std::ostream & operator<<(std::ostream &os, const Batches &batch)
Output contents of the Batches to the std::ostream.
Definition: batches.cpp:27
void Add(const Time &when, uint32_t amount)
Add tuple.
Definition: batches.hpp:49
Class representing sets of (time, number) tuples with support of reading writing to streams.
Definition: batches.hpp:36
std::istream & operator>>(std::istream &is, Batches &batch)
Read components from input and add them to components.
Definition: batches.cpp:40
Copyright (c) 2011-2015 Regents of the University of California.