MagneticField
Interpolation
src
bstream_iterator.h
Go to the documentation of this file.
1
#ifndef bstream_iterator_H
2
#define bstream_iterator_H
3
4
#include "
binary_ifstream.h
"
5
#include "
binary_ofstream.h
"
6
#include <iterator>
7
#include "
FWCore/Utilities/interface/Visibility.h
"
8
9
template
<
typename
T>
10
class
bistream_iterator
:
11
public
std::iterator<std::input_iterator_tag, T, ptrdiff_t, const T*, const T&>
12
{
13
public
:
14
15
bistream_iterator
() :
stream_
(0) {}
16
17
bistream_iterator
(
binary_ifstream
&
s
) :
stream_
(&
s
) {
18
read
();
19
}
20
21
const
T
&
operator*
()
const
{
return
value_
;}
22
23
const
T
*
operator->
()
const
{
return
&
value_
;}
24
25
bistream_iterator
&
operator++
() {
read
();
return
*
this
;}
26
27
bistream_iterator
&
operator++
(
int
) {
28
bistream_iterator
tmp
;
29
read
();
30
return
tmp
;
31
}
32
33
bool
operator==
(
const
bistream_iterator
& rhs) {
34
return
stream_
== rhs.
stream_
;
35
}
36
37
bool
operator!=
(
const
bistream_iterator
& rhs) {
38
return
!
operator==
(rhs);
39
}
40
41
private
:
42
43
binary_ifstream
*
stream_
;
44
T
value_
;
45
46
void
read
() {
47
if
(
stream_
!= 0) {
48
// if (!(*stream_ >> value_)) stream_ = 0;
49
if
(!(*
stream_
>>
value_
)) {
50
stream_
= 0;
51
// std::cout << "istream_iterator: stream turned bad, set stream_ to zero" << std::endl;
52
}
53
}
54
}
55
56
};
57
58
template
<
typename
T>
59
class
dso_internal
bostream_iterator
:
60
public
std::iterator<std::output_iterator_tag,void,void,void,void> {
61
public
:
62
63
bostream_iterator
(
binary_ofstream
&
s
) : stream_(&
s
) {}
64
65
bostream_iterator
&
operator=
(
const
T
&
t
) {
66
*stream_ <<
t
;
67
return
*
this
;
68
}
69
70
bostream_iterator
&
operator*
() {
return
*
this
;}
71
bostream_iterator
&
operator++
() {
return
*
this
;}
72
bostream_iterator
&
operator++
(
int
) {
return
*
this
;}
73
74
private
:
75
76
binary_ofstream
*
stream_
;
77
78
};
79
80
#endif
bostream_iterator::operator++
bostream_iterator & operator++(int)
Definition:
bstream_iterator.h:72
Visibility.h
bistream_iterator::operator==
bool operator==(const bistream_iterator &rhs)
Definition:
bstream_iterator.h:33
bistream_iterator::stream_
binary_ifstream * stream_
Definition:
bstream_iterator.h:43
bistream_iterator::operator++
bistream_iterator & operator++()
Definition:
bstream_iterator.h:25
bistream_iterator::bistream_iterator
bistream_iterator()
Definition:
bstream_iterator.h:15
bistream_iterator::read
void read()
Definition:
bstream_iterator.h:46
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
bistream_iterator::bistream_iterator
bistream_iterator(binary_ifstream &s)
Definition:
bstream_iterator.h:17
bistream_iterator::operator!=
bool operator!=(const bistream_iterator &rhs)
Definition:
bstream_iterator.h:37
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
bistream_iterator::operator*
const T & operator*() const
Definition:
bstream_iterator.h:21
binary_ofstream.h
bostream_iterator::operator*
bostream_iterator & operator*()
Definition:
bstream_iterator.h:70
binary_ifstream
Definition:
binary_ifstream.h:8
bistream_iterator::operator++
bistream_iterator & operator++(int)
Definition:
bstream_iterator.h:27
bistream_iterator::value_
T value_
Definition:
bstream_iterator.h:44
bostream_iterator
Definition:
bstream_iterator.h:59
bistream_iterator::operator->
const T * operator->() const
Definition:
bstream_iterator.h:23
binary_ifstream.h
dso_internal
#define dso_internal
Definition:
Visibility.h:13
bostream_iterator::stream_
binary_ofstream * stream_
Definition:
bstream_iterator.h:76
binary_ofstream
Definition:
binary_ofstream.h:8
T
long double T
Definition:
Basic3DVectorLD.h:48
bostream_iterator::operator=
bostream_iterator & operator=(const T &t)
Definition:
bstream_iterator.h:65
bostream_iterator::operator++
bostream_iterator & operator++()
Definition:
bstream_iterator.h:71
submitPVValidationJobs.t
string t
Definition:
submitPVValidationJobs.py:644
bistream_iterator
Definition:
bstream_iterator.h:10
bostream_iterator::bostream_iterator
bostream_iterator(binary_ofstream &s)
Definition:
bstream_iterator.h:63
Generated for CMSSW Reference Manual by
1.8.16