preCICE
v3.1.2
Loading...
Searching...
No Matches
src
com
SocketCommunicationFactory.cpp
Go to the documentation of this file.
1
#include "
SocketCommunicationFactory.hpp
"
2
#include <
memory
>
3
#include <
utility
>
4
5
#include "
SocketCommunication.hpp
"
6
#include "
com/SharedPointer.hpp
"
7
#include "
utils/networking.hpp
"
8
9
namespace
precice::com
{
10
SocketCommunicationFactory::SocketCommunicationFactory
(
11
unsigned
short
portNumber,
12
bool
reuseAddress,
13
std::string
networkName,
14
std::string
addressDirectory)
15
: _portNumber(portNumber),
16
_reuseAddress(reuseAddress),
17
_networkName(
std
::move(networkName)),
18
_addressDirectory(
std
::move(addressDirectory))
19
{
20
if
(
_addressDirectory
.
empty
()) {
21
_addressDirectory
=
"."
;
22
}
23
}
24
25
SocketCommunicationFactory::SocketCommunicationFactory
(
26
std::string
const
&addressDirectory)
27
:
SocketCommunicationFactory
(0, false, utils::networking::loopbackInterfaceName(), addressDirectory)
28
{
29
}
30
31
PtrCommunication
SocketCommunicationFactory::newCommunication
()
32
{
33
return
std::make_shared<SocketCommunication>(
34
_portNumber
,
_reuseAddress
,
_networkName
,
_addressDirectory
);
35
}
36
37
std::string
SocketCommunicationFactory::addressDirectory
()
38
{
39
return
_addressDirectory
;
40
}
41
}
// namespace precice::com
SocketCommunicationFactory.hpp
SocketCommunication.hpp
std::string
precice::com::SocketCommunicationFactory
Definition
SocketCommunicationFactory.hpp:11
precice::com::SocketCommunicationFactory::_reuseAddress
bool _reuseAddress
Definition
SocketCommunicationFactory.hpp:26
precice::com::SocketCommunicationFactory::addressDirectory
std::string addressDirectory() override
Definition
SocketCommunicationFactory.cpp:37
precice::com::SocketCommunicationFactory::_portNumber
unsigned short _portNumber
Definition
SocketCommunicationFactory.hpp:25
precice::com::SocketCommunicationFactory::SocketCommunicationFactory
SocketCommunicationFactory(unsigned short portNumber=0, bool reuseAddress=false, std::string networkName=utils::networking::loopbackInterfaceName(), std::string addressDirectory=".")
Definition
SocketCommunicationFactory.cpp:10
precice::com::SocketCommunicationFactory::_networkName
std::string _networkName
Definition
SocketCommunicationFactory.hpp:27
precice::com::SocketCommunicationFactory::newCommunication
PtrCommunication newCommunication() override
Definition
SocketCommunicationFactory.cpp:31
precice::com::SocketCommunicationFactory::_addressDirectory
std::string _addressDirectory
Definition
SocketCommunicationFactory.hpp:28
SharedPointer.hpp
std::string::empty
T empty(T... args)
memory
precice::com
contains the data communication abstraction layer.
Definition
Communication.cpp:12
std
STL namespace.
networking.hpp
std::shared_ptr< Communication >
utility