-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIfaces.cpp
54 lines (45 loc) · 973 Bytes
/
Ifaces.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* File: Ifaces.cpp
* Author: xpalam00
*
* Created on 12. únor 2012, 16:17
*/
#include <vector>
#include "Ifaces.hpp"
Ifaces::Ifaces()
{
}
Ifaces::~Ifaces()
{
this->ifaces.clear();
}
void Ifaces::add(Iface *iface)
{
this->ifaces.push_back(iface);
}
Iface *Ifaces::next()
{
if(this->currentIterator == this->ifaces.end()) return NULL;
Iface *iface = *(this->currentIterator);
if( this->currentIterator == this->ifaces.end() ) return NULL;
else
{
this->currentIterator++;
return iface;
}
}
void Ifaces::reset()
{
this->currentIterator = this->ifaces.begin();
}
ostream &operator<<(ostream &stream, Ifaces *ifaces)
{
stream << "Iface\tSent-B\tSent-frm\tRecv-B\tRecv-frm" << endl;
Iface *iface = NULL;
ifaces->reset();
while( (iface=ifaces->next()) != NULL )
{
stream << iface->getName() << "\t" << iface->getSentB() << "\t" << iface->getSentFrm() << "\t" << iface->getRecvB() << "\t" << iface->getRecvFrm() << endl;
}
return stream;
}