Results 1 to 5 of 5

Thread: slice2cs 3.4.1 omits map types

  1. #1
    adv12 is offline Registered User
    Name: Andrew Vardeman
    Organization: Iowa State University
    Project: USDA agricultural survey
    Join Date
    Oct 2008
    Posts
    9

    slice2cs 3.4.1 omits map types

    Hi. I'm using Ice 3.4.1 on Windows XP with Visual Studio 2010. slice2cs doesn't seem to be generating C# classes for my maps. Running slice2cs on the following code produces the output included below. I just installed 3.4.1 (upgrading from 3.2.1), and I uninstalled 3.2.1 in case slice2cs 3.4.1 was somehow loading DLLs from 3.2.1 or something like that. Any ideas what I might be doing wrong?

    // ************************************************** ******
    // Test Ice file.
    // ************************************************** ******

    #ifndef SLICE_TEST_ICE
    #define SLICE_TEST_ICE

    module SliceTest {
    dictionary<string, string> StringMap;
    };

    #endif


    // ******
    // Output
    // ******

    // ************************************************** ********************
    //
    // Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
    //
    // This copy of Ice is licensed to you under the terms described in the
    // ICE_LICENSE file included in this distribution.
    //
    // ************************************************** ********************

    // Ice version 3.4.1

    // <auto-generated>
    //
    // Generated from file `SliceTest.ice'
    //
    // Warning: do not edit this file.
    //
    // </auto-generated>


    using _System = global::System;
    using _Microsoft = global::Microsoft;

    #pragma warning disable 1591

    namespace SliceTest
    {
    }

    namespace SliceTest
    {
    [_System.CodeDom.Compiler.GeneratedCodeAttribute("s lice2cs", "3.4.1")]
    public sealed class StringMapHelper
    {
    public static void write(IceInternal.BasicStream os__,
    _System.Collections.Generic.Dictionary<string, string> v__)
    {
    if(v__ == null)
    {
    os__.writeSize(0);
    }
    else
    {
    os__.writeSize(v__.Count);
    foreach(_System.Collections.Generic.KeyValuePair<s tring, string> e__ in v__)
    {
    os__.writeString(e__.Key);
    os__.writeString(e__.Value);
    }
    }
    }

    public static _System.Collections.Generic.Dictionary<string, string> read(IceInternal.BasicStream is__)
    {
    int sz__ = is__.readSize();
    _System.Collections.Generic.Dictionary<string, string> r__ = new _System.Collections.Generic.Dictionary<string, string>();
    for(int i__ = 0; i__ < sz__; ++i__)
    {
    string k__;
    k__ = is__.readString();
    string v__;
    v__ = is__.readString();
    r__[k__] = v__;
    }
    return r__;
    }
    }
    }

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Andrew,

    The mapping for dictionaries has changed since Ice 3.2. Now your dictionary maps to the following type by default:

    System.Collections.Generic.Dictionary<string, string>

    This means that the Slice compiler doesn't need to generate a class representing the dictionary because it can reuse the .NET Dictionary class.

    This page describes the mapping in more detail.

    Regards,
    Mark

  3. #3
    adv12 is offline Registered User
    Name: Andrew Vardeman
    Organization: Iowa State University
    Project: USDA agricultural survey
    Join Date
    Oct 2008
    Posts
    9

    Oh.

    Mark,

    Thanks for the link. Next time I'll read up more on the changes before posting.

    Andrew

  4. #4
    adv12 is offline Registered User
    Name: Andrew Vardeman
    Organization: Iowa State University
    Project: USDA agricultural survey
    Join Date
    Oct 2008
    Posts
    9

    documentation tweak

    Incidentally, while reading this:

    http://www.zeroc.com/doc/Ice-3.4.1-I...harp.15.7.html

    I noticed a couple typos:

    "By default, he Slice-to-C# compiler maps the dictionary to the following type:
    System.Collections.Generic.Dictionary<Employee>"

    I think this should be:

    By default, the Slice-to-C# compiler maps the dictionary to the following type:
    System.Collections.Generic.Dictionary<int, Employee>

  5. #5
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    I noticed those too, and actually the mapped type should be

    System.Collections.Generic.Dictionary<long, Employee>

    Thanks,
    Mark

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Data types for Freeze
    By ngambek2003 in forum Help Center
    Replies: 2
    Last Post: 09-30-2009, 01:20 PM
  2. getting normal map from freeze map
    By ctennis in forum Help Center
    Replies: 2
    Last Post: 03-09-2007, 07:48 AM
  3. Equivalent types
    By kwaclaw in forum Help Center
    Replies: 13
    Last Post: 10-09-2005, 10:33 AM
  4. Fixed-point types
    By DeepDiver in forum Comments
    Replies: 0
    Last Post: 11-23-2004, 04:50 AM

Posting Permissions

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