Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
AbsListNode< T > Class Template Reference

#include <AbsList.h>

+ Inheritance diagram for AbsListNode< T >:

Public Member Functions

AbsList< T > * get_head_node (void) const
 
AbsListNode< T > * get_prev_node (void) const
 
AbsListNode< T > * get_next_node (void) const
 
void exclude (void)
 
virtual ~AbsListNode ()
 
 macro_copy_total (AbsListNode)
 

Public Attributes

el
 

Friends

AbsListNode< T > * glob_insert_before (AbsList< T > &, AbsListNode< T > *, const T &fel)
 
AbsListNode< T > * glob_insert_after (AbsList< T > &, AbsListNode< T > *, const T &fel)
 
void glob_pilfer (AbsList< T > &, PILF_CONST AbsList< T > &)
 

Detailed Description

template<class T>
class AbsListNode< T >

Definition at line 72 of file AbsList.h.

Constructor & Destructor Documentation

◆ ~AbsListNode()

template<class T >
virtual AbsListNode< T >::~AbsListNode ( )
inlinevirtual

Definition at line 120 of file AbsList.h.

121 {
122 exclude();
123 /*
124 if(head_node != NULL)
125 mcout<<"~AbsListNode(): error: head_node != NULL\n";
126 if(prev_node != NULL)
127 mcout<<"~AbsListNode(): error: prev_node != NULL\n";
128 if(next_node != NULL)
129 mcout<<"~AbsListNode(): error: next_node != NULL\n";
130 */
131 }
void exclude(void)
Definition: AbsList.h:298

Member Function Documentation

◆ exclude()

template<class T >
void AbsListNode< T >::exclude ( void  )

Definition at line 298 of file AbsList.h.

301 {
302 if (prev_node != NULL) prev_node->next_node = next_node;
303 if (next_node != NULL) next_node->prev_node = prev_node;
304 if (head_node != NULL) // normally cannot be
305 {
306 if (head_node->qel <= 0) {
307 mcerr << "ERROR in template<class T> void AbsListNode<T>::exclude()\n";
308 mcerr << "head_node->qel <= 0, contradicts to request to exclude\n";
309 Iprintn(mcerr, head_node->qel);
310 spexit(mcerr);
311 }
312 if (head_node->first_node == this) head_node->first_node = next_node;
313 if (head_node->last_node == this) head_node->last_node = prev_node;
314 head_node->qel--;
315 }
316 head_node = NULL;
317 prev_node = NULL;
318 next_node = NULL;
319}
#define spexit(stream)
Definition: FunNameStack.h:536
#define mcerr
Definition: prstream.h:135
#define Iprintn(file, name)
Definition: prstream.h:216

Referenced by AbsListNode< T >::~AbsListNode().

◆ get_head_node()

template<class T >
AbsList< T > * AbsListNode< T >::get_head_node ( void  ) const
inline

Definition at line 96 of file AbsList.h.

96{ return head_node; }

Referenced by AbsList< T >::erase().

◆ get_next_node()

◆ get_prev_node()

template<class T >
AbsListNode< T > * AbsListNode< T >::get_prev_node ( void  ) const
inline

Definition at line 97 of file AbsList.h.

97{ return prev_node; }

◆ macro_copy_total()

template<class T >
AbsListNode< T >::macro_copy_total ( AbsListNode< T >  )

Friends And Related Function Documentation

◆ glob_insert_after

template<class T >
AbsListNode< T > * glob_insert_after ( AbsList< T > &  al,
AbsListNode< T > *  aln,
const T &  fel 
)
friend

Definition at line 441 of file AbsList.h.

442 {
443 AbsListNode<T>* new_aln = NULL;
444 if (aln == NULL) // no node after which it needs to insert
445 {
446 if (al.qel == 0) // empty list, OK
447 {
448 al.first_node = new AbsListNode<T>(&al, NULL, NULL, fel);
449 al.last_node = al.first_node;
450 new_aln = al.first_node;
451 al.qel = 1;
452 } else {
453 mcerr << "ERROR in template<class T> AbsListNode<T>* glob_insert_after\n";
454 mcerr << " aln is zero, but the list is not empty\n";
455 spexit(mcerr);
456 }
457 } else {
458 if (aln->get_head_node() != &al) // not our node or list
459 {
460 mcerr
461 << "ERROR in template<class T> AbsListNode<T>* glob_insert_after\n";
462 mcerr << "aln->get_heed_node() != this\n";
463 Iprint2n(mcerr, aln->get_head_node(), &al);
464 spexit(mcerr);
465 } else {
466 if (al.qel <= 0) // all ours but empty list - it is not consistent
467 {
468 mcerr << "ERROR in template<class T> AbsListNode<T>* "
469 "glob_insert_after\n";
470 mcerr << "qel <= 0 but aln is not empty\n";
471 Iprintn(mcerr, al.qel);
472 spexit(mcerr);
473 } else {
474 new_aln = new AbsListNode<T>(&al, aln, aln->get_next_node(), fel);
475 //if(new_aln->get_next_node().get() == NULL)
476 if (aln == al.last_node) {
477 al.last_node = new_aln;
478 }
479 al.qel++;
480 }
481 }
482 }
483 return new_aln;
484}
AbsList< T > * get_head_node(void) const
Definition: AbsList.h:96
AbsListNode< T > * get_next_node(void) const
Definition: AbsList.h:98
#define Iprint2n(file, name1, name2)
Definition: prstream.h:236

