NetworkConnectionManager.h
1 
10 #ifndef WRENCH_NETWORKCONNECTIONMANAGER_H
11 #define WRENCH_NETWORKCONNECTIONMANAGER_H
12 
13 
14 #include <string>
15 #include <deque>
16 #include "wrench/services/storage/simple/NetworkConnection.h"
17 
18 namespace wrench {
19 
20  /***********************/
22  /***********************/
23 
28 
29  public:
30  NetworkConnectionManager(unsigned long max_num_data_connections);
31 
32  void addConnection(std::unique_ptr<NetworkConnection> connection);
33 
34  std::pair<std::unique_ptr<NetworkConnection>, bool> waitForNetworkConnection();
35 
36 
37  private:
38  unsigned long max_num_data_connections;
39 
40  void startQueuedDataConnections();
41 
42  std::deque<std::unique_ptr<NetworkConnection>> queued_data_connections;
43  std::vector<std::unique_ptr<NetworkConnection>> running_data_connections;
44  std::unique_ptr<NetworkConnection> running_control_connection = nullptr;
45 
46 
47  };
48 
49  /***********************/
51  /***********************/
52 };
53 
54 
55 #endif //WRENCH_NETWORKCONNECTIONMANAGER_H
std::pair< std::unique_ptr< NetworkConnection >, bool > waitForNetworkConnection()
Wait for the next network connection to change state.
Definition: NetworkConnectionManager.cpp:31
void addConnection(std::unique_ptr< NetworkConnection > connection)
Add a new connection.
Definition: NetworkConnectionManager.cpp:74
NetworkConnectionManager(unsigned long max_num_data_connections)
Constructor.
Definition: NetworkConnectionManager.cpp:23
Definition: TerminalOutput.cpp:15
An abstraction that manages a pool of network connections.
Definition: NetworkConnectionManager.h:27