1 #include "ncbi_pch.hpp"
2 #include <sstream>
3 #include <iterator>
4 #include "Mirror.h"
5 #include "Domain.h"
6
7 ///////////////////////////////////////////////////////////////////////
8
9 const string CDomain::prefix_cfg_section_domain = "servers_";
10
CDomain(const string & section_name,const string & entrie_name,const CNcbiRegistry & config,const CMirror & mirror)11 CDomain::CDomain( const string §ion_name, const string &entrie_name, const CNcbiRegistry &config, const CMirror &mirror ):
12 m_Mirror( mirror )
13 {
14 m_Name = entrie_name.substr( prefix_cfg_section_domain.size() );
15
16 transform(
17 istream_iterator<string>( istringstream( config.Get( section_name, entrie_name ) ) ),
18 istream_iterator<string>(),
19 inserter( m_Servers, m_Servers.begin() ),
20 [&](string address)
21 {
22 return pair< string, shared_ptr< CServer > >( address, new CServer( address, *this ) );
23 });
24 }
25 /*
26 bool CDomain::test_connectivity()
27 {
28 m_Connectable = false;
29
30 for_each( m_Servers.begin(), m_Servers.end(),
31 [&]( pair< string, shared_ptr< CServer > > pair_server )
32 {
33 m_Connectable |= pair_server.second->test_connectivity();
34 });
35
36 return m_Connectable;
37 }
38
39 bool CDomain::test_read()
40 {
41 bool result = true;
42
43 for_each( m_Servers.begin(), m_Servers.end(),
44 [&]( pair< string, shared_ptr< CServer > > pair_server )
45 {
46 result &= pair_server.second->test_read();
47 });
48
49 return result;
50 }
51
52 bool CDomain::test_write()
53 {
54 bool result = true;
55
56 for_each( m_Servers.begin(), m_Servers.end(),
57 [&]( pair< string, shared_ptr< CServer > > pair_server )
58 {
59 result &= pair_server.second->test_write();
60 });
61
62 return result;
63 }
64 */