Geant4 11.1.1
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 67 of file G4AnyMethod.hh.

Constructor & Destructor Documentation

◆ G4AnyMethod() [1/5]

G4AnyMethod::G4AnyMethod ( )
default

contructors

Referenced by operator=().

◆ G4AnyMethod() [2/5]

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

Definition at line 76 of file G4AnyMethod.hh.

77 {
78 fContent = new FuncRef<S, T>(f);
79 }

◆ G4AnyMethod() [3/5]

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

Definition at line 82 of file G4AnyMethod.hh.

83 : narg(1)
84 {
85 fContent = new FuncRef1<S, T, A0>(f);
86 }

◆ G4AnyMethod() [4/5]

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

Definition at line 89 of file G4AnyMethod.hh.

90 : narg(2)
91 {
92 fContent = new FuncRef2<S, T, A0, A1>(f);
93 }

◆ G4AnyMethod() [5/5]

G4AnyMethod::G4AnyMethod ( const G4AnyMethod other)
inline

Definition at line 95 of file G4AnyMethod.hh.

96 : fContent(other.fContent != nullptr ? other.fContent->Clone() : nullptr)
97 , narg(other.narg)
98 {}

◆ ~G4AnyMethod()

G4AnyMethod::~G4AnyMethod ( )
inline

destructor

Definition at line 102 of file G4AnyMethod.hh.

102{ delete fContent; }

Member Function Documentation

◆ ArgType()

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

Definition at line 159 of file G4AnyMethod.hh.

160 {
161 return fContent != nullptr ? fContent->ArgType(n) : typeid(void);
162 }

Referenced by G4GenericMessenger::DeclareMethod().

◆ Empty()

G4bool G4AnyMethod::Empty ( ) const
inline

Query

Definition at line 145 of file G4AnyMethod.hh.

145{ return fContent == nullptr; }

◆ NArg()

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

Number of arguments

Definition at line 157 of file G4AnyMethod.hh.

157{ return narg; }

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

◆ operator()() [1/2]

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

call operators

Definition at line 149 of file G4AnyMethod.hh.

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

◆ operator()() [2/2]

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

Definition at line 150 of file G4AnyMethod.hh.

151 {
152 fContent->operator()(obj, a0);
153 }
const G4double a0

◆ operator=() [1/4]

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

Definition at line 136 of file G4AnyMethod.hh.

137 {
138 G4AnyMethod(rhs).Swap(*this);
139 narg = rhs.narg;
140 return *this;
141 }
G4AnyMethod()=default

◆ operator=() [2/4]

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

Assignment operators

Definition at line 114 of file G4AnyMethod.hh.

115 {
116 G4AnyMethod(f).Swap(*this);
117 narg = 0;
118 return *this;
119 }

◆ operator=() [3/4]

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

Definition at line 122 of file G4AnyMethod.hh.

123 {
124 G4AnyMethod(f).Swap(*this);
125 narg = 1;
126 return *this;
127 }

◆ operator=() [4/4]

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

Definition at line 129 of file G4AnyMethod.hh.

130 {
131 G4AnyMethod(f).Swap(*this);
132 narg = 1;
133 return *this;
134 }

◆ Swap()

G4AnyMethod & G4AnyMethod::Swap ( G4AnyMethod rhs)
inline

Definition at line 104 of file G4AnyMethod.hh.

105 {
106 std::swap(fContent, rhs.fContent);
107 std::swap(narg, rhs.narg);
108 return *this;
109 }

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