xrpld
Loading...
Searching...
No Matches
SourceStrings.cpp
1#include <xrpl/peerfinder/detail/SourceStrings.h>
2
3#include <xrpl/beast/net/IPEndpoint.h>
4#include <xrpl/beast/utility/Journal.h>
5#include <xrpl/peerfinder/detail/Source.h>
6
7#include <memory>
8#include <string>
9#include <utility>
10
11namespace xrpl::peer_finder {
12
14{
15public:
17 : name_(std::move(name)), strings_(std::move(strings))
18 {
19 }
20
21 ~SourceStringsImp() override = default;
22
23 std::string const&
24 name() override
25 {
26 return name_;
27 }
28
29 void
30 fetch(Results& results, beast::Journal journal) override
31 {
32 results.addresses.resize(0);
33 results.addresses.reserve(strings_.size());
34 for (auto const& str : strings_)
35 {
37 if (isUnspecified(ep))
39 if (!isUnspecified(ep))
40 results.addresses.push_back(ep);
41 }
42 }
43
44private:
47};
48
49//------------------------------------------------------------------------------
50
53{
55}
56
57} // namespace xrpl::peer_finder
A generic endpoint for log messages.
Definition Journal.h:44
A version-independent IP address and port combination.
Definition IPEndpoint.h:24
static Endpoint fromString(std::string const &s)
void fetch(Results &results, beast::Journal journal) override
SourceStringsImp(std::string name, Strings strings)
~SourceStringsImp() override=default
std::string const & name() override
std::vector< std::string > Strings
static std::shared_ptr< Source > make(std::string const &name, Strings const &strings)
virtual std::string const & name()=0
T make_shared(T... args)
STL namespace.
T push_back(T... args)
T reserve(T... args)
T resize(T... args)
The results of a fetch.
Definition Source.h:28