本文整理汇总了C++中ice::StringSeq类的典型用法代码示例。如果您正苦于以下问题:C++ StringSeq类的具体用法?C++ StringSeq怎么用?C++ StringSeq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringSeq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
StringSeq
AdminI::getAllRegistryNames(const Current&) const
{
Ice::StringSeq replicas = _database->getReplicaCache().getAll("");
replicas.push_back(_registry->getName());
return replicas;
}
示例2:
Ice::StringSeq
ReplicaGroupFilterI::filter(const string& /* replicaGroupId */,
const Ice::StringSeq& adapters,
const Ice::ConnectionPtr&,
const Ice::Context& ctx)
{
Ice::Context::const_iterator p = ctx.find("currency");
if(p == ctx.end())
{
return adapters;
}
string currency = p->second;
//
// Get the Currencies property value from the server descriptor
// that owns the adapter and only keep adapters for servers that
// are configured with the currency specified in the client
// context.
//
Ice::StringSeq filteredAdapters;
for(Ice::StringSeq::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
if(_facade->getPropertyForAdapter(*p, "Currencies").find(currency) != string::npos)
{
filteredAdapters.push_back(*p);
}
}
return filteredAdapters;
}
示例3: init
bool AgentAdapter::init(const ::Ice::StringSeq& defaultAgents,const bool is_udp_protocol, const bool is_compress)
{
if (defaultAgents.empty())
{
XLOG_ERROR("AgentAdapter::init defaultAgent is empty!");
return false;
}
srand(unsigned(time(NULL)));
Ice::PropertiesPtr props=Ice::createProperties();
props->setProperty("Ice.MessageSizeMax", ICE_MESSAGE_SIZE_MAX);
props->setProperty("Ice.Override.Timeout", ICE_TIMEOUT_MILLISECONDS);
Ice::InitializationData id;
id.properties=props;
_ic = ::Ice::initialize(id);
srand((unsigned) time(NULL));
current_agent_prx_number=0;
std::vector<slice::AgentPrx> _prxs;
for (::Ice::StringSeq::const_iterator it = defaultAgents.begin(); it != defaultAgents.end();
++it)
{
slice::AgentPrx prx = Util::getPrx<slice::AgentPrx>(_ic, *it, is_udp_protocol, 1000, is_compress);
_prxs.push_back(prx);
}
agent_prxs.swap(_prxs);
return true;
}
示例4: in
int
main(int argc, char* argv[])
{
ifstream in("./config/configPath");
if(!in)
{
test(false);
}
if(!getline(in, configPath))
{
test(false);
}
try
{
cout << "testing load properties from UTF-8 path... " << flush;
Ice::PropertiesPtr properties = Ice::createProperties();
properties->load(configPath);
test(properties->getProperty("Ice.Trace.Network") == "1");
test(properties->getProperty("Ice.Trace.Protocol") == "1");
test(properties->getProperty("Config.Path") == configPath);
test(properties->getProperty("Ice.ProgramName") == "PropertiesClient");
cout << "ok" << endl;
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
return EXIT_FAILURE;
}
cout << "testing load properties from UTF-8 path using Ice::Application... " << flush;
Client c;
c.main(argc, argv, configPath.c_str());
cout << "ok" << endl;
try
{
//
// Try to load multiple config files.
//
cout << "testing using Ice.Config with multiple config files... " << flush;
Ice::PropertiesPtr properties;
Ice::StringSeq args;
args.push_back("--Ice.Config=config/config.1, config/config.2, config/config.3");
IceUtilInternal::ArgVector a(args);
properties = Ice::createProperties(a.argc, a.argv);
test(properties->getProperty("Config1") == "Config1");
test(properties->getProperty("Config2") == "Config2");
test(properties->getProperty("Config3") == "Config3");
cout << "ok" << endl;
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
示例5: Connect
bool PSIDynamicICESender::Connect()
{
try
{
if(!FCommunicatorPtr)
{
Ice::StringSeq args;
string Tmp=GetICECommunicatorConfig(FHostIP,FHostPort);
args.push_back(Tmp);
args.push_back("Ice.ACM.Client=0");
args.push_back("Ice.MessageSizeMax=30000");
// FCommunicator = Ice::initialize(args);
FCommunicatorPtr = Ice::initialize();
cout<<FServiceName+":通讯器成功初始化!" <<std::endl;
}
Ice::ObjectPrx base=FCommunicatorPtr->stringToProxy(GetICEObjectConfig(FHostIP,FHostPort));
FSendBufferPrx=InfoDTV::Multiplexer::Dynamic::Provider::DynamicBufferTransferPrx::checkedCast(base);
if(!FSendBufferPrx)
{
if(FCommunicatorPtr)
{
FCommunicatorPtr->destroy();
FCommunicatorPtr=NULL;
}
return false;
}
}
catch (const Ice::Exception & e)
{
cout<<string(e.what())<<"dddd"<<std::endl;
if(FCommunicatorPtr)
{
FCommunicatorPtr->destroy();
FCommunicatorPtr=NULL;
}
return false;
}
catch (...)
{
cout<<FServiceName+":Connect:通讯器初始化失败!"<<std::endl;
// Console.Error.WriteLine(ex);
if(FCommunicatorPtr)
{
FCommunicatorPtr->destroy();
FCommunicatorPtr=NULL;
}
return false;
}
return true;
}
示例6:
Ice::StringSeq
NodeSessionI::getServers(const Ice::Current&) const
{
ServerEntrySeq servers = _database->getNode(_info->name)->getServers();
Ice::StringSeq names;
for(ServerEntrySeq::const_iterator p = servers.begin(); p != servers.end(); ++p)
{
names.push_back((*p)->getId());
}
return names;
}
示例7: sync
void
NodeI::checkConsistency(const NodeSessionPrx& session)
{
//
// Only do the consistency check on the startup. This ensures that servers can't
// be removed by a bogus master when the master session is re-established.
//
if(_consistencyCheckDone)
{
return;
}
_consistencyCheckDone = true;
//
// We use a serial number to keep track of the concurrent changes
// on the node. When a server is loaded/destroyed the serial is
// incremented. This allows to ensure that the list of servers
// returned by the registry is consistent with the servers
// currently deployed on the node: if the serial didn't change
// after getting the list of servers from the registry, we have
// the accurate list of servers that should be deployed on the
// node.
//
unsigned long serial = 0;
Ice::StringSeq servers;
vector<ServerCommandPtr> commands;
while(true)
{
{
Lock sync(*this);
if(serial == _serial)
{
_serial = 1; // We can reset the serial number.
commands = checkConsistencyNoSync(servers);
break;
}
serial = _serial;
}
assert(session);
try
{
servers = session->getServers();
}
catch(const Ice::LocalException&)
{
return; // The connection with the session was lost.
}
sort(servers.begin(), servers.end());
}
for_each(commands.begin(), commands.end(), IceUtil::voidMemFun(&ServerCommand::execute));
}
示例8: BookExistsException
Demo::BookPrx
LibraryI::createBook(const Demo::BookDescription& description, const Ice::Current& c)
{
IceUtil::Mutex::Lock lock(*this);
BookPrx book = IsbnToBook(c.adapter)(description.isbn);
try
{
book->ice_ping();
//
// The book already exists.
//
throw BookExistsException();
}
catch(const Ice::ObjectNotExistException&)
{
//
// Book doesn't exist, ignore the exception.
//
}
BookPtr bookI = new BookI(this);
bookI->description = description;
//
// Create a new Ice Object in the evictor, using the new identity
// and the new Servant.
//
// This can throw EvictorDeactivatedException (which indicates an
// internal error). The exception is currently ignored.
//
Ice::Identity ident = createBookIdentity(description.isbn);
_evictor->add(bookI, ident);
//
// Add the isbn number to the authors map.
//
Ice::StringSeq isbnSeq;
StringIsbnSeqDict::iterator p = _authors.find(description.authors);
if(p != _authors.end())
{
isbnSeq = p->second;
}
isbnSeq.push_back(description.isbn);
_authors.put(StringIsbnSeqDict::value_type(description.authors, isbnSeq));
return book;
}
示例9:
bool
IcePHP::createStringArray(zval* zv, const Ice::StringSeq& seq)
{
array_init(zv);
for(Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
if(add_next_index_stringl(zv, STRCAST(p->c_str()), static_cast<uint>(p->length())) == FAILURE)
{
return false;
}
}
return true;
}
示例10: assert
int
main(int argc, char* argv[])
#endif
{
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
assert(args.size() > 0);
const string appName = args[0];
Ice::InitializationData initData;
FreezeScript::CompactIdResolverIPtr resolver = new FreezeScript::CompactIdResolverI;
initData.compactIdResolver = resolver;
Ice::CommunicatorPtr communicator;
int status = EXIT_SUCCESS;
try
{
communicator = Ice::initialize(args, initData);
status = run(args, communicator, resolver);
}
catch(const FreezeScript::FailureException& ex)
{
string reason = ex.reason();
cerr << appName << ": " << reason;
if(reason[reason.size() - 1] != '\n')
{
cerr << endl;
}
return EXIT_FAILURE;
}
catch(const std::exception& ex)
{
cerr << appName << ": " << ex.what() << endl;
status = EXIT_FAILURE;
}
catch(...)
{
cerr << appName << ": unknown error" << endl;
return EXIT_FAILURE;
}
if(communicator)
{
communicator->destroy();
}
return status;
}
示例11: if
bool
IcePy::listToStringSeq(PyObject* l, Ice::StringSeq& seq)
{
assert(PyList_Check(l));
Py_ssize_t sz = PyList_GET_SIZE(l);
for(Py_ssize_t i = 0; i < sz; ++i)
{
PyObject* item = PyList_GET_ITEM(l, i);
if(!item)
{
return false;
}
string str;
if(checkString(item))
{
str = getString(item);
}
else if(item != Py_None)
{
PyErr_Format(PyExc_ValueError, STRCAST("list element must be a string"));
return false;
}
seq.push_back(str);
}
return true;
}
示例12: s
bool
IcePHP::extractStringArray(zval* zv, Ice::StringSeq& seq)
{
if(Z_TYPE_P(zv) != IS_ARRAY)
{
string s = zendTypeToString(Z_TYPE_P(zv));
invalidArgument("expected an array of strings but received %s", s.c_str());
return false;
}
HashTable* arr = Z_ARRVAL_P(zv);
zval* val;
ZEND_HASH_FOREACH_VAL(arr, val)
{
if(Z_TYPE_P(val) != IS_STRING)
{
invalidArgument("array element must be a string");
return false;
}
string s(Z_STRVAL_P(val), Z_STRLEN_P(val));
seq.push_back(s);
}
ZEND_HASH_FOREACH_END();
return true;
}
示例13: InitCommunicator
void ICEBufferReciver::InitCommunicator()
{
try
{
Ice::StringSeq args;
args.push_back(GetICECommunicatorConfig());
// FCommunicator = Ice::initialize(args);
FCommunicator = Ice::initialize();
Log(FServiceName+":通讯器成功初始化!" );
}
catch (const Ice::Exception & e)
{
Log(string(e.what()));
}
catch (...)
{
Log(FServiceName+":通讯器初始化失败!");
// Console.Error.WriteLine(ex);
}
}
示例14: sync
Ice::StringSeq
MetricsAdminI::getMetricsViewNames(Ice::StringSeq& disabledViews, const Current&)
{
Ice::StringSeq enabledViews;
Lock sync(*this);
for(map<string, MetricsViewIPtr>::const_iterator p = _views.begin(); p != _views.end(); ++p)
{
enabledViews.push_back(p->first);
}
#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES)
for(set<string>::const_iterator p = _disabledViews.begin(); p != _disabledViews.end(); ++p)
{
disabledViews.push_back(*p);
}
#else
disabledViews.insert(disabledViews.end(), _disabledViews.begin(), _disabledViews.end());
#endif
return enabledViews;
}
示例15: assert
bool
IcePy::stringSeqToList(const Ice::StringSeq& seq, PyObject* l)
{
assert(PyList_Check(l));
for(Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
PyObject* str = Py_BuildValue(STRCAST("s"), p->c_str());
if(!str)
{
Py_DECREF(l);
return false;
}
int status = PyList_Append(l, str);
Py_DECREF(str); // Give ownership to the list.
if(status < 0)
{
Py_DECREF(l);
return false;
}
}
return true;
}