Skip to content
  • JINMEI Tatuya's avatar
    [2107] revised tree-data deleter mechanism: we now pass deleter to destroy. · 6679f424
    JINMEI Tatuya authored
    ...instead of give its type as a class template parameter and instantiate
    it within the tree.  it won't work (well) for ZoneData, because we need
    to know the RR class to delete RdataSet (which is the data type for
    ZoneData tree), but there's no way to tell the RR class about it.
    A good side effect of this change is that we now don't have to link
    the memory segment for the tree and its nodes with the zone data
    (although in practice it's quite likely to use the same segment for
    all of them).
    
    I also updated setData() (further from #2100); it now doesn't even delete
    any existing data.  This is partly relaetd to the above change on
    deleter - we cannot instantiate the deleter within this method.  We could
    pass the deleter as a parameter, but, actually, in the case of ZoneData
    we wouldn't have to delete the data; when setData() encounters existing
    data, it's more likely that ZoneData tries to extend the RdataSet list.
    It makes more sense to let ZoneData manage all data, including when to
    delete them.
    
    (although not absolutely necessary) I also changed the type of deleter
    in the domain tree test to highlight we could use a plain old function
    instead of a functor object.
    
    change size is big, but most of the changes are trivial conversion
    from something like <T, DT> to <T>.
    6679f424