Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::CountPP_ns::CountPassivePtr Class Reference

Counter of protected pointers. More...

#include <AbsPtr.h>

Public Member Functions

 CountPassivePtr (const RegPassivePtr *frpp)
 
void book (void)
 
void unbook (void)
 
long get_number_of_booked (void)
 
const RegPassivePtrget_rpp (void)
 
void change_rpp (const RegPassivePtr *frpp)
 
 ~CountPassivePtr ()
 

Detailed Description

Counter of protected pointers.

Definition at line 506 of file AbsPtr.h.

Constructor & Destructor Documentation

◆ CountPassivePtr()

Heed::CountPP_ns::CountPassivePtr::CountPassivePtr ( const RegPassivePtr frpp)
inline

Definition at line 508 of file AbsPtr.h.

508: rpp(frpp), number_of_booked(0) {}

◆ ~CountPassivePtr()

Heed::CountPP_ns::CountPassivePtr::~CountPassivePtr ( )
inline

Definition at line 1123 of file AbsPtr.h.

1123 {
1124 if (number_of_booked != 0) {
1125 mcerr << "Error in CountPassivePtr::~CountPassivePtr():\n"
1126 << " number_of_booked != 0, number_of_booked=" << number_of_booked
1127 << '\n';
1128 if (rpp != NULL)
1129 mcerr << (*rpp);
1130 else
1131 mcerr << "rpp = NULL\n";
1132 spexit(mcerr);
1133 }
1134 if (rpp != NULL) rpp->cpp = NULL;
1135}
#define spexit(stream)
Definition: FunNameStack.h:256
#define mcerr
Definition: prstream.h:128

Member Function Documentation

◆ book()

void Heed::CountPP_ns::CountPassivePtr::book ( void  )
inline

Definition at line 526 of file AbsPtr.h.

526 {
527 if (number_of_booked > LONG_MAX - 1) {
528 mcerr << "Error in CountPassivePtr::book(void):\n"
529 << " too much booked counters, number_of_booked > LONG_MAX-1, "
530 "number_of_booked=" << number_of_booked << '\n';
531 spexit(mcerr);
532 }
533 number_of_booked++;
534}

Referenced by Heed::RegPassivePtr::book(), Heed::PassivePtr< X >::move_pointer(), and Heed::PassivePtr< X >::PassivePtr().

◆ change_rpp()

void Heed::CountPP_ns::CountPassivePtr::change_rpp ( const RegPassivePtr frpp)
inline

Definition at line 516 of file AbsPtr.h.

516{ rpp = frpp; }

Referenced by Heed::RegPassivePtr::clear_pointers(), and Heed::RegPassivePtr::~RegPassivePtr().

◆ get_number_of_booked()

long Heed::CountPP_ns::CountPassivePtr::get_number_of_booked ( void  )
inline

◆ get_rpp()

const RegPassivePtr * Heed::CountPP_ns::CountPassivePtr::get_rpp ( void  )
inline

Definition at line 515 of file AbsPtr.h.

515{ return rpp; }

◆ unbook()

void Heed::CountPP_ns::CountPassivePtr::unbook ( void  )
inline

Definition at line 536 of file AbsPtr.h.

536 {
537 if (number_of_booked < 1) {
538 mcerr << "Error in CountPassivePtr::unbook(void):\n"
539 << " number_of_booked < 1, number_of_booked=" << number_of_booked
540 << '\n';
541 spexit(mcerr);
542 }
543 number_of_booked--;
544}

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