plptools
Loading...
Searching...
No Matches
bufferarray.h
Go to the documentation of this file.
1/*
2 * This file is part of plptools.
3 *
4 * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com>
5 * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
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 along
18 * along with this program; if not, see <https://www.gnu.org/licenses/>.
19 *
20 */
21#pragma once
22
23#include "config.h"
24
25class BufferStore;
26
31public:
38
45
50
55
61 bool empty() const;
62
68 BufferStore &operator [](const unsigned long index);
69
78
87
96
105
111 BufferStore pop(void);
112
118 void push(const BufferStore& b);
119
125 void append(const BufferStore& b);
126
132 long length(void);
133
137 void clear(void);
138
139private:
144 static const long ALLOC_MIN = 5;
145
150 long len;
151
157
162};
163
164inline bool BufferArray::empty() const { return len == 0; }
An array of BufferStores.
Definition: bufferarray.h:30
void clear(void)
Empties the BufferArray.
Definition: bufferarray.cc:98
BufferArray & operator=(const BufferArray &a)
Copys the BufferArray.
Definition: bufferarray.cc:107
long length(void)
Evaluates the current length.
Definition: bufferarray.cc:92
static const long ALLOC_MIN
Minimum number of BufferStores to allocate.
Definition: bufferarray.h:144
long lenAllocd
The current number of BufferStores allocated.
Definition: bufferarray.h:156
BufferArray operator+(const BufferStore &s)
Appends a BufferStore to a BufferArray.
Definition: bufferarray.cc:125
BufferArray & operator+=(const BufferStore &s)
Appends a BufferStore to current instance.
Definition: bufferarray.cc:156
~BufferArray()
Destroys the BufferArray.
Definition: bufferarray.cc:42
bool empty() const
Checks if this BufferArray is empty.
Definition: bufferarray.h:164
BufferStore & operator[](const unsigned long index)
Retrieves the BufferStore at given index.
Definition: bufferarray.cc:119
BufferStore * buff
The content.
Definition: bufferarray.h:161
void append(const BufferStore &b)
Appends a BufferStore.
Definition: bufferarray.cc:62
BufferArray()
constructs a new BufferArray.
Definition: bufferarray.cc:26
void push(const BufferStore &b)
Inserts a BufferStore at index 0.
Definition: bufferarray.cc:77
long len
The current number of BufferStores in this BufferArray.
Definition: bufferarray.h:150
BufferStore pop(void)
Removes the first BufferStore.
Definition: bufferarray.cc:48
A generic container for an array of bytes.
Definition: bufferstore.h:36
static RFSV * a
Definition: main.cc:55