include/relpipe/writer/BufferingMode.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 23 Apr 2022 23:23:29 +0200
branchv_0
changeset 59 4fce579bed22
parent 41 include/relpipe/writer/RelationalWriter.h@744b61559eb2
permissions -rw-r--r--
BufferingMode: configurable modes that control when flush() is called set through the environmental variable RELPIPE_WRITER_BUFFERING_MODE or through the API method setBufferingMode()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
     1
/**
30
3f18cb7a6963 license of protocol, reader and writer: GNU LGPLv3+ or GNU GPLv2+
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
     2
 * Relational pipes (library)
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
     3
 * Copyright © 2022 František Kučera (Frantovo.cz, GlobalCode.info)
29
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
     4
 *
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
30
3f18cb7a6963 license of protocol, reader and writer: GNU LGPLv3+ or GNU GPLv2+
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
     6
 * it under the terms of the:
3f18cb7a6963 license of protocol, reader and writer: GNU LGPLv3+ or GNU GPLv2+
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
     7
 *  - GNU Lesser General Public License as published by the Free Software Foundation;
41
744b61559eb2 fix license version: GNU LGPLv3 or GPLv2
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
     8
 *    version 3 of the License or (at your option)
30
3f18cb7a6963 license of protocol, reader and writer: GNU LGPLv3+ or GNU GPLv2+
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
     9
 *  - GNU General Public License as published by the Free Software Foundation;
41
744b61559eb2 fix license version: GNU LGPLv3 or GPLv2
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    10
 *    version 2 of the License.
29
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    11
 *
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    12
 * This program is distributed in the hope that it will be useful,
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    15
 * GNU General Public License for more details.
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    16
 *
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    17
 * You should have received a copy of the GNU General Public License
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    18
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
142bdbba520f license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    19
 */
7
01dd90eeedbb add data type and catalog classes from the prototype
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#pragma once
01dd90eeedbb add data type and catalog classes from the prototype
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
8
03750aff8619 writer only writes + refactoring
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    22
namespace relpipe {
03750aff8619 writer only writes + refactoring
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    23
namespace writer {
7
01dd90eeedbb add data type and catalog classes from the prototype
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    25
/**
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    26
 * Relational output might be – and usually is – buffered
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    27
 * i.e. relational data are written to a buffer and flushed later and sent to the actual output stream.
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    28
 * 
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    29
 * Through these modes we can control when the flush is done.
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    30
 * 
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    31
 * Recommendation:
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    32
 *  - batch processing: AUTO
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    33
 *  - interactive processing: RECORD
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    34
 *  - tools should not set the mode explicitly unless asked by the user or unles specific mode is obvious for given task;
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    35
 *    then ENVIRONMENT mode is the initial one and it defaults to AUTO when user has not set the environmental variable
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    36
 */
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    37
enum class BufferingMode {
18
90efe2db1ca8 documentation for RelationalWriter and DataTypeWriterBase
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    38
	/**
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    39
	 * Output buffer is not explicitly flushed, it is written when full.
18
90efe2db1ca8 documentation for RelationalWriter and DataTypeWriterBase
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    40
	 */
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    41
	AUTO,
18
90efe2db1ca8 documentation for RelationalWriter and DataTypeWriterBase
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    42
	/**
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    43
	 * Mode is determined by the environmental variable RELPIPE_WRITER_BUFFERING_MODE.
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    44
	 * If value is missing or has invalid value, AUTO is used as default.
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    45
	 */
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    46
	ENVIRONMENT,
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    47
	/**
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    48
	 * Output buffer is flushed at least at the end of each relation.
18
90efe2db1ca8 documentation for RelationalWriter and DataTypeWriterBase
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    49
	 */
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    50
	RELATION,
18
90efe2db1ca8 documentation for RelationalWriter and DataTypeWriterBase
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    51
	/**
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    52
	 * Output buffer is flushed at least at the end of each record.
18
90efe2db1ca8 documentation for RelationalWriter and DataTypeWriterBase
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    53
	 */
59
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    54
	RECORD,
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    55
	/**
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    56
	 * Output buffer is flushed at least at the end of each attribute.
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    57
	 */
4fce579bed22 BufferingMode: configurable modes that control when flush() is called
František Kučera <franta-hg@frantovo.cz>
parents: 41
diff changeset
    58
	ATTRIBUTE
7
01dd90eeedbb add data type and catalog classes from the prototype
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
};
01dd90eeedbb add data type and catalog classes from the prototype
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
8
03750aff8619 writer only writes + refactoring
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    61
}
9
0a40752e401d shared library with pure abstract class (interface)
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    62
}