Geant4-11
Public Member Functions | Data Fields
G4AnyType::Ref< ValueType > Class Template Reference
Inheritance diagram for G4AnyType::Ref< ValueType >:
G4AnyType::Placeholder

Public Member Functions

virtual void * Address () const
 
virtual PlaceholderClone () const
 
virtual void FromString (const std::string &val)
 
void FromString (const std::string &val)
 
void FromString (const std::string &val)
 
void FromString (const std::string &val)
 
 Ref (ValueType &value)
 
virtual std::string ToString () const
 
virtual const std::type_info & TypeInfo () const
 

Data Fields

ValueType & fRef
 

Detailed Description

template<typename ValueType>
class G4AnyType::Ref< ValueType >

Definition at line 159 of file G4AnyType.hh.

Constructor & Destructor Documentation

◆ Ref()

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

Constructor

Definition at line 165 of file G4AnyType.hh.

166 : fRef(value)
167 {}
ValueType & fRef
Definition: G4AnyType.hh:201

Referenced by G4AnyType::Ref< ValueType >::Clone().

Member Function Documentation

◆ Address()

template<typename ValueType >
virtual void * G4AnyType::Ref< ValueType >::Address ( ) const
inlinevirtual

Address

Implements G4AnyType::Placeholder.

Definition at line 182 of file G4AnyType.hh.

182{ return (void*) (&fRef); }

References G4AnyType::Ref< ValueType >::fRef.

◆ Clone()

template<typename ValueType >
virtual Placeholder * G4AnyType::Ref< ValueType >::Clone ( ) const
inlinevirtual

Clone

Implements G4AnyType::Placeholder.

Definition at line 178 of file G4AnyType.hh.

178{ return new Ref(fRef); }
Ref(ValueType &value)
Definition: G4AnyType.hh:165

References G4AnyType::Ref< ValueType >::fRef, and G4AnyType::Ref< ValueType >::Ref().

◆ FromString() [1/4]

template<typename ValueType >
virtual void G4AnyType::Ref< ValueType >::FromString ( const std::string &  val)
inlinevirtual

FromString

Implements G4AnyType::Placeholder.

Definition at line 195 of file G4AnyType.hh.

196 {
197 std::stringstream ss(val);
198 ss >> fRef;
199 }

References G4AnyType::Ref< ValueType >::fRef.

◆ FromString() [2/4]

void G4AnyType::Ref< bool >::FromString ( const std::string &  val)
inlinevirtual

FromString

Implements G4AnyType::Placeholder.

Definition at line 217 of file G4AnyType.hh.

218{
219 fRef = G4UIcommand::ConvertToBool(val.c_str());
220}
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:545

References G4UIcommand::ConvertToBool().

◆ FromString() [3/4]

void G4AnyType::Ref< G4String >::FromString ( const std::string &  val)
inlinevirtual

FromString

Implements G4AnyType::Placeholder.

Definition at line 223 of file G4AnyType.hh.

224{
225 if(val[0] == '"')
226 fRef = val.substr(1, val.size() - 2);
227 else
228 fRef = val;
229}

◆ FromString() [4/4]

void G4AnyType::Ref< G4ThreeVector >::FromString ( const std::string &  val)
inlinevirtual

FromString

Implements G4AnyType::Placeholder.

Definition at line 232 of file G4AnyType.hh.

233{
234 fRef = G4UIcommand::ConvertTo3Vector(val.c_str());
235}
static G4ThreeVector ConvertTo3Vector(const char *st)
Definition: G4UIcommand.cc:597

References G4UIcommand::ConvertTo3Vector().

◆ ToString()

template<typename ValueType >
virtual std::string G4AnyType::Ref< ValueType >::ToString ( ) const
inlinevirtual

ToString

Implements G4AnyType::Placeholder.

Definition at line 186 of file G4AnyType.hh.

187 {
188 std::stringstream ss;
189 ss << fRef;
190 return ss.str();
191 }

References G4AnyType::Ref< ValueType >::fRef.

◆ TypeInfo()

template<typename ValueType >
virtual const std::type_info & G4AnyType::Ref< ValueType >::TypeInfo ( ) const
inlinevirtual

Query

Implements G4AnyType::Placeholder.

Definition at line 171 of file G4AnyType.hh.

172 {
173 return typeid(ValueType);
174 }

Field Documentation

◆ fRef

template<typename ValueType >
ValueType& G4AnyType::Ref< ValueType >::fRef

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