Results 1 to 6 of 6

Thread: How to get all contacts in phonebook demo?

  1. #1
    ewiniar is offline Registered User
    Name: ewiniar
    Organization: soho
    Project: ssl vpn
    Join Date
    Jan 2006
    Posts
    30

    How to get all contacts in phonebook demo?

    I test phonebook in Ice-3.0.1\demo\Freeze\phonebook,It used index,It can find someone's contacts ,
    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:atabaseException& ex)
    {
    DatabaseException e;
    e.message = ex.message;
    throw e;
    }
    }
    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,
    any ideas?Thanks!
    ------------------


    ewiniar Lee
    Software Engineer
    Company:THP Ltd.Co
    Project:Communication lib project

  2. #2
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    You can use an iterator and iterate over the entire content of the phonebook. However, in general this isn't a very good idea since the database could contain millions of entries.

  3. #3
    ewiniar is offline Registered User
    Name: ewiniar
    Organization: soho
    Project: ssl vpn
    Join Date
    Jan 2006
    Posts
    30

    which container should I search?

    Thanks matthew,but I dont see,which container should I search?Could u show me which container I should search?

    Regards

    ewiniar
    ------------------


    ewiniar Lee
    Software Engineer
    Company:THP Ltd.Co
    Project:Communication lib project

  4. #4
    ewiniar is offline Registered User
    Name: ewiniar
    Organization: soho
    Project: ssl vpn
    Join Date
    Jan 2006
    Posts
    30

    Why?

    in Ice-3.0.1\demo\Freeze\phonebook,It used index,I wonder how to list all contacts ,if I must define map in PhoneBook.ice?If not,then ,which container should I search?or other solution?Thanks!

    Regards
    ------------------


    ewiniar Lee
    Software Engineer
    Company:THP Ltd.Co
    Project:Communication lib project

  5. #5
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    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.

  6. #6
    ewiniar is offline Registered User
    Name: ewiniar
    Organization: soho
    Project: ssl vpn
    Join Date
    Jan 2006
    Posts
    30

    Thanks

    Thanks matthew,I should investigate more carefully Ice manual,
    Thans more!

    Regards
    ------------------


    ewiniar Lee
    Software Engineer
    Company:THP Ltd.Co
    Project:Communication lib project

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. UDP demo
    By soff.dong in forum Help Center
    Replies: 1
    Last Post: 04-03-2009, 07:41 AM
  2. Problem with Hello demo
    By checho in forum Help Center
    Replies: 10
    Last Post: 12-01-2008, 01:40 PM
  3. Replies: 3
    Last Post: 06-06-2007, 05:57 PM
  4. Demo Documentation
    By crj18 in forum Comments
    Replies: 1
    Last Post: 11-02-2004, 03:08 PM
  5. Hello Demo Question
    By Jennie in forum Help Center
    Replies: 9
    Last Post: 10-21-2004, 06:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •