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#ifndef _BUFFERARRAY_H_
22#define _BUFFERARRAY_H_
23
24#include "config.h"
25
26class bufferStore;
27
32public:
39
46
51
56
62 bool empty() const;
63
69 bufferStore &operator [](const unsigned long index);
70
79
88
97
106
112 bufferStore pop(void);
113
119 void push(const bufferStore& b);
120
126 void append(const bufferStore& b);
127
133 long length(void);
134
138 void clear(void);
139
140private:
145 static const long ALLOC_MIN = 5;
146
151 long len;
152
158
163};
164
165inline bool bufferArray::empty() const { return len == 0; }
166
167#endif
An array of bufferStores.
Definition: bufferarray.h:31
void push(const bufferStore &b)
Inserts a bufferStore at index 0.
Definition: bufferarray.cc:77
bufferStore pop(void)
Removes the first bufferStore.
Definition: bufferarray.cc:48
~bufferArray()
Destroys the bufferArray.
Definition: bufferarray.cc:42
long lenAllocd
The current number of bufferStores allocated.
Definition: bufferarray.h:157
long length(void)
Evaluates the current length.
Definition: bufferarray.cc:92
bufferArray operator+(const bufferStore &s)
Appends a bufferStore to a bufferArray.
Definition: bufferarray.cc:125
bufferStore & operator[](const unsigned long index)
Retrieves the bufferStore at given index.
Definition: bufferarray.cc:119
void clear(void)
Empties the bufferArray.
Definition: bufferarray.cc:98
bufferArray()
constructs a new bufferArray.
Definition: bufferarray.cc:26
static const long ALLOC_MIN
Minimum number of bufferStores to allocate.
Definition: bufferarray.h:145
bufferArray & operator=(const bufferArray &a)
Copys the bufferArray.
Definition: bufferarray.cc:107
void append(const bufferStore &b)
Appends a bufferStore.
Definition: bufferarray.cc:62
bufferStore * buff
The content.
Definition: bufferarray.h:162
bool empty() const
Checks if this bufferArray is empty.
Definition: bufferarray.h:165
bufferArray & operator+=(const bufferStore &s)
Appends a bufferStore to current instance.
Definition: bufferarray.cc:156
long len
The current number of bufferStores in this bufferArray.
Definition: bufferarray.h:151
A generic container for an array of bytes.
Definition: bufferstore.h:37
static rfsv * a
Definition: main.cc:53