Archived
This forum has been archived. Please start a new discussion on GitHub.
How to get all contacts in phonebook demo?
ewiniar
in Help Center
I test phonebook in Ice-3.0.1\demo\Freeze\phonebook,It used index,It can find someone's contacts ,
any ideas?Thanks!
But if I want to find all contacts ,how to do it?It seems like there is no the function in the index class of slice2freeze,Contacts
PhoneBookI::findContacts(const string& name, const Ice::Current& c) const
{
try
{
vector<Ice::Identity> identities = _index->find(name);
Contacts contacts;
contacts.reserve(identities.size());
transform(identities.begin(), identities.end(), back_inserter(contacts), IdentityToContact(c.adapter));
return contacts;
}
catch(const Freeze::DatabaseException& ex)
{
DatabaseException e;
e.message = ex.message;
throw e;
}
}
any ideas?Thanks!
0
Comments
-
You create an iterator on the evictor. See Evictor::getIterator. This will return an iterator that you can use to get all of the identities that are managed by the evictor. Once you have the identities you can do whatever you can create a proxy to the object using the identity and do whatever you like.0
