I think there are two reasonable approaches -

1) Iterator style. In this case we either create a new iterator type or re-use 
the FieldHandle as an iterator. In this case you get a handle to the first 
field, and then re-use it for each field. This saves the expense of allocating 
a new handle for every field.

2) Functor style. In this case we do the equivalent of std::find_if(). It would 
be similar to TSRecordDump, the differences being it is over the HTTP header 
fields, and the functor can return a "stop calling me" value to terminate the 
iteration.

In terms of implementation, the latter should be noticeably easier. While I 
think option (1) is more flexible, I favor option (2) for ease of 
implementation because it's mainly clunkier than (1), not really much less 
powerful. Having looked at the underlying data structures, making option (1) 
efficient would involve some non-trivial changes to structures I am not sure 
anybody understands. I think option (2) could be done in a day, on the other 
hand.

Reply via email to