Results 1 to 7 of 7

Thread: sequence to set mapping

  1. #1
    peter is offline Registered User
    Name: Peter Jaxy
    Organization: Reihnisch Westfälisch technische Hochschule
    Project: Integrative Production Technologie
    Join Date
    Jan 2009
    Posts
    30

    sequence to set mapping

    Is this possible?

    // In file CCU.ice
    [["cpp:include:set"]]

    module example {
    ["cpp:type:std::set<std::string>"] sequence<string> SET;

    };
    // end of file CCU.ice

    Because if I compile with:
    c++ -I. -I/usr/include -c server.cpp CCU.cpp CCUIS.cpp

    I get the following error message:
    CCU.cpp: In function ‘void CCU::__readSET(IceInternal::BasicStream*, CCU::SET&)’:
    CCU.cpp:88: error: no matching function for call to ‘std::set<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::set(Ice::Int&)’

  2. #2
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    No, std::set cannot be used as an alternative mapping for sequences.
    Dwayne Boone

  3. #3
    peter is offline Registered User
    Name: Peter Jaxy
    Organization: Reihnisch Westfälisch technische Hochschule
    Project: Integrative Production Technologie
    Join Date
    Jan 2009
    Posts
    30

    alternativ to set

    What can I use in Ice and I can map to a set::set??

    greetings
    Peter

  4. #4
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Ice does not provide any type that maps to std::set.
    Dwayne Boone

  5. #5
    blair is offline Registered User
    Name: Blair Zajac
    Organization: Sony Pictures Imageworks
    Project: VnP
    Join Date
    Mar 2007
    Posts
    34
    Could one have a wrapper class that just ignores the size constructor:

    template<typename T>
    class my_set: public std::set<T>
    {
    my_set(const Ice::Int size)
    : std::set()
    {
    }
    }

  6. #6
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Blair,

    You should be able to use any class that satisfies the requirements listed in the manual. (I don't think the un-marshaling code checks the size of the un-marshaled mapped sequence.)

    However, it is also desirable for the mapped C++ (Java ...) type to match the semantics of the underlying Slice type.

    A sequence is an ordered list, with possibly duplicate values, and not a set. A dictionary would be a better match for a set.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  7. #7
    blair is offline Registered User
    Name: Blair Zajac
    Organization: Sony Pictures Imageworks
    Project: VnP
    Join Date
    Mar 2007
    Posts
    34
    Never mind, in inspecting the generated C++ code the way the items are added to the std::vector is incompatible with std::set. So it looks like it's not possible.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. C# byte sequence mapping
    By kwaclaw in forum Comments
    Replies: 1
    Last Post: 11-28-2010, 03:27 PM
  2. problems of sequence?
    By mrliuhua in forum Help Center
    Replies: 4
    Last Post: 12-15-2009, 03:58 AM
  3. Replies: 1
    Last Post: 08-12-2008, 09:59 AM
  4. java 5 custom sequence mapping warnings
    By xdm in forum Help Center
    Replies: 1
    Last Post: 06-07-2007, 01:42 PM
  5. Replies: 4
    Last Post: 06-22-2005, 09:33 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
  •