Garfield++ 4.0
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 201 of file AbsPtr.h.

Constructor & Destructor Documentation

◆ CountPassivePtr()

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

Definition at line 203 of file AbsPtr.h.

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

◆ ~CountPassivePtr()

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

Definition at line 818 of file AbsPtr.h.

818 {
819 if (number_of_booked != 0) {
820 mcerr << "Error in CountPassivePtr::~CountPassivePtr():\n"
821 << " number_of_booked != 0, number_of_booked=" << number_of_booked
822 << '\n';
823 if (rpp != NULL)
824 mcerr << (*rpp);
825 else
826 mcerr << "rpp = NULL\n";
827 spexit(mcerr);
828 }
829 if (rpp != NULL) rpp->cpp = NULL;
830}
#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 221 of file AbsPtr.h.

221 {
222 if (number_of_booked > LONG_MAX - 1) {
223 mcerr << "Error in CountPassivePtr::book(void):\n"
224 << " too much booked counters, number_of_booked > LONG_MAX-1, "
225 "number_of_booked=" << number_of_booked << '\n';
226 spexit(mcerr);
227 }
228 number_of_booked++;
229}

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 211 of file AbsPtr.h.

211{ 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 210 of file AbsPtr.h.

210{ return rpp; }

◆ unbook()

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

Definition at line 231 of file AbsPtr.h.

231 {
232 if (number_of_booked < 1) {
233 mcerr << "Error in CountPassivePtr::unbook(void):\n"
234 << " number_of_booked < 1, number_of_booked=" << number_of_booked
235 << '\n';
236 spexit(mcerr);
237 }
238 number_of_booked--;
239}

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