Archived

This forum has been archived. Please start a new discussion on GitHub.

Data types for Freeze

I have a couple of questions regarding Freeze.

1) Is there anyway to store sequences as values in a FreezeMap? slice2freeze doesn't seem to like it.

2) This is an excerpt from the online manual (section 40.3), "This is especially important to remember when defining a Slice class whose instances will be stored in a Freeze map". Is there an example on how to do this? How do we define a Slice class and indicate that it needs to be persisted.

Thanks
Budyanto

Comments

  • xdm
    xdm La Coruña, Spain
    Hi Budyanto,
    1) Is there anyway to store sequences as values in a FreezeMap? slice2freeze doesn't seem to like it.

    Not sure what problem you found, for example you could define a FreezeMap with a value of Ice::StringSeq with the following command.
    slice2freeze --ice --dict Test::ByteStringSeqMap,byte,Ice::StringSeq ByteStringSeqMap -I../../../../slice ../../../../slice/Ice/BuiltinSequences.ice
    
    2) This is an excerpt from the online manual (section 40.3), "This is especially important to remember when defining a Slice class whose instances will be stored in a Freeze map". Is there an example on how to do this? How do we define a Slice class and indicate that it needs to be persisted.

    There is nothing extra todo, all slice classes could be stored in Freeze maps, what the setence means is that only the slice representation of the class is sotred, the implementation members are not stored.

    For example
    //Slice code
    module Foo
    {
        class Bar
        {
            string name;
        };
    }
    
    //C++ code
    class BarI : public Bar
    {
    private:
       secondname;
    }
    

    If you store BarI instances in a Freeze map, only the mebers defined in slice are stored, so if secondname was intended to be persistent it should be defined within slice Bar class and not in c++ BarI implementation.

    Hope this helps,
    José
  • Ok thanks.

    That does help. I didn't realize you can do this

    -I../../../../slice ../../../../slice/Ice/BuiltinSequences.ice

    Budyanto