Geant4  10.02.p03
G4AnyMethod Class Reference

#include <G4AnyMethod.hh>

Collaboration diagram for G4AnyMethod:

Classes

struct  FuncRef
 
struct  FuncRef1
 
struct  FuncRef2
 
class  Placeholder
 

Public Member Functions

 G4AnyMethod ()
 
template<class S , class T >
 G4AnyMethod (S(T::*f)())
 
template<class S , class T , class A0 >
 G4AnyMethod (S(T::*f)(A0))
 
template<class S , class T , class A0 , class A1 >
 G4AnyMethod (S(T::*f)(A0, A1))
 
 G4AnyMethod (const G4AnyMethod &other)
 
 ~G4AnyMethod ()
 
G4AnyMethodSwap (G4AnyMethod &rhs)
 
template<class S , class T >
G4AnyMethodoperator= (S(T::*f)())
 
template<class S , class T , class A0 >
G4AnyMethodoperator= (S(T::*f)(A0))
 
template<class S , class T , class A0 , class A1 >
G4AnyMethodoperator= (S(T::*f)(A0, A1))
 
G4AnyMethodoperator= (const G4AnyMethod &rhs)
 
bool Empty () const
 
void operator() (void *obj)
 
void operator() (void *obj, const std::string &a0)
 
size_t NArg () const
 
const std::type_info & ArgType (size_t n=0) const
 

Private Attributes

PlaceholderfContent
 
size_t narg
 

Detailed Description

This class represents any object method. The class only holds a member pointer.

Definition at line 80 of file G4AnyMethod.hh.

Constructor & Destructor Documentation

◆ G4AnyMethod() [1/5]

G4AnyMethod::G4AnyMethod ( )
inline

contructor

Definition at line 83 of file G4AnyMethod.hh.

83 : fContent(0), narg(0) {}
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ G4AnyMethod() [2/5]

template<class S , class T >
G4AnyMethod::G4AnyMethod ( S(T::*)()  f)
inline

Definition at line 84 of file G4AnyMethod.hh.

84  : narg(0) {
85  fContent = new FuncRef<S,T>(f);
86  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ G4AnyMethod() [3/5]

template<class S , class T , class A0 >
G4AnyMethod::G4AnyMethod ( S(T::*)(A0)  f)
inline

Definition at line 87 of file G4AnyMethod.hh.

87  : narg(1) {
88  fContent = new FuncRef1<S,T,A0>(f);
89  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ G4AnyMethod() [4/5]

template<class S , class T , class A0 , class A1 >
G4AnyMethod::G4AnyMethod ( S(T::*)(A0, A1)  f)
inline

Definition at line 90 of file G4AnyMethod.hh.

90  : narg(2) {
91  fContent = new FuncRef2<S,T,A0,A1>(f);
92  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ G4AnyMethod() [5/5]

G4AnyMethod::G4AnyMethod ( const G4AnyMethod other)
inline

Definition at line 93 of file G4AnyMethod.hh.

93  :
94  fContent(other.fContent ? other.fContent->Clone() : 0),narg(other.narg) {}
virtual Placeholder * Clone() const =0
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ ~G4AnyMethod()

G4AnyMethod::~G4AnyMethod ( )
inline

destructor

Definition at line 96 of file G4AnyMethod.hh.

96  {
97  delete fContent;
98  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222

Member Function Documentation

◆ ArgType()

const std::type_info& G4AnyMethod::ArgType ( size_t  n = 0) const
inline

Definition at line 141 of file G4AnyMethod.hh.

141  {
142  return fContent ? fContent->ArgType(n) : typeid(void);
143  }
virtual const std::type_info & ArgType(size_t) const =0
Char_t n[5]
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ Empty()

bool G4AnyMethod::Empty ( ) const
inline

Query

Definition at line 128 of file G4AnyMethod.hh.

128  {
129  return !fContent;
130  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ NArg()

size_t G4AnyMethod::NArg ( ) const
inline

Number of arguments

Definition at line 139 of file G4AnyMethod.hh.

139 { return narg; }
Here is the caller graph for this function:

◆ operator()() [1/2]

void G4AnyMethod::operator() ( void *  obj)
inline

call operator

Definition at line 132 of file G4AnyMethod.hh.

132  {
133  fContent->operator()(obj);
134  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ operator()() [2/2]

void G4AnyMethod::operator() ( void *  obj,
const std::string &  a0 
)
inline

Definition at line 135 of file G4AnyMethod.hh.

135  {
136  fContent->operator()(obj, a0);
137  }
const G4double a0
Placeholder * fContent
Definition: G4AnyMethod.hh:222

◆ operator=() [1/4]

template<class S , class T >
G4AnyMethod& G4AnyMethod::operator= ( S(T::*)()  f)
inline

Asignment operator

Definition at line 106 of file G4AnyMethod.hh.

106  {
107  G4AnyMethod(f).Swap(*this);
108  narg = 0;
109  return *this;
110  }
Here is the call graph for this function:

◆ operator=() [2/4]

template<class S , class T , class A0 >
G4AnyMethod& G4AnyMethod::operator= ( S(T::*)(A0)  f)
inline

Definition at line 111 of file G4AnyMethod.hh.

111  {
112  G4AnyMethod(f).Swap(*this);
113  narg = 1;
114  return *this;
115  }
Here is the call graph for this function:

◆ operator=() [3/4]

template<class S , class T , class A0 , class A1 >
G4AnyMethod& G4AnyMethod::operator= ( S(T::*)(A0, A1)  f)
inline

Definition at line 116 of file G4AnyMethod.hh.

116  {
117  G4AnyMethod(f).Swap(*this);
118  narg = 1;
119  return *this;
120  }
Here is the call graph for this function:

◆ operator=() [4/4]

G4AnyMethod& G4AnyMethod::operator= ( const G4AnyMethod rhs)
inline

Asigment operator

Definition at line 122 of file G4AnyMethod.hh.

122  {
123  G4AnyMethod(rhs).Swap(*this);
124  narg = rhs.narg;
125  return *this;
126  }
Here is the call graph for this function:

◆ Swap()

G4AnyMethod& G4AnyMethod::Swap ( G4AnyMethod rhs)
inline

Definition at line 100 of file G4AnyMethod.hh.

100  {
101  std::swap(fContent, rhs.fContent);
102  std::swap(narg, rhs.narg);
103  return *this;
104  }
Placeholder * fContent
Definition: G4AnyMethod.hh:222
Here is the caller graph for this function:

Member Data Documentation

◆ fContent

Placeholder* G4AnyMethod::fContent
private

Definition at line 222 of file G4AnyMethod.hh.

◆ narg

size_t G4AnyMethod::narg
private

Definition at line 223 of file G4AnyMethod.hh.


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