------------------------------------------------------------------------------
| 66 | |
| 67 | //------------------------------------------------------------------------------ |
| 68 | int vtkRTXMLPolyDataReader::NewDataAvailable() |
| 69 | { |
| 70 | // TODO: data concurrency issue |
| 71 | // what if data is available partly on the file system |
| 72 | // i.e. a data writer is writing the file, but not done yet |
| 73 | // enforce the writer to obtain a "flock" is too restrictive, is it? |
| 74 | |
| 75 | // no data directory is specified, use the current dir |
| 76 | if (!this->DataLocation) |
| 77 | { |
| 78 | this->InitializeToCurrentDir(); |
| 79 | return VTK_ERROR; |
| 80 | } |
| 81 | |
| 82 | // now the reader should be initialized already |
| 83 | if (!this->Internal->AvailableDataFileList.empty()) |
| 84 | { |
| 85 | return VTK_OK; |
| 86 | } |
| 87 | |
| 88 | vtkDirectory* dataDir = vtkDirectory::New(); |
| 89 | dataDir->Open(this->DataLocation); |
| 90 | |
| 91 | // now check if there are new files available |
| 92 | // and place them into the AvailableDataFileList |
| 93 | int current = dataDir->GetNumberOfFiles(); |
| 94 | int processed = static_cast<int>(this->Internal->ProcessedFileList.size()); |
| 95 | |
| 96 | if (current > processed) |
| 97 | { |
| 98 | for (int i = 0; i < current; i++) |
| 99 | { |
| 100 | char* file = this->GetDataFileFullPathName(dataDir->GetFile(i)); |
| 101 | if (!IsProcessed(file)) |
| 102 | { |
| 103 | this->Internal->AvailableDataFileList.emplace_back(file); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | delete[] file; |
| 108 | } |
| 109 | } |
| 110 | dataDir->Delete(); |
| 111 | return VTK_OK; |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | dataDir->Delete(); |
| 116 | return VTK_ERROR; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | // Description: |
| 121 | // Internal method to return the fullpath name of a file, which |
nothing calls this directly
no test coverage detected