|
1 /** |
|
2 * Relational pipes (library) |
|
3 * Copyright © 2022 František Kučera (Frantovo.cz, GlobalCode.info) |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the: |
|
7 * - GNU Lesser General Public License as published by the Free Software Foundation; |
|
8 * version 3 of the License or (at your option) |
|
9 * - GNU General Public License as published by the Free Software Foundation; |
|
10 * version 2 of the License. |
|
11 * |
|
12 * This program is distributed in the hope that it will be useful, |
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 * GNU General Public License for more details. |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License |
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
19 */ |
|
20 #pragma once |
|
21 |
|
22 namespace relpipe { |
|
23 namespace writer { |
|
24 |
|
25 /** |
|
26 * Relational output might be – and usually is – buffered |
|
27 * i.e. relational data are written to a buffer and flushed later and sent to the actual output stream. |
|
28 * |
|
29 * Through these modes we can control when the flush is done. |
|
30 * |
|
31 * Recommendation: |
|
32 * - batch processing: AUTO |
|
33 * - interactive processing: RECORD |
|
34 * - tools should not set the mode explicitly unless asked by the user or unles specific mode is obvious for given task; |
|
35 * then ENVIRONMENT mode is the initial one and it defaults to AUTO when user has not set the environmental variable |
|
36 */ |
|
37 enum class BufferingMode { |
|
38 /** |
|
39 * Output buffer is not explicitly flushed, it is written when full. |
|
40 */ |
|
41 AUTO, |
|
42 /** |
|
43 * Mode is determined by the environmental variable RELPIPE_WRITER_BUFFERING_MODE. |
|
44 * If value is missing or has invalid value, AUTO is used as default. |
|
45 */ |
|
46 ENVIRONMENT, |
|
47 /** |
|
48 * Output buffer is flushed at least at the end of each relation. |
|
49 */ |
|
50 RELATION, |
|
51 /** |
|
52 * Output buffer is flushed at least at the end of each record. |
|
53 */ |
|
54 RECORD, |
|
55 /** |
|
56 * Output buffer is flushed at least at the end of each attribute. |
|
57 */ |
|
58 ATTRIBUTE |
|
59 }; |
|
60 |
|
61 } |
|
62 } |