Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AnyMethod Class Reference

#include <G4AnyMethod.hh>

Public Member Functions

 G4AnyMethod ()=default
 
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)
 
G4bool Empty () const
 
void operator() (void *obj)
 
void operator() (void *obj, const std::string &a0)
 
std::size_t NArg () const
 
const std::type_info & ArgType (size_t n=0) const
 

Detailed Description

Definition at line 64 of file G4AnyMethod.hh.

Constructor & Destructor Documentation

◆ G4AnyMethod() [1/5]

G4AnyMethod::G4AnyMethod ( )
default

◆ G4AnyMethod() [2/5]

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

Definition at line 70 of file G4AnyMethod.hh.

71 {
72 fContent = new FuncRef<S, T>(f);
73 }

◆ G4AnyMethod() [3/5]

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

Definition at line 76 of file G4AnyMethod.hh.

76 : narg(1)
77 {
78 fContent = new FuncRef1<S, T, A0>(f);
79 }

◆ G4AnyMethod() [4/5]

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

Definition at line 82 of file G4AnyMethod.hh.

82 : narg(2)
83 {
84 fContent = new FuncRef2<S, T, A0, A1>(f);
85 }

◆ G4AnyMethod() [5/5]

G4AnyMethod::G4AnyMethod ( const G4AnyMethod & other)
inline

Definition at line 87 of file G4AnyMethod.hh.

88 : fContent(other.fContent != nullptr ? other.fContent->Clone() : nullptr), narg(other.narg)
89 {}

◆ ~G4AnyMethod()

G4AnyMethod::~G4AnyMethod ( )
inline

Definition at line 91 of file G4AnyMethod.hh.

91{ delete fContent; }

Member Function Documentation

◆ ArgType()

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

Definition at line 143 of file G4AnyMethod.hh.

144 {
145 return fContent != nullptr ? fContent->ArgType(n) : typeid(void);
146 }

Referenced by G4GenericMessenger::DeclareMethod().

◆ Empty()

G4bool G4AnyMethod::Empty ( ) const
inline

Query

Definition at line 132 of file G4AnyMethod.hh.

132{ return fContent == nullptr; }

◆ NArg()

std::size_t G4AnyMethod::NArg ( ) const
inline

Number of arguments

Definition at line 141 of file G4AnyMethod.hh.

141{ return narg; }

Referenced by G4GenericMessenger::DeclareMethod(), and G4GenericMessenger::DeclareMethodWithUnit().

◆ operator()() [1/2]

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

call operators

Definition at line 136 of file G4AnyMethod.hh.

136{ fContent->operator()(obj); }

◆ operator()() [2/2]

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

Definition at line 137 of file G4AnyMethod.hh.

137{ fContent->operator()(obj, a0); }
const G4double a0

◆ operator=() [1/4]

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

Definition at line 123 of file G4AnyMethod.hh.

124 {
125 G4AnyMethod(rhs).Swap(*this);
126 narg = rhs.narg;
127 return *this;
128 }
G4AnyMethod()=default

◆ operator=() [2/4]

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

Definition at line 101 of file G4AnyMethod.hh.

102 {
103 G4AnyMethod(f).Swap(*this);
104 narg = 0;
105 return *this;
106 }

◆ operator=() [3/4]

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

Definition at line 109 of file G4AnyMethod.hh.

110 {
111 G4AnyMethod(f).Swap(*this);
112 narg = 1;
113 return *this;
114 }

◆ operator=() [4/4]

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

Definition at line 116 of file G4AnyMethod.hh.

117 {
118 G4AnyMethod(f).Swap(*this);
119 narg = 1;
120 return *this;
121 }

◆ Swap()

G4AnyMethod & G4AnyMethod::Swap ( G4AnyMethod & rhs)
inline

Definition at line 93 of file G4AnyMethod.hh.

94 {
95 std::swap(fContent, rhs.fContent);
96 std::swap(narg, rhs.narg);
97 return *this;
98 }

Referenced by operator=(), operator=(), operator=(), and operator=().


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