Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4AnyType Class Reference

#include <G4AnyType.hh>

Public Member Functions

 G4AnyType ()
 
template<typename ValueType >
 G4AnyType (ValueType &value)
 
 G4AnyType (const G4AnyType &other)
 
 ~G4AnyType ()
 
 operator bool ()
 
G4AnyTypeSwap (G4AnyType &rhs)
 
template<typename ValueType >
G4AnyTypeoperator= (const ValueType &rhs)
 
G4AnyTypeoperator= (const G4AnyType &rhs)
 
bool Empty () const
 
const std::type_info & TypeInfo () const
 
voidAddress () const
 
std::string ToString () const
 
void FromString (const std::string &val)
 

Friends

template<typename ValueType >
ValueType * any_cast (G4AnyType *)
 

Detailed Description

This class represents any data type. The class only holds a reference to the type and not the value.

Definition at line 63 of file G4AnyType.hh.

Constructor & Destructor Documentation

G4AnyType::G4AnyType ( )
inline

Constructor

Definition at line 66 of file G4AnyType.hh.

66  :
67  fContent(0) {}

Here is the caller graph for this function:

template<typename ValueType >
G4AnyType::G4AnyType ( ValueType &  value)
inline

Constructor

Definition at line 70 of file G4AnyType.hh.

70  :
71  fContent(new Ref<ValueType>(value)) {}
const XML_Char int const XML_Char * value
Definition: expat.h:331
G4AnyType::G4AnyType ( const G4AnyType other)
inline

Copy Constructor

Definition at line 74 of file G4AnyType.hh.

74  :
75  fContent(other.fContent ? other.fContent->Clone() : 0) {}
G4AnyType::~G4AnyType ( )
inline

Dtor

Definition at line 78 of file G4AnyType.hh.

78  {
79  delete fContent;
80  }

Member Function Documentation

void* G4AnyType::Address ( ) const
inline

Adress

Definition at line 110 of file G4AnyType.hh.

110  {
111  return fContent ? fContent->Address() : 0;
112  }
bool G4AnyType::Empty ( ) const
inline

Query

Definition at line 102 of file G4AnyType.hh.

102  {
103  return !fContent;
104  }

Here is the caller graph for this function:

void G4AnyType::FromString ( const std::string &  val)
inline

String conversion

Definition at line 118 of file G4AnyType.hh.

118  {
119  fContent->FromString(val);
120  }

Here is the caller graph for this function:

G4AnyType::operator bool ( )
inline

bool operator

Definition at line 83 of file G4AnyType.hh.

83  {
84  return !Empty();
85  }
bool Empty() const
Definition: G4AnyType.hh:102

Here is the call graph for this function:

template<typename ValueType >
G4AnyType& G4AnyType::operator= ( const ValueType &  rhs)
inline

Modifier

Definition at line 92 of file G4AnyType.hh.

92  {
93  G4AnyType(rhs).Swap(*this);
94  return *this;
95  }

Here is the call graph for this function:

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

Modifier

Definition at line 97 of file G4AnyType.hh.

97  {
98  G4AnyType(rhs).Swap(*this);
99  return *this;
100  }

Here is the call graph for this function:

G4AnyType& G4AnyType::Swap ( G4AnyType rhs)
inline

Modifier

Definition at line 87 of file G4AnyType.hh.

87  {
88  std::swap(fContent, rhs.fContent);
89  return *this;
90  }
std::string G4AnyType::ToString ( ) const
inline

String conversion

Definition at line 114 of file G4AnyType.hh.

114  {
115  return fContent->ToString();
116  }

Here is the caller graph for this function:

const std::type_info& G4AnyType::TypeInfo ( ) const
inline

Query

Definition at line 106 of file G4AnyType.hh.

106  {
107  return fContent ? fContent->TypeInfo() : typeid(void);
108  }
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename ValueType >
ValueType* any_cast ( G4AnyType operand)
friend

representation

value

Definition at line 213 of file G4AnyType.hh.

213  {
214  return operand && operand->TypeInfo() == typeid(ValueType)
215  ? &static_cast<G4AnyType::Ref<ValueType>*>(operand->fContent)->fRef : 0;
216 }
const std::type_info & TypeInfo() const
Definition: G4AnyType.hh:106

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