7 #include <utl/Reader.h>
8 #include <fwk/CentralConfig.h>
15 T2Life* T2Life::gfT2Life =
nullptr;
29 fFile =
new ifstream(filename.c_str());
31 fFiles.insert(make_pair(fCurrentFileStart, make_pair(fCurrentFileEnd, fFile)));
47 const vector<unsigned int>&
48 T2Life::GetValidStations(
unsigned int theGPSSecond)
50 SetFile(theGPSSecond);
52 if (theGPSSecond < fCurrentStop && theGPSSecond >= fCurrentStart)
53 return fValidStations;
55 if (theGPSSecond < fCurrentStart) {
57 cerr <<
"Rewinding T2Life file. Why?" << endl;
60 fValidStations.clear();
65 while (getline(*fFile, line)) {
70 buffer >> start >> end;
72 if (theGPSSecond < start)
75 if (theGPSSecond < end) {
77 fCurrentStart = start;
84 cerr << theGPSSecond <<
" out of range in T2Life. Why?\n"
85 <<
"line " << line_number <<
'\n'
90 return fValidStations;
93 for (
unsigned i = 0; i < 101; ++i)
94 fValidStations.push_back(0);
97 while (buffer >> flag)
98 fValidStations.push_back(flag);
100 return fValidStations;
105 T2Life::SetFile(
unsigned int theGPSSecond)
107 if (theGPSSecond < fCurrentFileEnd && theGPSSecond > fCurrentFileStart)
110 std::map<unsigned int, std::pair<unsigned int, std::ifstream*> >::iterator
file =
111 --fFiles.upper_bound(theGPSSecond);
113 fFile = file->second.second;
114 fCurrentFileStart = file->first;
115 fCurrentFileEnd = file->second.first;
116 fCurrentStart = file->first;
117 fCurrentStop = file->first;
123 const std::vector<unsigned int>&
126 return T2Life::GetT2Life().GetValidStations(theGPSSecond);
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Branch GetNextSibling() const
Get next sibling of this branch.
Class representing a document branch.
void GetData(bool &b) const
Overloads of the GetData member template function.
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
const std::vector< unsigned int > & GetStationsStatusFromT2Files(unsigned int theGPSSecond)
Branch GetFirstChild() const
Get first child of this Branch.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)