From f0970b1c8a9a815681ed55c57d80bc0f2e0ccc18 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 22 Jul 2020 14:28:53 +0200 Subject: [PATCH] Add more details to sf-buffer file structure --- sf-buffer/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sf-buffer/README.md b/sf-buffer/README.md index d4675a4..38be0d6 100644 --- a/sf-buffer/README.md +++ b/sf-buffer/README.md @@ -65,6 +65,15 @@ Frames are written one after another to a specific offset in the file. The offset is calculated based on the pulse_id, so each frame has a specific place in the file and there is no need to have an index for frame retrieval. +The offset where a specific pulse_id is written in a file is calculated: + +```c++ +// FILE_MOD = 1000 +uint64_t file_base = pulse_id / FILE_MOD; +file_base *= FILE_MOD; +size_t file_offset = file_base * sizeof(BufferBinaryFormat); +``` + #### Folder structure The folder (as well as file) structure is deterministic in the sense that given