-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnection.cpp
More file actions
55 lines (47 loc) · 1.32 KB
/
Copy pathConnection.cpp
File metadata and controls
55 lines (47 loc) · 1.32 KB
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
#include "Connection.hpp"
Connection::Connection()
{
}
Connection::Connection( std::map < int , std::vector < Server > > msP)
{
mapServersP = msP;
createConnnections();
}
Connection::Connection( Connection const & ref)
{
*this = ref;
}
Connection const & Connection::operator=(Connection const & ref)
{
fd_map = ref.getFd_map();
mapServersF = ref.getMapServersF();
mapServersP = ref.getMapServersP();
return (*this);
}
Connection::~Connection()
{
}
void Connection::createConnnections ()
{
for (std::map<int , std::vector < Server > >::iterator i = mapServersP.begin(); i != mapServersP.end(); i++)
{
Socket tmp(i->first);
fd_map.insert(std::make_pair(tmp.getFd(), 0));
mapServersF.insert(std::make_pair(tmp.getFd(), i->second));
}
}
std::map < int , std::vector < Server > >const & Connection::getMapServersP() const
{
return mapServersP;
}
std::map < int , std::vector < Server > > const & Connection::getMapServersF() const
{
return mapServersF;
}
std::map < int, int > const & Connection::getFd_map() const
{
return fd_map;
}
void Connection::debug ()
{
}