Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Serialize.hh File Reference
#include "globals.hh"

Go to the source code of this file.

Functions

template<typename T >
void WRITE (std::ostream &out, const T &toBeSaved)
 
template<typename T >
void READ (std::istream &in, T &toBeSaved)
 
template<>
void WRITE< G4String > (std::ostream &out, const G4String &name)
 
template<>
void READ< G4String > (std::istream &in, G4String &name)
 

Function Documentation

◆ READ()

template<typename T >
void READ ( std::istream & in,
T & toBeSaved )

Definition at line 49 of file G4Serialize.hh.

50{
51 in.read((char*)(&toBeSaved), sizeof(toBeSaved));
52}

Referenced by G4MoleculeDefinition::Load(), and G4MolecularConfiguration::Unserialize().

◆ READ< G4String >()

template<>
void READ< G4String > ( std::istream & in,
G4String & name )

Definition at line 67 of file G4Serialize.cc.

68{
69 size_t size;
70 in.read((char*)(&size), sizeof(size_t));
71 name = UReadBinaryString::read(in, size);
72}
static G4String read(std::istream &is, size_t size)
const char * name(G4int ptype)

◆ WRITE()

template<typename T >
void WRITE ( std::ostream & out,
const T & toBeSaved )

Definition at line 41 of file G4Serialize.hh.

42{
43 out.write((char*)(&toBeSaved), sizeof(toBeSaved));
44}

Referenced by G4MolecularConfiguration::Serialize(), and G4MoleculeDefinition::Serialize().

◆ WRITE< G4String >()

template<>
void WRITE< G4String > ( std::ostream & out,
const G4String & name )

Definition at line 37 of file G4Serialize.cc.

38{
39 size_t size = name.size();
40 out.write((char*)(&size), sizeof(size_t));
41 out.write(name.c_str(), size);
42}