#include <G4DataVector.hh>
Definition at line 46 of file G4DataVector.hh.
◆ anonymous enum
◆ G4DataVector() [1/5]
G4DataVector::G4DataVector |
( |
| ) |
|
◆ G4DataVector() [2/5]
◆ G4DataVector() [3/5]
◆ G4DataVector() [4/5]
G4DataVector::G4DataVector |
( |
std::size_t |
cap | ) |
|
|
explicit |
Definition at line 40 of file G4DataVector.cc.
41 : std::vector<G4double>(cap, 0.0)
42{}
◆ G4DataVector() [5/5]
G4DataVector::G4DataVector |
( |
std::size_t |
cap, |
|
|
G4double |
value |
|
) |
| |
Definition at line 45 of file G4DataVector.cc.
46 : std::vector<G4double>(cap, value)
47{}
◆ ~G4DataVector()
G4DataVector::~G4DataVector |
( |
| ) |
|
|
virtual |
◆ contains()
◆ index()
std::size_t G4DataVector::index |
( |
const G4double & |
| ) |
|
|
inline |
◆ insertAt()
void G4DataVector::insertAt |
( |
std::size_t |
, |
|
|
const G4double & |
|
|
) |
| |
|
inline |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ remove()
◆ removeAll()
std::size_t G4DataVector::removeAll |
( |
const G4double & |
| ) |
|
|
inline |
◆ Retrieve()
G4bool G4DataVector::Retrieve |
( |
std::ifstream & |
fIn, |
|
|
G4bool |
ascii = false |
|
) |
| |
Definition at line 79 of file G4DataVector.cc.
80{
81 clear();
83
84
85 if(ascii)
86 {
87
88 fIn >> sizeV;
89 if(fIn.fail())
90 {
91 return false;
92 }
93 if(sizeV <= 0)
94 {
95#ifdef G4VERBOSE
96 G4cerr <<
"G4DataVector::Retrieve():";
98#endif
99 return false;
100 }
101
102 reserve(sizeV);
103 for(
G4int i = 0; i < sizeV; ++i)
104 {
106 fIn >> vData;
107 if(fIn.fail())
108 {
109 return false;
110 }
111 push_back(vData);
112 }
113 return true;
114 }
115
116
117 fIn.read((char*) (&sizeV), sizeof sizeV);
118
120 fIn.read((
char*) (value), sizeV * (
sizeof(
G4double)));
122 {
123 delete[] value;
124 return false;
125 }
126
127 reserve(sizeV);
128 for(
G4int i = 0; i < sizeV; ++i)
129 {
130 push_back(value[i]);
131 }
132 delete[] value;
133 return true;
134}
G4GLOB_DLL std::ostream G4cerr
Referenced by G4OrderedTable::Retrieve().
◆ Store()
G4bool G4DataVector::Store |
( |
std::ofstream & |
fOut, |
|
|
G4bool |
ascii = false |
|
) |
| |
Definition at line 53 of file G4DataVector.cc.
54{
55
56 if(ascii)
57 {
58 fOut << *this;
59 return true;
60 }
61
62
64 fOut.write((char*) (&sizeV), sizeof sizeV);
65
67 std::size_t i = 0;
68 for(auto itr = cbegin(); itr != cend(); ++itr, ++i)
69 {
70 value[i] = *itr;
71 }
72 fOut.write((
char*) (value), sizeV * (
sizeof(
G4double)));
73 delete[] value;
74
75 return true;
76}
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & |
out, |
|
|
const G4DataVector & |
pv |
|
) |
| |
|
friend |
Definition at line 137 of file G4DataVector.cc.
138{
139 out << pv.size() << std::setprecision(12) <<
G4endl;
140 for(std::size_t i = 0; i < pv.size(); ++i)
141 {
143 }
144 out << std::setprecision(6);
145
146 return out;
147}
The documentation for this class was generated from the following files: