Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
AbsPtr.h File Reference
#include <iostream>
#include <cstring>
#include <limits.h>
#include <typeinfo>
#include "wcpplib/stream/prstream.h"
#include "wcpplib/util/FunNameStack.h"
#include "wcpplib/util/emul_new_stand.h"

Go to the source code of this file.

Classes

class  AbsCont
 
class  StandardCopyDefinition< X >
 
class  CopyDefinitionWithoutInheritance< X >
 
class  virt_common_base_col< X, C >
 
class  CountPP_ns::CountPassivePtr
 
class  ActivePtrReg< X, C >
 
class  DoubleReg
 

Namespaces

namespace  CountPP_ns
 

Macros

#define USE_DOUBLE_PTR_IN_PASSIVEPTR
 
#define USE_DELETE_AT_ZERO_COUNT
 
#define COPY_TYPE_CHECK
 
#define PILF_CONST   const
 
#define PILF_MUTABLE   mutable
 
#define USE_GETSETTERS_IN_PASSIVEPTR
 
#define USE_PRIVATE_PARAM_IN_PASSIVEPTR
 
#define USE_CHAR_CONTROL_VARIABLES
 
#define USE_CHAR_GETSETTERS_PARAMETERS
 
#define virt_common_base
 
#define virt_common_base_col
 
#define virt_common_base_comma
 
#define virt_common_base_col_comma
 
#define virt_common_base_pcomma
 
#define AbsCont_copy(type)    virtual type* copy(void) const { return new type(*this); }
 
#define AnyType_copy(derived_type, base_type)    virtual derived_type* copy(void) const { return new derived_type(*this); }
 
#define macro_copy_total(type)    virtual type* copy(void) const { return new type(*this); }
 
#define macro_copy_total_zero(type)   virtual type* copy(void) const = 0
 
#define macro_copy_header(type)   virtual type* copy(void) const
 
#define macro_copy_body(type)    type* type::copy(void) const { return new type(*this); }
 
#define macro_copy_body_not_defined(type)
 
#define USE_OLD_POINTER_NAMES
 
#define AutoCont   ActivePtr
 
#define USE_OLD_POINTER_NAMES
 
#define ProtPtr   PassivePtr
 
#define RegProtPtr   RegPassivePtr
 
#define CountProtPtr   CountPassivePtr
 
#define USE_OLD_POINTER_NAMES
 
#define AutoContReg   ActivePtrReg
 

Enumerations

enum  Pilfer { steal }
 
enum  Clone { do_clone }
 
enum  Pass { dont_clone }
 

Functions

std::ostream & operator<< (std::ostream &file, const AbsCont &f)
 
template<class X , class C >
std::ostream & operator<< (std::ostream &file, const ActivePtr< X, C > &f)
 
template<class X , class C >
std::istream & operator>> (std::istream &file, ActivePtr< X, C > &f)
 
template<class X , class C >
void exchange (ActivePtr< X, C > &f1, ActivePtr< X, C > &f2)
 
template<class X >
std::ostream & operator<< (std::ostream &file, const PassivePtr< X > &f)
 
template<class X >
int operator== (const PassivePtr< X > &f1, const PassivePtr< X > &f2)
 
template<class X >
bool operator< (PassivePtr< X > f1, PassivePtr< X > f2)
 
template<class X >
std::ostream & operator<< (std::ostream &file, const ActivePtrReg< X > &f)
 
std::ostream & operator<< (std::ostream &file, const DoubleReg &f)
 

Macro Definition Documentation

◆ AbsCont_copy

#define AbsCont_copy (   type)     virtual type* copy(void) const { return new type(*this); }

Definition at line 260 of file AbsPtr.h.

◆ AnyType_copy

#define AnyType_copy (   derived_type,
  base_type 
)     virtual derived_type* copy(void) const { return new derived_type(*this); }

Definition at line 262 of file AbsPtr.h.

◆ AutoCont

#define AutoCont   ActivePtr

Definition at line 509 of file AbsPtr.h.

◆ AutoContReg

#define AutoContReg   ActivePtrReg

Definition at line 2319 of file AbsPtr.h.

◆ COPY_TYPE_CHECK

#define COPY_TYPE_CHECK

Definition at line 82 of file AbsPtr.h.

◆ CountProtPtr

#define CountProtPtr   CountPassivePtr

Definition at line 1021 of file AbsPtr.h.

◆ macro_copy_body

#define macro_copy_body (   type)     type* type::copy(void) const { return new type(*this); }

Definition at line 297 of file AbsPtr.h.

◆ macro_copy_body_not_defined

#define macro_copy_body_not_defined (   type)
Value:
type* type::copy(void) const { \
mcerr << "macro_copy_body_not_defined(" << #type << "): forbidden call\n"; \
spexit(mcerr); \
return NULL; \
}
#define mcerr
Definition: prstream.h:135

Definition at line 299 of file AbsPtr.h.

◆ macro_copy_header

#define macro_copy_header (   type)    virtual type* copy(void) const

Definition at line 296 of file AbsPtr.h.

◆ macro_copy_total

#define macro_copy_total (   type)     virtual type* copy(void) const { return new type(*this); }

Definition at line 293 of file AbsPtr.h.

◆ macro_copy_total_zero

#define macro_copy_total_zero (   type)    virtual type* copy(void) const = 0

Definition at line 295 of file AbsPtr.h.

◆ PILF_CONST

#define PILF_CONST   const

Definition at line 142 of file AbsPtr.h.

◆ PILF_MUTABLE

#define PILF_MUTABLE   mutable

Definition at line 143 of file AbsPtr.h.

◆ ProtPtr

#define ProtPtr   PassivePtr

Definition at line 1019 of file AbsPtr.h.

◆ RegProtPtr

#define RegProtPtr   RegPassivePtr

Definition at line 1020 of file AbsPtr.h.

◆ USE_CHAR_CONTROL_VARIABLES

#define USE_CHAR_CONTROL_VARIABLES

Definition at line 174 of file AbsPtr.h.

◆ USE_CHAR_GETSETTERS_PARAMETERS

#define USE_CHAR_GETSETTERS_PARAMETERS

Definition at line 207 of file AbsPtr.h.

◆ USE_DELETE_AT_ZERO_COUNT

#define USE_DELETE_AT_ZERO_COUNT

Definition at line 50 of file AbsPtr.h.

◆ USE_DOUBLE_PTR_IN_PASSIVEPTR

#define USE_DOUBLE_PTR_IN_PASSIVEPTR

Definition at line 41 of file AbsPtr.h.

◆ USE_GETSETTERS_IN_PASSIVEPTR

#define USE_GETSETTERS_IN_PASSIVEPTR

Definition at line 156 of file AbsPtr.h.

◆ USE_OLD_POINTER_NAMES [1/3]

#define USE_OLD_POINTER_NAMES

Definition at line 2317 of file AbsPtr.h.

◆ USE_OLD_POINTER_NAMES [2/3]

#define USE_OLD_POINTER_NAMES

Definition at line 2317 of file AbsPtr.h.

◆ USE_OLD_POINTER_NAMES [3/3]

#define USE_OLD_POINTER_NAMES

Definition at line 2317 of file AbsPtr.h.

◆ USE_PRIVATE_PARAM_IN_PASSIVEPTR

#define USE_PRIVATE_PARAM_IN_PASSIVEPTR

Definition at line 165 of file AbsPtr.h.

◆ virt_common_base

#define virt_common_base

Definition at line 241 of file AbsPtr.h.

◆ virt_common_base_col

Definition at line 242 of file AbsPtr.h.

◆ virt_common_base_col_comma

#define virt_common_base_col_comma

Definition at line 244 of file AbsPtr.h.

◆ virt_common_base_comma

#define virt_common_base_comma

Definition at line 243 of file AbsPtr.h.

◆ virt_common_base_pcomma

#define virt_common_base_pcomma

Definition at line 245 of file AbsPtr.h.

Enumeration Type Documentation

◆ Clone

enum Clone
Enumerator
do_clone 

Definition at line 515 of file AbsPtr.h.

515 {
517};
@ do_clone
Definition: AbsPtr.h:516

◆ Pass

enum Pass
Enumerator
dont_clone 

Definition at line 518 of file AbsPtr.h.

518 {
520};
@ dont_clone
Definition: AbsPtr.h:519

◆ Pilfer

enum Pilfer
Enumerator
steal 

Definition at line 512 of file AbsPtr.h.

512 {
513 steal
514};
@ steal
Definition: AbsPtr.h:513

Function Documentation

◆ exchange()

template<class X , class C >
void exchange ( ActivePtr< X, C > &  f1,
ActivePtr< X, C > &  f2 
)
inline

