StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TestTListIter.C
1 // $Id: TestTListIter.C,v 1.1 2004/10/06 16:45:37 fisyak Exp $
2 // Author: Valery Fine(fine@bnl.gov) 01/03/2001
3 //
5 // This macros tests the various methods of TFileIter class.
7 //
8 // Copyright(c) 2001 [BNL] Brookhaven National Laboratory, Valeri Fine (fine@bnl.gov).
9 // All right reserved"
10 //
11 // Permission to use, copy, modify and distribute this software and its
12 // documentation for any purpose is hereby granted without fee,
13 // provided that the above copyright notice appear in all copies and
14 // that both that copyright notice and this permission notice appear
15 // in supporting documentation. The author makes no
16 // representations about the suitability of this software for any
17 // purpose. It is provided "as is" without express or implied warranty.
19 
20 void TestTListIter(){
21 // This macros tests the various methods of TFileIter class.
22  gSystem->Load("libRootKernel");
23  TList testList;
24  TString member = "member";
25  int i = 0;
26  for (i = 0; i < 10; i++) {
27  // Fill list
28  TString nextM = member;
29  nextM += i;
30  testList.Add(new TNamed(nextM,"Title"));
31  }
32  testList.ls();
33  TLIST::iterator iter(&testList);
34  i = 0;
35  while (*iter != 0 ) {
36  printf(" Name = %s\n", (*iter)->GetName() );
37  iter++; i++;
38  }
39  if ( i == 10) printf(" Ok ! \n");
40  else printf(" Failed ! \n");
41 }