#include <RootInputFile.h>
Collaboration diagram for RootInputFileList:
Public Member Functions | |
RootInputFileList () | |
~RootInputFileList () | |
int | index () |
The index of current file. | |
RootInputFile * | current () |
Access the current file. | |
bool | next () |
Advance one file. | |
bool | prev () |
Retard one file. | |
bool | last () |
Go to last file. | |
bool | first () |
Go to first file. | |
bool | jump (int index) |
Go to the file at given index. | |
int | entriesBefore (int index) |
Total number of entries of all files upto but not including file at given index. | |
Private Attributes | |
int | m_index |
Dyb::MsgStreamMember | log |
Definition at line 97 of file RootInputFile.h.
RootInputFileList::RootInputFileList | ( | ) |
Definition at line 417 of file RootInputFile.cc.
00418 : std::vector<RootInputFile*>() 00419 , m_index(-1) 00420 , log("RootInputFileList") 00421 { 00422 }
RootInputFileList::~RootInputFileList | ( | ) |
int RootInputFileList::index | ( | ) |
The index of current file.
Definition at line 428 of file RootInputFile.cc.
00429 { 00430 return m_index; 00431 }
RootInputFile * RootInputFileList::current | ( | ) |
Access the current file.
Definition at line 433 of file RootInputFile.cc.
00434 { 00435 if (m_index < 0 || m_index >= (int)size()) return 0; 00436 return (*this)[m_index]; 00437 }
bool RootInputFileList::next | ( | ) |
Advance one file.
Definition at line 439 of file RootInputFile.cc.
00440 { 00441 if (m_index + 1 >= (int)size()) { 00442 log << MSG::WARNING << "next(): already at last file" 00443 << endreq; 00444 return false; 00445 } 00446 RootInputFile* rif = current(); 00447 if (rif) rif->leave(); 00448 ++m_index; 00449 rif = current(); 00450 if (!rif) { 00451 log << MSG::ERROR 00452 << "next(): failed to make next file curren" 00453 << endreq; 00454 return false; 00455 } 00456 return true; 00457 }
bool RootInputFileList::prev | ( | ) |
Retard one file.
Definition at line 475 of file RootInputFile.cc.
00476 { 00477 if (m_index <= 0) { 00478 log << MSG::ERROR 00479 << "prev(): already at first file" 00480 << endreq; 00481 return false; 00482 } 00483 RootInputFile* rif = current(); 00484 if (rif) rif->leave(); 00485 --m_index; 00486 rif = current(); 00487 if (!rif) { 00488 log << MSG::ERROR 00489 << "prev(): failed to make prev file curren" 00490 << endreq; 00491 return false; 00492 } 00493 return true; 00494 }
bool RootInputFileList::last | ( | ) |
Go to last file.
Definition at line 459 of file RootInputFile.cc.
00460 { 00461 if (m_index+1 == (int)size()) return true; 00462 RootInputFile* rif = current(); 00463 if (rif) rif->leave(); 00464 m_index = (int)size() - 1; 00465 rif = current(); 00466 if (!rif) { 00467 log << MSG::ERROR 00468 << "last(): falied to make last file current" 00469 << endreq; 00470 return false; 00471 } 00472 return true; 00473 }
bool RootInputFileList::first | ( | ) |
Go to first file.
Definition at line 498 of file RootInputFile.cc.
00499 { 00500 if (!m_index) return true; 00501 RootInputFile* rif = current(); 00502 if (rif) rif->leave(); 00503 m_index = 0; 00504 rif = current(); 00505 if (!rif) { 00506 log << MSG::ERROR 00507 << "first(): failed to make first file current" 00508 << endreq; 00509 return false; 00510 } 00511 return true; 00512 }
bool RootInputFileList::jump | ( | int | index | ) |
Go to the file at given index.
Definition at line 514 of file RootInputFile.cc.
00515 { 00516 if (m_index == index) return true; 00517 RootInputFile* rif = current(); 00518 if (rif) rif->leave(); 00519 m_index = index; 00520 rif = current(); 00521 if (!rif) { 00522 log << MSG::ERROR 00523 << "goto("<<index<<") failed" 00524 << endreq; 00525 return false; 00526 } 00527 return true; 00528 }
int RootInputFileList::entriesBefore | ( | int | index | ) |
Total number of entries of all files upto but not including file at given index.
Returns -1 on error
Definition at line 530 of file RootInputFile.cc.
00531 { 00532 if (index < 0 || index >= (int)size()) return -1; 00533 // cound up entries up to but not including current index 00534 int totEntries = 0; 00535 for (int ind = 0; ind < index; ++ind) { 00536 int entries = (*this)[ind]->entries(); 00537 if (entries < 0) return -1; 00538 totEntries += entries; 00539 } 00540 return totEntries; 00541 }
int RootInputFileList::m_index [private] |
Definition at line 98 of file RootInputFile.h.
Dyb::MsgStreamMember RootInputFileList::log [private] |
Definition at line 99 of file RootInputFile.h.