src/lib/TransactionalBuffer.h
author František Kučera <franta-hg@frantovo.cz>
Wed, 28 Jul 2021 18:01:09 +0200
branchv_0
changeset 9 7d309accc639
parent 1 68a281aefa76
permissions -rw-r--r--
configuration: --parser-option bit-string-symbol-0 bit-string-symbol-1 – custom symbols e.g. .:, -+, \/
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <string>
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <exception>
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <cstring>
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include "AbstractParser.h"
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
namespace relpipe {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
namespace in {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace asn1 {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
namespace lib {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
class TransactionalBuffer {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
private:
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	uint8_t* buffer;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	size_t bufferSize;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	bool hasData = false;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	size_t writePosition = 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	// size_t writePositionCommited = 0; // TODO: transactions also on the writing side?
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	size_t readPosition = 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	size_t readPositionCommited = 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	size_t bytesRead = 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	size_t bytesReadCommited = 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
	size_t availableForReading() {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
		if (readPosition < writePosition) return writePosition - readPosition;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
		else if (readPosition > writePosition) return bufferSize - readPosition + writePosition;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
		else if (hasData) return bufferSize;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
		else return 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
	size_t availableForWriting() {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
		if (readPositionCommited < writePosition) return bufferSize - writePosition + readPositionCommited;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
		else if (readPositionCommited > writePosition) return readPositionCommited - writePosition;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
		else if (hasData) return 0;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
		else return bufferSize;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
public:
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
	/**
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
	 * Is thrown from read() and peak() methods if there are not enough data.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
	 * Interrupts current update() cycle and causes rollback.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
	 */
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
	class ReadBufferUnderflowException {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
		// TODO: common super-class for exceptions, hidden implementation
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
	};
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
	/**
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    68
	 * Is thrown from write() method of the buffer when there is not enough space.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
	 * Interrupts whole process.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
	 */
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    71
	class WriteBufferOverflowException {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    72
	};
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    73
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    74
	TransactionalBuffer(size_t initialSize = 4096) : bufferSize(initialSize) {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    75
		// TODO: initial size + resize + hard upper limit
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    76
		buffer = (uint8_t*) malloc(bufferSize);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    77
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    78
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    79
	virtual ~TransactionalBuffer() {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    80
		free(buffer);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    81
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    82
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    83
	void write(const uint8_t* inputBuffer, const size_t length) {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    84
		if (length == 0) return;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    85
		if (length > availableForWriting()) throw WriteBufferOverflowException(); // TODO: optional resize
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    86
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    87
		hasData = true;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    88
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    89
		const size_t a = std::min(length, bufferSize - writePosition);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    90
		const size_t b = length - a;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    91
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    92
		// TODO: map buffer twice in the memory in order to create a continuous area and avoid the second memcpy()?
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    93
		memcpy(buffer + writePosition, inputBuffer, a);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    94
		memcpy(buffer, inputBuffer + a, b);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    95
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    96
		writePosition = (writePosition + length) % bufferSize;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    97
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    98
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    99
	void read(uint8_t* outputBuffer, const size_t length) {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   100
		if (length == 0) return;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   101
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   102
		peek(outputBuffer, length);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   103
		readPosition = (readPosition + length) % bufferSize;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   104
		hasData = readPosition != writePosition;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   105
		bytesRead += length;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   106
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   107
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   108
	void peek(uint8_t* outputBuffer, const size_t length) {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   109
		if (length == 0) return;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   110
		if (length > availableForReading()) throw ReadBufferUnderflowException();
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   111
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   112
		const size_t a = std::min(length, bufferSize - readPosition);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   113
		const size_t b = length - a;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   114
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   115
		memcpy(outputBuffer, buffer + readPosition, a);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   116
		memcpy(outputBuffer + a, buffer, b);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   117
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   118
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   119
	void commitRead() {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   120
		readPositionCommited = readPosition;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   121
		bytesReadCommited = bytesRead;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   122
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   123
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   124
	void rollbackRead() {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   125
		readPosition = readPositionCommited;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   126
		bytesRead = bytesReadCommited;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   127
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   128
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   129
	size_t getBytesRead() {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   130
		return bytesRead;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   131
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   132
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   133
};
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   134
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   135
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   136
}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   137
}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   138
}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   139
}