78#ifndef DONT_USE_ABSPTR
86 BlkArr(
void) : qel(0), la(), size_of_element(sizeof(T)) { ; }
88 : qel(fqel), la(
DynLinArr<T>(0)), size_of_element(sizeof(T)) {
92 : qel(fqel), la(
DynLinArr<T>(0)), size_of_element(sizeof(T)) {
96 : qel(fqel), la(
DynLinArr<T>(0)), size_of_element(sizeof(T)) {
115 mcout <<
"BlkArr<T>& operator=(const BlkArr<T>& f) is called\n";
119 size_of_element = f.size_of_element;
127#ifndef DONT_USE_ABSPTR
133 mcout <<
"BlkArr(const BlkArr<T>& f) is working\n";
138 : qel(f.qel), size_of_element(f.size_of_element), la(f.la,
steal) {
140 mcout <<
"BlkArr( BlkArr<T>& f, Pilfer) is working\n";
143 f.size_of_element = 0;
147 mcout <<
"BlkArr::pilfer is called\n";
152 mcerr <<
"ERROR in BlkArr::pilfer(...):\n";
153 mcerr <<
"Both the destination and source arrays are not empty\n";
164 size_of_element = f.size_of_element;
167 f.size_of_element = 0;
172 for (n = 0; n < qel; n++)
242#ifndef DONT_USE_ABSPTR
251#ifdef USE_REPLACE_ALLOC
257 if (n < 0 || n >= qel) {
258 mcerr <<
"T& BlkArr::operator[](long n): n is out of bounds, n=" << n
259 <<
" qel=" << qel <<
'\n';
265 if ((q = aln->
el.get_qel()) > n)
266 return aln->
el.acu(n);
270 }
while (aln != NULL);
271 mcerr <<
"T& BlkArr::operator[](long n): should never happen, n=" << n
272 <<
" qel=" << qel <<
'\n';
281 if (n < 0 || n >= qel) {
282 mcerr <<
"const T& BlkArr::operator[](long n): n is out of bounds, n=" << n
283 <<
" qel=" << qel <<
'\n';
289 if ((q = aln->
el.get_qel()) > n)
290 return aln->
el.acu(n);
294 }
while (aln != NULL);
295 mcerr <<
"T& BlkArr::operator[](long n): should never happen, n=" << n
296 <<
" qel=" << qel <<
'\n';
306 mcerr <<
"T& BlkArr::last_el(): no elements in array\n"
307 <<
" qel=" << qel <<
'\n';
314 if ((q = aln->
el.get_qel()) > n)
315 return aln->
el.acu(n);
319 }
while (aln != NULL);
320 mcerr <<
"T& BlkArr::::last_el(): should never happen, n=" << n
321 <<
" qel=" << qel <<
'\n';
331 mcerr <<
"const T& BlkArr::last_el(): no elements in array\n"
332 <<
" qel=" << qel <<
'\n';
339 if ((q = aln->
el.get_qel()) > n)
340 return aln->
el.acu(n);
344 }
while (aln != NULL);
345 mcerr <<
"T& BlkArr::::last_el(): should never happen, n=" << n
346 <<
" qel=" << qel <<
'\n';
356 if (fqel == qel)
return;
376 long fqel_res = fqel;
379 if (fqel_res < 2 * qel)
381 long ex = 2 * qel * size_of_element;
387 if (fqel_res - qel < q) fqel_res = qel + q;
391 long left_old_qel = qel;
392 long left_new_qel = fqel;
393 long left_new_qel_res = fqel_res;
398 q = aln->
el.get_qel();
402 if (q >= left_old_qel)
404 if (q >= left_new_qel)
412 left_new_qel_res -= q;
418 q = aln->
el.get_qel();
419 if (q >= left_new_qel)
425 left_new_qel_res -= q;
438 }
while (aln != NULL);
439 mcout <<
"BlkArr<T>::put_qel: should never happen\n";
443 long left_old_qel = qel;
444 long left_new_qel = fqel;
447 q = aln->
el.get_qel();
448 if (q >= left_new_qel)
453 for (n = left_new_qel; n < q; n++) {
461 if (left_new_qel != 0)
465 q = aln->
el.get_qel();
466 if (left_old_qel > 0)
468 long l = left_old_qel;
470 for (n = 0; n < l; n++) {
487 }
while (aln != NULL);
494 Ifile <<
"structure: qel=" << qel <<
" size_of_element=" << size_of_element
502 Ifile <<
"n=" << n <<
" qel=" << aln->
el.get_qel() <<
'\n';
503 total_q += aln->
el.get_qel();
505 }
while (aln != NULL);
507 Ifile <<
"total_q=" << total_q <<
'\n';
508 Ifile <<
"end of structure.\n";
520 for (n = 0; n < f.
get_qel(); n++) {
533 f.print_struct(file);
536 for (n = 0; n < f.
get_qel(); n++) {
548 for (n = 0; n < q; n++) {
549 if (!(f1[n] == f2[n]))
return 0;
554template <
class T,
class P>
559 for (n = 0; n < q; n++) {
560 if (!
apeq_mant(f1[n], f2[n], prec))
return 0;
579 for (n = 0; n < q; n++) {
int operator==(const BlkArr< T > &f1, const BlkArr< T > &f2)
DynLinArr< T > convert(const BlkArr< T > &f)
int apeq_mant(const BlkArr< T > &f1, const BlkArr< T > &f2, P prec)
int operator!=(const BlkArr< T > &f1, const BlkArr< T > &f2)
const long max_size_of_extra_increment
void print_BlkArr(std::ostream &file, const DynLinArr< T > &f, int l)
std::ostream & operator<<(std::ostream &file, const BlkArr< T > &f)
AbsListNode< T > * get_next_node(void) const
AbsListNode< T > * insert_after(AbsListNode< T > *an, const T &fel)
void erase(AbsListNode< T > *an)
AbsListNode< T > * get_last_node(void) const
void pilfer(PILF_CONST AbsList< T > &al)
AbsListNode< T > * get_first_node(void) const
const T & operator[](long n) const
void print_struct(std::ostream &file) const
BlkArr< T > & operator=(const BlkArr< T > &f)
BlkArr(long fqel, const T *ar, ArgInterp_Arr t)
BlkArr & assignAll(const T &f)
void pilfer(PILF_CONST BlkArr< T > &f)
BlkArr(long fqel, const T &val)
void allocate_block(long fqel)
void append(const T &val)
const T & last_el(void) const
BlkArr(const BlkArr< T > &f)
BlkArr(PILF_CONST BlkArr< T > &f, Pilfer)
std::ostream & yesindent(std::ostream &f)
std::ostream & noindent(std::ostream &f)