Archived

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

How to add index by slice2freeze?

HI,

I defined two stuctures in TB.ice:
struct IHisDataKey
{
..........................
};
struct IHisDataValue
{
...........................
};

And then,I make two function class in STL_Compares.h:
class CstlKey  
{
public:
    bool operator()(const IHisDataKey& k1,const IHisDataKey& k2) const
    {
         ................................
    }
};
class CstlValue
{
public:
    bool operator()(const IHisDataValue& v1,const IHisDataValue& v2) const
    {
         ................................
    }
};


When I use slice2cpp.exe:
slice2freeze.exe -I. -ID:\Ice-3.3.0-VC60\slice --add-header STL_Compares.h --dict IMapHisData,IHisDataKey,IHisDataValue,sort,CstlKey --dict-index IMapHisData,sort,CstlValue MapHisData TB.ice

I always get "slice2freeze.exe: `IHisDataValue' is not a valid index type" error.
What is the reason?

Comments

  • bernard
    bernard Jupiter, FL
    Hi Tang Fan,

    It would be helpful to show the actual Slice types!

    If you want to index on the full value, then this value's type needs to be a valid Slice dictionary key.

    Best regards,
    Bernard
  • bernard wrote: »
    Hi Tang Fan,

    It would be helpful to show the actual Slice types!

    If you want to index on the full value, then this value's type needs to be a valid Slice dictionary key.

    Best regards,
    Bernard

    The map's value is IHisDataValue, whick is a structure defined in TB.ice. IHisDataValue can not be indexed,so I implement a funtion class named CstlValue in STL_compares.h.
    --dict-index MAP[,MEMBER][,case-sensitive|case-insensitive][,sort,COMPARE]]
    I thought if I use sort and COMPARE option, slice2freeze will use my CstlValue funtion class to index it,but it seems that slice2freeze can not use the function class correctly.