A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/dbapi__svc__mapper_8cpp_source.html below:

NCBI C++ ToolKit: src/dbapi/driver/dbapi_svc_mapper.cpp Source File

52

string::size_type pos = 0;

55  if

(pos != string::npos) {

56

server = specification.

substr

(0, pos);

58  if

(specification[pos] ==

'@'

) {

61  if

(pos != string::npos) {

65  if

(specification[pos] ==

':'

) {

70

pos = specification.

find

(

"("

, pos + 1);

71  if

(pos != string::npos) {

74

specification.

substr

(pos + 1),

82

specification.

substr

(pos + 1),

95

specification.

substr

(pos + 1),

101

server = specification;

104  if

(server.

empty

() && host == 0) {

165  if

(

Top

().NotEmpty()) {

186

TDelegates::reverse_iterator dg_it =

m_Delegates

.rbegin();

187

TDelegates::reverse_iterator dg_end =

m_Delegates

.rend();

189  for

(; server.

Empty

() && dg_it != dg_end; ++dg_it) {

190

server = (*dg_it)->GetServer(service);

203

(*dg_it)->Exclude(service, server);

213

(*dg_it)->CleanExcluded(service);

220  if

((*dg_it)->HasExclusions(service)) {

229  const TSvrRef

& preferred_server,

235

(*dg_it)->SetPreference(service, preferred_server, preference);

244

TDelegates::const_reverse_iterator dg_it =

m_Delegates

.rbegin();

245

TDelegates::const_reverse_iterator dg_end =

m_Delegates

.rend();

246  for

(; serv_list->empty() && dg_it != dg_end; ++dg_it) {

247

(*dg_it)->GetServersList(service, serv_list);

256

TDelegates::reverse_iterator dg_it =

m_Delegates

.rbegin();

257

TDelegates::reverse_iterator dg_end =

m_Delegates

.rend();

258  for

(; options->empty() && dg_it != dg_end; ++dg_it) {

259

(*dg_it)->GetServerOptions(service, options);

269  if

((*dg_it)->RecordServer(extra)) {

347  const string

section_name

365

vector<string> server_name;

366  string

service_name = *cit;

376  if

(!server_name.empty()) {

379  ITERATE

(vector<string>, sn_it, server_name) {

380  double

tmp_preference = 0;

383  auto

cur_server =

make_server

(*sn_it, tmp_preference);

384  if

(tmp_preference < 0) {

385

cur_server->m_Ranking = 0;

386

}

else if

(tmp_preference >= 100) {

387

cur_server->m_Ranking = 100;

391

server_list.push_back(cur_server);

415  return

it->second.servers[(*it->second.distribution)(

m_RandomEngine

)];

429  if

(service.empty() || server.

Empty

()) {

436

server->

GetPort

(), preference));

438  if

(preference < 0) {

440

}

else if

(preference >= 100) {

445

server_list.push_back(

option

);

456  for

(

auto

svr : svc->second) {

457  if

(svr->Matches(*server, service)) {

471  for

(

auto

svr : svc->second) {

488

}

else if

(svc->second.size() == prefs->second.servers.size()) {

490

}

else if

(prefs->second.servers.size() != 1) {

493  return

prefs->second.servers[0]->GetRanking() < 100.0;

499  const TSvrRef

& preferred_server,

506  for

(

auto

svr : svc->second) {

507  if

(svr == preferred_server || *svr == *preferred_server) {

508  double

old_preference = svr->GetRanking();

509

svr->m_Ranking =

max

(0.0,

min

(100.0, preference));

510  if

(preference >= 100.0 && old_preference < 100.0) {

512

}

else if

(preference < 100.0 && old_preference >= 100.0) {

514

favorites.

erase

(find(favorites.begin(), favorites.end(),

516  if

(favorites.empty()) {

534

*options = it->second;

548

service_preferences.

servers

.clear();

553  if

( !(*it)->IsExcluded() ) {

554

service_preferences.

servers

.push_back(*it);

556

(

new

discrete_distribution<>({100.0}));

562

vector<double> weights;

563  bool

all_zero =

true

;

566  if

( !it->IsExcluded() ) {

567  weight

= it->GetRanking();

573

weights.push_back(

weight

);

576  for

(

auto

& w : weights) {

581

(

new

discrete_distribution<>(weights.begin(), weights.end()));

611  const string

section_name

628

vector<string> server_name;

629  string

service_name = *cit;

639  if

(!server_name.empty()) {

643  ITERATE

(vector<string>, sn_it, server_name) {

644  double

tmp_preference = 0;

662  Add

(service_name, cur_server, tmp_preference);

684  if

(!server_map.

empty

() && !usage_map.

empty

()) {

686  double

new_preference = su_it->first;

687  TSvrRef

cur_server = su_it->second;

692  if

(pr_it != server_map.

end

()) {

693

new_preference += 100 - pr_it->second;

695

new_preference += 100;

699

usage_map.

erase

(su_it);

723

it != usage_map.

end

();) {

725  if

(it->second->Matches(*server, service)) {

726

it = usage_map.

erase

(it);

746  const TSvrRef

& preferred_server,

754  if

(preference < 0) {

756

}

else if

(preference > 100) {

760  if

(pr_it != server_map.

end

()) {

761

pr_it->second = preference;

782  auto

baseline = uit->second.

begin

()->first;

783  for

(

const auto

&uit2 : uit->second) {

784  auto

sit2 = sit->second.find(uit2.second);

785  _ASSERT

(sit2 != sit->second.end());

786

rankings[sit2->first]

787

+=

exp2

(0.1 * (sit2->second + baseline - uit2.first));

789  for

(

const auto

& sit2 : sit->second) {

790  auto

rit = rankings.

find

(sit2.first);

793  if

(rit == rankings.

end

()) {

794

ranking =

exp2

(0.1 * sit2.second);

797

ranking = rit->second;

801

sit2.first->GetHost(),

802

sit2.first->GetPort(),

817  if

(preference < 0) {

819

}

else if

(preference > 100) {

843  if

(!ext_mapper.first.empty() && ext_mapper.second !=

NULL

) {

857  if

(

Top

().NotEmpty()) {

876

vector<string> service_name;

877  const string

section_name

879  const string

def_mapper_name =

891

(section_name,

"MAPPERS"

,

898

service_name.push_back(def_mapper_name);

901  ITERATE

(vector<string>, it, service_name) {

903  string

mapper_name = *it;

934  return "DEFAULT_NAME_MAPPER"

;

940  return "COR_NAME_MAPPER"

;

946  return "USER_DEFINED_RANDOM_DBNAME_MAPPER"

;

952  return "USER_DEFINED_PRIORITY_DBNAME_MAPPER"

;

958  return "UNIVERSAL_NAME_MAPPER"

;

virtual void SetPreference(const string &service, const TSvrRef &preferred_server, double preference=100.0)

Set up mapping preferences for a service preference - value between 0 and 100 (0 means *no particular...

virtual void Configure(const IRegistry *registry=NULL)

virtual string GetName(void) const

virtual TSvrRef GetServer(const string &service)

Map a service to a server.

CDBDefaultServiceMapper(void)

virtual ~CDBDefaultServiceMapper(void)

CDBServerOption – CDBServer extended with additional information that helps maintain a balanced pool ...

@ fState_Normal

Fully available.

@ fState_Excluded

Excluded by DBAPI.

Uint2 GetPort(void) const

const string & GetName(void) const

Uint4 GetHost(void) const

virtual void Exclude(const string &service, const TSvrRef &server)

Exclude a server from the mapping for a service.

virtual ~CDBServiceMapperCoR(void)

virtual TSvrRef GetServer(const string &service)

Map a service to a server.

virtual void GetServersList(const string &service, list< string > *serv_list) const

Get list of all servers for the given service disregarding any exclusions.

virtual void Configure(const IRegistry *registry=NULL)

virtual bool RecordServer(I_ConnectionExtra &extra) const

Given a connection that succeeded even though this service mapper was unable to identify a good serve...

virtual bool HasExclusions(const string &service) const

void Push(const CRef< IDBServiceMapper > &mapper)

virtual void GetServerOptions(const string &service, TOptions *options)

Get an annotated list of all servers for the given service.

CDBServiceMapperCoR(void)

CRef< IDBServiceMapper > Top(void) const

virtual void SetPreference(const string &service, const TSvrRef &preferred_server, double preference=100.0)

Set up mapping preferences for a service preference - value between 0 and 100 (0 means *no particular...

virtual string GetName(void) const

vector< CRef< IDBServiceMapper > > TDelegates

virtual void CleanExcluded(const string &service)

Clean the list of excluded servers for the given service.

void ConfigureFromRegistry(const IRegistry *registry=NULL)

DBServiceMapperTraits IDBServiceMapper traits.

static string GetName(void)

void Add(const string &service, const TSvrRef &server, double preference=0.0)

virtual ~CDBUDPriorityMapper(void)

TServiceUsageMap m_OrigServiceUsageMap

void ConfigureFromRegistry(const IRegistry *registry=NULL)

virtual void CleanExcluded(const string &service)

Clean the list of excluded servers for the given service.

virtual void Exclude(const string &service, const TSvrRef &server)

Exclude a server from the mapping for a service.

virtual void SetPreference(const string &service, const TSvrRef &preferred_server, double preference=100.0)

Set up mapping preferences for a service preference - value between 0 and 100 (0 means *no particular...

CDBUDPriorityMapper(const IRegistry *registry=NULL)

virtual void Configure(const IRegistry *registry=NULL)

virtual TSvrRef GetServer(const string &service)

Map a service to a server.

TServiceUsageMap m_ServiceUsageMap

virtual string GetName(void) const

static IDBServiceMapper * Factory(const IRegistry *registry)

virtual void GetServerOptions(const string &service, TOptions *options)

Get an annotated list of all servers for the given service.

default_random_engine m_RandomEngine

virtual void CleanExcluded(const string &service)

Clean the list of excluded servers for the given service.

TPreferenceMap m_PreferenceMap

virtual string GetName(void) const

virtual void Configure(const IRegistry *registry=NULL)

static IDBServiceMapper * Factory(const IRegistry *registry)

void ConfigureFromRegistry(const IRegistry *registry=NULL)

void x_RecalculatePreferences(const string &service)

virtual ~CDBUDRandomMapper(void)

virtual void SetPreference(const string &service, const TSvrRef &preferred_server, double preference=100.0)

Set up mapping preferences for a service preference - value between 0 and 100 (0 means *no particular...

TServiceMap m_FavoritesMap

virtual void GetServerOptions(const string &service, TOptions *options)

Get an annotated list of all servers for the given service.

virtual TSvrRef GetServer(const string &service)

Map a service to a server.

void Add(const string &service, const TSvrRef &server, double preference=0.0)

virtual bool HasExclusions(const string &service) const

virtual void Exclude(const string &service, const TSvrRef &server)

Exclude a server from the mapping for a service.

CDBUDRandomMapper(const IRegistry *registry=NULL)

pair< string, TFactory > TMapperConf

virtual string GetName(void) const

CDBUniversalMapper(const IRegistry *registry=nullptr, const TMapperConf &ext_mapper=TMapperConf(kEmptyStr,(TFactory) nullptr))

void ConfigureFromRegistry(const IRegistry *registry=NULL)

TMapperConf m_ExtMapperConf

virtual void Configure(const IRegistry *registry=NULL)

virtual ~CDBUniversalMapper(void)

static CNcbiApplication * Instance(void)

Singleton method.

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

virtual void CleanExcluded(const string &service)

Clean the list of excluded servers for the given service.

list< CRef< CDBServerOption > > TOptions

virtual string GetName(void) const

virtual void Exclude(const string &service, const TSvrRef &server)

Exclude a server from the mapping for a service.

container_type::const_iterator const_iterator

container_type::iterator iterator

const_iterator begin() const

const_iterator end() const

iterator_bool insert(const value_type &val)

container_type::value_type value_type

const_iterator find(const key_type &key) const

const_iterator end() const

iterator insert(const value_type &val)

const_iterator begin() const

container_type::iterator iterator

container_type::value_type value_type

static CRef< CDBServerOption > make_server(const CTempString &specification, double &preference)

const CNcbiRegistry & GetConfig(void) const

Get the application's cached configuration parameters (read-only).

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

#define NON_CONST_ITERATE(Type, Var, Cont)

Non constant version of ITERATE macro.

#define REVERSE_ITERATE(Type, Var, Cont)

ITERATE macro to reverse sequence through container elements.

#define DATABASE_DRIVER_ERROR(message, err_code)

bool NotNull(void) const THROWS_NONE

Check if pointer is not null – same effect as NotEmpty().

bool Empty(void) const THROWS_NONE

Check if CRef is empty – not pointing to any object, which means having a null value.

uint32_t Uint4

4-byte (32-bit) unsigned integer

uint16_t Uint2

2-byte (16-bit) unsigned integer

virtual void EnumerateEntries(const string &section, list< string > *entries, TFlags flags=fAllLayers) const

Enumerate parameter names for a specified section.

virtual string GetString(const string &section, const string &name, const string &default_value, TFlags flags=0) const

Get the parameter string value.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-insensitive compare of a substring with another string.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

bool empty(void) const

Return true if the represented string is empty (i.e., the length is zero)

static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)

Convert string to unsigned int.

CTempString substr(size_type pos) const

Obtain a substring from this string, beginning at a given offset.

size_type find_first_of(const CTempString match, size_type pos=0) const

Find the first occurrence of any character in the matching string within the current string,...

size_type find(const CTempString match, size_type pos=0) const

Find the first instance of the entire matching string within the current string, beginning at an opti...

@ fConvErr_NoThrow

Do not throw an exception on error.

@ fAllowTrailingSymbols

Ignore trailing non-numerics characters.

@ fAllowLeadingSpaces

Ignore leading whitespace characters in converted string.

@ fSplit_MergeDelimiters

Merge adjacent delimiters.

CRef< CDBServer > TSvrRef

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

vector< CRef< CDBServerOption > > servers

unique_ptr< discrete_distribution<> > distribution

static wxAcceleratorEntry entries[3]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4