Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Public Member Functions
G4AnyMethod Class Reference

#include <G4AnyMethod.hh>

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
 

Detailed Description

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

Definition at line 67 of file G4AnyMethod.hh.

Constructor & Destructor Documentation

G4AnyMethod::G4AnyMethod ( )
inline

contructor

Definition at line 70 of file G4AnyMethod.hh.

Referenced by operator=().

70 : fContent(0), narg(0) {}
template<class S , class T >
G4AnyMethod::G4AnyMethod ( S(T::*)()  f)
inline

Definition at line 71 of file G4AnyMethod.hh.

71  : narg(0) {
72  fContent = new FuncRef<S,T>(f);
73  }
template<class S , class T , class A0 >
G4AnyMethod::G4AnyMethod ( S(T::*)(A0)  f)
inline

Definition at line 74 of file G4AnyMethod.hh.

74  : narg(1) {
75  fContent = new FuncRef1<S,T,A0>(f);
76  }
template<class S , class T , class A0 , class A1 >
G4AnyMethod::G4AnyMethod ( S(T::*)(A0, A1)  f)
inline

Definition at line 77 of file G4AnyMethod.hh.

77  : narg(2) {
78  fContent = new FuncRef2<S,T,A0,A1>(f);
79  }
G4AnyMethod::G4AnyMethod ( const G4AnyMethod other)
inline

Definition at line 80 of file G4AnyMethod.hh.

80  :
81  fContent(other.fContent ? other.fContent->Clone() : 0),narg(other.narg) {}
G4AnyMethod::~G4AnyMethod ( )
inline

destructor

Definition at line 83 of file G4AnyMethod.hh.

83  {
84  delete fContent;
85  }

Member Function Documentation

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

Definition at line 128 of file G4AnyMethod.hh.

References n, and void().

128  {
129  return fContent ? fContent->ArgType(n) : typeid(void);
130  }
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
const G4int n
bool G4AnyMethod::Empty ( ) const
inline

Query

Definition at line 115 of file G4AnyMethod.hh.

115  {
116  return !fContent;
117  }
size_t G4AnyMethod::NArg ( ) const
inline

Number of arguments

Definition at line 126 of file G4AnyMethod.hh.

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

126 { return narg; }
void G4AnyMethod::operator() ( void obj)
inline

call operator

Definition at line 119 of file G4AnyMethod.hh.

119  {
120  fContent->operator()(obj);
121  }
void G4AnyMethod::operator() ( void obj,
const std::string &  a0 
)
inline

Definition at line 122 of file G4AnyMethod.hh.

122  {
123  fContent->operator()(obj, a0);
124  }
template<class S , class T >
G4AnyMethod& G4AnyMethod::operator= ( S(T::*)()  f)
inline

Asignment operator

Definition at line 93 of file G4AnyMethod.hh.

References G4AnyMethod().

93  {
94  G4AnyMethod(f).Swap(*this);
95  narg = 0;
96  return *this;
97  }
template<class S , class T , class A0 >
G4AnyMethod& G4AnyMethod::operator= ( S(T::*)(A0)  f)
inline

Definition at line 98 of file G4AnyMethod.hh.

References G4AnyMethod().

98  {
99  G4AnyMethod(f).Swap(*this);
100  narg = 1;
101  return *this;
102  }
template<class S , class T , class A0 , class A1 >
G4AnyMethod& G4AnyMethod::operator= ( S(T::*)(A0, A1)  f)
inline

Definition at line 103 of file G4AnyMethod.hh.

References G4AnyMethod().

103  {
104  G4AnyMethod(f).Swap(*this);
105  narg = 1;
106  return *this;
107  }
G4AnyMethod& G4AnyMethod::operator= ( const G4AnyMethod rhs)
inline

Asigment operator

Definition at line 109 of file G4AnyMethod.hh.

References G4AnyMethod().

109  {
110  G4AnyMethod(rhs).Swap(*this);
111  narg = rhs.narg;
112  return *this;
113  }
G4AnyMethod& G4AnyMethod::Swap ( G4AnyMethod rhs)
inline

Definition at line 87 of file G4AnyMethod.hh.

References CLHEP::swap().

87  {
88  std::swap(fContent, rhs.fContent);
89  std::swap(narg, rhs.narg);
90  return *this;
91  }
void swap(shared_ptr< P > &, shared_ptr< P > &)
Definition: memory.h:1247

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