WRApplication
External kratos "application" for multiscale time integration.
|
Iterator interface around a file pointer. More...
Public Types | |
using | FileAccess = std::optional< std::pair< std::fstream, LockObject > > |
using | iterator_category = std::forward_iterator_tag |
using | value_type = std::pair< FileContentIterator, FileContentIterator > |
An iterator pair {begin,end} representing a range within the file. More... | |
using | difference_type = std::ptrdiff_t |
using | pointer = void |
using | reference = void |
Public Member Functions | |
FileContentIterator (std::shared_ptr< FileAccess > &&rpFileAccess, char delimiter='\n') | |
FileContentIterator (const std::shared_ptr< FileAccess > &rpFileAccess, char delimiter='\n') | |
FileContentIterator ()=delete | |
FileContentIterator (FileContentIterator &&rOther)=default | |
FileContentIterator (const FileContentIterator &rOther)=default | |
FileContentIterator & | operator= (FileContentIterator &&rOther)=default |
FileContentIterator & | operator= (const FileContentIterator &rOther)=default |
FileContentIterator & | operator++ () |
FileContentIterator | operator++ (int) |
value_type | operator* () const |
std::string | value () const |
Read the associated range from the file into a string. More... | |
void | SeekEOF () |
Set the iterator to the end of the file. More... | |
Friends | |
bool | operator== (const FileContentIterator &rLeft, const FileContentIterator &rRight) |
bool | operator!= (const FileContentIterator &rLeft, const FileContentIterator &rRight) |
bool | operator< (const FileContentIterator &rLeft, const FileContentIterator &rRight) |
Iterator interface around a file pointer.
This class represents a read-only iterator over the items of a delimited file. Dereferencing this iterator yields a a range instead of reading the file to a string; if you need the value_type to be a string, use FileStringIterator. Alternatively, you can use FileContentIterator::value to read the pointed-to range into a string.
Access to the file is provided by an std::fstream and an associated lock that ensures that no other thread has access to the file while any iterators to it are alive. The iterators position within the file is stored separately, and is restored every time some operation is performed on the iterator. This makes sure multiple iterators can use the file.
using difference_type = std::ptrdiff_t |
using FileAccess = std::optional<std::pair< std::fstream, LockObject > > |
using iterator_category = std::forward_iterator_tag |
using pointer = void |
using reference = void |
using value_type = std::pair<FileContentIterator,FileContentIterator> |
An iterator pair {begin,end} representing a range within the file.
FileContentIterator | ( | std::shared_ptr< FileAccess > && | rpFileAccess, |
char | delimiter = '\n' |
||
) |
FileContentIterator | ( | const std::shared_ptr< FileAccess > & | rpFileAccess, |
char | delimiter = '\n' |
||
) |
|
delete |
|
default |
|
default |
value_type operator* | ( | ) | const |
FileContentIterator& operator++ | ( | ) |
FileContentIterator operator++ | ( | int | ) |
|
default |
|
default |
void SeekEOF | ( | ) |
Set the iterator to the end of the file.
std::string value | ( | ) | const |
Read the associated range from the file into a string.
|
friend |
|
friend |
|
friend |