Definition at line 879 of file AbsPtr.h.

879 {
880 X* ptr = f1.extract();
881 f1.pass(f2.extract());
882 f2.pass(ptr);
883}

◆ operator<()

template<class X >
bool operator< ( PassivePtr< X >  f1,
PassivePtr< X >  f2 
)

Definition at line 2311 of file AbsPtr.h.

2313 {
2314 return f1.get() < f2.get();
2315}

◆ operator<<() [1/5]

std::ostream & operator<< ( std::ostream &  file,
const AbsCont f 
)
inline

Definition at line 337 of file AbsPtr.h.

337 {
338 Ifile << "operator<<AbsCont& is called.\n";
339 f.print(file, 0); // this line is needed only to avoid warnings
340 // at some severe compiler options that f is unused.
341 return file;
342}
virtual void print(std::ostream &file, int l) const
Definition: AbsPtr.h:282
#define Ifile
Definition: prstream.h:207

◆ operator<<() [2/5]

template<class X , class C >
std::ostream & operator<< ( std::ostream &  file,
const ActivePtr< X, C > &  f 
)

Definition at line 766 of file AbsPtr.h.

766 {
767 Ifile << "ActivePtr<X,C>: ";
768 if (f.get() == NULL)
769 file << " ptr==NULL. \n"; // optimized to provide automatic reading
770 else {
771 file << " ptr!=NULL: ";
772 file << noindent;
773 file << (*f.get());
774 file << yesindent;
775 }
776
777 /*
778 if(f.get() == NULL)
779 file<<" pointer in NULL, no object.\n";
780 else
781 {
782 file<<noindent;
783 file<<(*f.get());
784 //f.get()->print(file,1); alternatively,
785 // but logically it is better as above
786 file<<yesindent;
787 }
788 */
789 return file;
790}
std::ostream & yesindent(std::ostream &f)
Definition: prstream.cpp:19
std::ostream & noindent(std::ostream &f)
Definition: prstream.cpp:15

◆ operator<<() [3/5]

template<class X >
std::ostream & operator<< ( std::ostream &  file,
const ActivePtrReg< X > &  f 
)

Definition at line 2359 of file AbsPtr.h.

2359 {
2360 Ifile << "ActivePtrReg<X>:";
2361 file << noindent;
2362 file << (ActivePtr<X>&)f;
2363 file << yesindent;
2364 return file;
2365}

◆ operator<<() [4/5]

std::ostream & operator<< ( std::ostream &  file,
const DoubleReg f 
)

Definition at line 268 of file AbsPtr.cpp.

270 { // make output similar to ordinary double
271 file << f.val;
272 return file;
273}
double val
Definition: AbsPtr.h:2398

◆ operator<<() [5/5]

template<class X >
std::ostream & operator<< ( std::ostream &  file,
const PassivePtr< X > &  f 
)

Definition at line 1839 of file AbsPtr.h.

1839 {
1840 Ifile << "PassivePtr<X>:";
1841 if (f.get() == NULL)
1842 file << " pointer is NULL, no object, number of ref's is "
1843 << f.get_total_number_of_references() << "\n";
1844 else {
1845 file << noindent;
1846 file << (*f.get());
1847 file << yesindent;
1848 indn.n += 2;
1849 Ifile << "number of ref's is " << f.get_total_number_of_references()
1850 << '\n';
1851 indn.n -= 2;
1852
1853 }
1854 return file;
1855}
indentation indn
Definition: prstream.cpp:13

◆ operator==()

template<class X >
int operator== ( const PassivePtr< X > &  f1,
const PassivePtr< X > &  f2 
)
inline

Definition at line 2280 of file AbsPtr.h.

2282 { // comparison of addresses, so it mimics
2283 // regular pointers
2284 return f1.get() == f2.get();
2285}

◆ operator>>()

template<class X , class C >
std::istream & operator>> ( std::istream &  file,
ActivePtr< X, C > &  f 
)

Definition at line 793 of file AbsPtr.h.

793 {
794 long q = 13;
795 long n;
796 char keyline[13];
797 for (n = 0; n < q - 1; n++) {
798 keyline[n] = file.get();
799 }
800 keyline[n] = '\0';
801 if (!strcmp(&(keyline[0]), " ptr==NULL. ")) {
802 f.clear();
803 } else {
804 X x;
805 file >> x;
806 f.put(x);
807 }
808 return file;
809}