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
void * Address () const
std::string ToString () const
void FromString (const std::string &val)

Friends

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

Data Structures

class  Placeholder
class  Ref


Detailed Description

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

Definition at line 61 of file G4AnyType.hh.


Constructor & Destructor Documentation

G4AnyType::G4AnyType (  )  [inline]

Constructor

Definition at line 64 of file G4AnyType.hh.

Referenced by operator=().

00064              :
00065   fContent(0) {}
  

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

Constructor

Definition at line 68 of file G4AnyType.hh.

00068                                                            :
00069   fContent(new Ref<ValueType>(value)) {}
  

G4AnyType::G4AnyType ( const G4AnyType other  )  [inline]

Copy Constructor

Definition at line 72 of file G4AnyType.hh.

00072                                    :
00073   fContent(other.fContent ? other.fContent->Clone() : 0) {}
  

G4AnyType::~G4AnyType (  )  [inline]

Dtor

Definition at line 76 of file G4AnyType.hh.

00076                {
00077     delete fContent;
00078   }


Member Function Documentation

void* G4AnyType::Address (  )  const [inline]

Adress

Definition at line 108 of file G4AnyType.hh.

00108                         {
00109     return fContent ? fContent->Address() : 0;
00110   }

bool G4AnyType::Empty (  )  const [inline]

Query

Definition at line 100 of file G4AnyType.hh.

Referenced by operator bool().

00100                      {
00101     return !fContent;
00102   }

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

String conversion

Definition at line 116 of file G4AnyType.hh.

00116                                         {
00117     fContent->FromString(val);
00118   }

G4AnyType::operator bool (  )  [inline]

bool operator

Definition at line 81 of file G4AnyType.hh.

References Empty().

00081                   {
00082     return !Empty();
00083   }

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

Modifier

Definition at line 95 of file G4AnyType.hh.

References G4AnyType().

00095                                               {
00096     G4AnyType(rhs).Swap(*this);
00097     return *this;
00098   }

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

Modifier

Definition at line 90 of file G4AnyType.hh.

References G4AnyType().

00090                                                                             {
00091     G4AnyType(rhs).Swap(*this);
00092     return *this;
00093   }

G4AnyType& G4AnyType::Swap ( G4AnyType rhs  )  [inline]

Modifier

Definition at line 85 of file G4AnyType.hh.

References fContent.

00085                                   {
00086     std::swap(fContent, rhs.fContent);
00087     return *this;
00088   }

std::string G4AnyType::ToString (  )  const [inline]

String conversion

Definition at line 112 of file G4AnyType.hh.

00112                              {
00113     return fContent->ToString();
00114   }

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

Query

Definition at line 104 of file G4AnyType.hh.

Referenced by any_cast(), and G4GenericMessenger::DeclareProperty().

00104                                        {
00105     return fContent ? fContent->TypeInfo() : typeid(void);
00106   }


Friends And Related Function Documentation

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

value

Definition at line 201 of file G4AnyType.hh.

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


The documentation for this class was generated from the following file:
Generated on Mon May 27 17:51:28 2013 for Geant4 by  doxygen 1.4.7