Hello,
I am looking at the code from WebSpider demo from HL-III presentation. (The project is just called pipeline)
It has code like this:
procedure TfrmWebSpider.UniqueFilter(const input, output: IOmniBlockingCollection);
var
uniqueUrls: TStringList;
url : string;
begin
uniqueUrls := TStringList.Create;
try
uniqueUrls.Sorted := true;
for url in input do begin
if uniqueUrls.IndexOf(url) < 0 then begin
uniqueUrls.Add(url);
output.TryAdd(url);
end
else if FURLCount.Decrement = 0 then
FSpider.Input.CompleteAdding;
end;
finally FreeAndNil(uniqueUrls); end;
end;
When I run the demo, I see that the uniqueUrls TStringList is working on all inputs received. This is what we want, but how does this work?, since it is a local variable one would expect/imagine that it goes out of scope each time UniqueFilter is "called".
Thanks
Rael