diff --git a/filemonitor.cpp b/filemonitor.cpp index 44d5423..95ec4b2 100644 --- a/filemonitor.cpp +++ b/filemonitor.cpp @@ -112,6 +112,7 @@ void FileMonitor::run() // We need a mutex or semaphore to lock out this page while we do that // lock p->LoadPage(name); // What if this fails? We can see the bool. What to do ? + //TODO: If this was a normal page and is now a special page or vice versa we have loaded it into the wrong pagelist! FIX ME! p->SetModifiedTime(attrib.st_mtime); // unlock diff --git a/pagelist.cpp b/pagelist.cpp index e14378f..0fbad3a 100644 --- a/pagelist.cpp +++ b/pagelist.cpp @@ -48,7 +48,12 @@ int PageList::LoadPageList(std::string filepath) q->GetPageCount(); // Use for the side effect of renumbering the subcodes int mag=(q->GetPageNumber() >> 16) & 0x7; - _pageList[mag].push_back(*q); // This copies. But we can't copy a mutex + PageFunction func = q->GetPageFunction(); + if (func == GPOP || func == POP || func == GDRCS || func == DRCS || func == MOT || func == MIP){ + _pageList[mag+8].push_back(*q); // put page in separate pageList for "special" pages + } else { + _pageList[mag].push_back(*q); // This copies. But we can't copy a mutex + } } } } @@ -87,8 +92,13 @@ int PageList::LoadPageList(std::string filepath) void PageList::AddPage(TTXPageStream* page) { - int mag=(page->GetPageNumber() >> 16) & 0x7; - _pageList[mag].push_back(*page); + int mag=(page->GetPageNumber() >> 16) & 0x7; + PageFunction func = page->GetPageFunction(); + if (func == GPOP || func == POP || func == GDRCS || func == DRCS || func == MOT || func == MIP){ + _pageList[mag+8].push_back(*page); // put page into separate pageList for "special" pages + } else { + _pageList[mag].push_back(*page); // put page into the normal page sequence + } } @@ -97,7 +107,7 @@ TTXPageStream* PageList::Locate(std::string filename) { // This is called from the FileMonitor thread // std::cerr << "[PageList::Locate] *** TODO *** " << filename << std::endl; - for (int mag=0;mag<8;mag++) + for (int mag=0;mag<16;mag++) // check both sets of page lists as it might be one of the special pages { //for (auto p : _pageList[mag]) for (std::list::iterator p=_pageList[mag].begin();p!=_pageList[mag].end();++p) diff --git a/pagelist.h b/pagelist.h index 1d70926..ea85d70 100644 --- a/pagelist.h +++ b/pagelist.h @@ -85,7 +85,7 @@ class PageList private: Configure* _configure; // The configuration object - std::list _pageList[8]; /// The list of Pages in this service. One list per magazine + std::list _pageList[16]; /// The list of Pages in this service. Two lists per magazine (normal pages in lists 0-7, enhancement and magazine inventory and organisation table pages in 8-15) vbit::Mag* _mag[8]; // iterators through selected pages. (use the same iterator for D command and MD, L etc.)