00001
00020 #ifndef GETRECORDS_H
00021 #define GETRECORDS_H
00022
00023 #include <MinosObjectMap/MomNavigator.h>
00024 #include <TIterator.h>
00025 #include <TObject.h>
00026 #include <vector>
00027
00028 namespace DataUtil {
00029
00039 template<class RecordType>
00040 inline std::vector<RecordType*> GetRecords(MomNavigator* mom)
00041 {
00042 std::vector<RecordType*> ret;
00043 TIter mitr = mom->FragmentIter();
00044 TObject* object = 0;
00045 while ( (object = mitr.Next()) ) {
00046 RecordType* rec = dynamic_cast<RecordType*>(object);
00047 if (rec) ret.push_back(rec);
00048 }
00049 return ret;
00050 }
00051
00052 template<class RecordType>
00053 inline std::vector<RecordType*> GetRecords(const MomNavigator* mom)
00054 {
00055 return GetRecords<RecordType>(const_cast<MomNavigator*>(mom));
00056 }
00057 }
00058
00059
00060
00061 #endif // GETRECORDS_H