◆ glob_insert_before

template<class T >
AbsListNode< T > * glob_insert_before ( AbsList< T > &  al,
AbsListNode< T > *  aln,
const T &  fel 
)
friend

Definition at line 322 of file AbsList.h.

323 {
324 AbsListNode<T>* new_aln = NULL;
325 if (aln == NULL) // means to insert at the first place
326 {
327 if (al.qel == 0) // no elements, then the addresses should be empty as well
328 {
329 if (al.first_node != NULL || al.last_node != NULL) {
330 mcerr << "ERROR in template<class T> AbsListNode<T>* "
331 "glob_insert_before\n";
332 mcerr << "qel == 0, but first_node != NULL || last_node != NULL \n";
333 Iprintn(mcerr, al.first_node);
334 Iprintn(mcerr, al.last_node);
335 spexit(mcerr);
336 }
337 al.first_node = new AbsListNode<T>(&al, NULL, NULL, fel);
338 al.last_node = al.first_node;
339 new_aln = al.first_node;
340 al.qel = 1;
341 } else {
342 mcerr
343 << "ERROR in template<class T> AbsListNode<T>* glob_insert_before\n";
344 mcerr << " aln is zero, but the list is not empty\n";
345 spexit(mcerr);
346 }
347 } else {
348 if (aln->get_head_node() != &al) {
349 mcerr
350 << "ERROR in template<class T> AbsListNode<T>* glob_insert_before\n";
351 mcerr << "aln->get_head_node() != this\n";
352 Iprint2n(mcerr, aln->get_head_node(), al);
353 spexit(mcerr);
354 } else {
355 if (al.qel <= 0) {
356 mcerr << "ERROR in template<class T> AbsListNode<T>* "
357 "glob_insert_before\n";
358 mcerr << "qel <= 0 but aln is not empty\n";
359 Iprintn(mcerr, al.qel);
360 spexit(mcerr);
361 } else {
362 new_aln = new AbsListNode<T>(&al, aln->get_prev_node(), aln, fel);
363 if (aln == al.first_node) {
364 al.first_node = new_aln;
365 }
366 al.qel++;
367 }
368 }
369 }
370 return new_aln;
371}
AbsListNode< T > * get_prev_node(void) const
Definition: AbsList.h:97

◆ glob_pilfer

template<class T >
void glob_pilfer ( AbsList< T > &  this_al,
PILF_CONST AbsList< T > &  al 
)
friend

Definition at line 635 of file AbsList.h.

635 {
636#ifdef DEBUG_ABSLIST
637 mcout << "void glob_pilfer(AbsList<T>& this_al, PILF_CONST AbsList<T>& al) "
638 "is starting\n";
639#endif
640 if (this_al.qel != 0) {
641 if (al.qel != 0) {
642 mcerr << "ERROR in glob_pilfer(...):\n";
643 mcerr << "Both the destination and source lists are not empty\n";
644 // For explanations why it is dangerous, see similar function
645 // of ActivePtr.
646 spexit(mcerr);
647 } else {
648 this_al.clear();
649 }
650 }
651 this_al.first_node = al.first_node;
652 this_al.last_node = al.last_node;
653 this_al.qel = al.qel;
654 AbsListNode<T>* cur_node = this_al.first_node;
655 while (cur_node != NULL) {
656 cur_node->head_node = &this_al;
657 cur_node = cur_node->get_next_node();
658 }
659 al.first_node = NULL;
660 al.last_node = NULL;
661 al.qel = 0;
662}
void clear(void)
Definition: AbsList.h:227
#define mcout
Definition: prstream.h:133

Member Data Documentation

◆ el


The documentation for this class was generated from the following file: