本文整理汇总了C++中IServerSPtr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ IServerSPtr::reset方法的具体用法?C++ IServerSPtr::reset怎么用?C++ IServerSPtr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServerSPtr
的用法示例。
在下文中一共展示了IServerSPtr::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createServer
IServerSPtr ServersManager::createServer(IConnectionSettingsBaseSPtr settings)
{
DCHECK(settings);
IServerSPtr result;
connectionTypes conT = settings->connectionType();
IServerSPtr ser = findServerBySetting(settings);
if(conT == REDIS){
RedisServer *newRed = NULL;
if(!ser){
IDriverSPtr dr(new RedisDriver(settings));
dr->start();
newRed = new RedisServer(dr, true);
}
else{
newRed = new RedisServer(ser->driver(), false);
}
result.reset(newRed);
servers_.push_back(result);
}
else if(conT == MEMCACHED){
MemcachedServer *newMem = NULL;
if(!ser){
IDriverSPtr dr(new MemcachedDriver(settings));
dr->start();
newMem = new MemcachedServer(dr, true);
}
else{
newMem = new MemcachedServer(ser->driver(), false);
}
result.reset(newMem);
servers_.push_back(result);
}
else if(conT == SSDB){
SsdbServer *newSsdb = NULL;
if(!ser){
IDriverSPtr dr(new SsdbDriver(settings));
dr->start();
newSsdb = new SsdbServer(dr, true);
}
else{
newSsdb = new SsdbServer(ser->driver(), false);
}
result.reset(newSsdb);
servers_.push_back(result);
}
DCHECK(result);
if(ser && syncServers_){
result->syncWithServer(ser.get());
}
return result;
}
示例2: createServer
IServerSPtr ServersManager::createServer(IConnectionSettingsBaseSPtr settings)
{
DCHECK(settings);
IServerSPtr result;
connectionTypes conT = settings->connectionType();
IServerSPtr ser = findServerBySetting(settings);
#ifdef BUILD_WITH_REDIS
if(conT == REDIS){
result.reset(make_server<RedisServer, RedisDriver>(ser, settings));
}
#endif
#ifdef BUILD_WITH_MEMCACHED
if(conT == MEMCACHED){
result.reset(make_server<MemcachedServer, MemcachedDriver>(ser, settings));
}
#endif
#ifdef BUILD_WITH_SSDB
if(conT == SSDB){
result.reset(make_server<SsdbServer, SsdbDriver>(ser, settings));
}
#endif
#ifdef BUILD_WITH_LEVELDB
if(conT == LEVELDB){
result.reset(make_server<LeveldbServer, LeveldbDriver>(ser, settings));
}
#endif
DCHECK(result);
if(result){
servers_.push_back(result);
if(ser && syncServers_){
result->syncWithServer(ser.get());
}
}
return result;
}