Commit 7a67c117 authored by legoc's avatar legoc

guide

parent 28dabc9e
Pipeline #335 skipped
......@@ -86,10 +86,19 @@ Read and Process the File
There are two methods to read and process a file:
* Use a simple reader event by event
* Use a more advanced algorithm configured with a method of reading the events.
* Use a more advanced processor configured with an algorithm
An example of a simple reader is provided [here](../src/lstdpp128/apps/common/SimpleReader.cpp).
A more advanced strategy is to use a concept of algorithms used through arrays of events.
The advantage is that it is possible to read a block of events, sort them in time and process them.
It can be very interesting for very large files for which the entire sequence of events cannot reside in RAM.
The programmer defines a processor class and can use it by two read strategy (EventArray or EventBlockArray).
An example of such processor and algorithm is provided [here](../src/lstdpp128/apps/common/IterativeVectorInsert.cpp).
......
......@@ -56,18 +56,25 @@ int main(int argc, char * argv[]) {
cout << "reading " << fileName << ", block size " << blockSize << ", buffer size " << BUFFER_SIZE << endl;
// Initialize a reader with a buffer of size 4096.
Reader reader(BUFFER_SIZE);
// Open the file.
bool success = reader.open(fileName);
// Exit in case of error.
if (!success) {
return EXIT_FAILURE;
}
// Print the context.
cout << listModeContext << endl;
// algorithm
// Define the algorithm using the class template EventArrayAlgorithm configured with the processor Insert.
//
EventArrayAlgorithm<Insert> algorithm;
// Initialize
algorithm.processor().init();
// creating the events
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment