G4AnyType.hh File Reference

#include <algorithm>
#include <typeinfo>
#include <iostream>
#include <sstream>

Go to the source code of this file.

Namespaces

namespace  CLHEP

Data Structures

class  G4AnyType
class  G4AnyType::Placeholder
class  G4AnyType::Ref< ValueType >
class  G4BadAnyCast

Defines

#define G4AnyType_h   1

Functions

template<typename ValueType>
ValueType * any_cast (G4AnyType *operand)
template<typename ValueType>
const ValueType * any_cast (const G4AnyType *operand)
template<typename ValueType>
ValueType any_cast (const G4AnyType &operand)


Define Documentation

#define G4AnyType_h   1

Definition at line 45 of file G4AnyType.hh.


Function Documentation

template<typename ValueType>
ValueType any_cast ( const G4AnyType operand  ) 

value

Definition at line 210 of file G4AnyType.hh.

00210                                                                            {
00211   const ValueType* result = any_cast<ValueType>(&operand);
00212   if (!result) {
00213     throw G4BadAnyCast();
00214   }
00215   return *result;
00216 }

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

value

Definition at line 206 of file G4AnyType.hh.

00206                                                                                   {
00207   return any_cast<ValueType>(const_cast<G4AnyType*>(operand));
00208 }

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

value

Definition at line 201 of file G4AnyType.hh.

References G4AnyType::fContent, and G4AnyType::TypeInfo().

00201                                                                       {
00202   return operand && operand->TypeInfo() == typeid(ValueType)
00203   ? &static_cast<G4AnyType::Ref<ValueType>*>(operand->fContent)->fRef : 0;
00204 }


Generated on Mon May 27 17:50:38 2013 for Geant4 by  doxygen 1.4.7