ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
APR
APRTests
TestDictionary
TestClassVectors.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef TESTCLASSSVECTORS_H
6
#define TESTCLASSSVECTORS_H
7
8
#include <string>
9
#include <vector>
10
#include <ostream>
11
12
class
TestClassVectors
{
13
public
:
14
TestClassVectors
();
15
~TestClassVectors
() {}
16
17
void
setNonZero
();
18
bool
operator==
(
const
TestClassVectors
& rhs )
const
;
19
bool
operator!=
(
const
TestClassVectors
& rhs )
const
;
20
std::ostream&
streamOut
( std::ostream& os )
const
;
21
22
std::vector< std::string >
m_vector_of_string
;
23
std::vector< double >
m_vector_of_double
;
24
std::vector< std::vector< double > >
m_vector_of_vector_of_double
;
25
};
26
27
28
inline
29
TestClassVectors::TestClassVectors
():
30
m_vector_of_string
(),
31
m_vector_of_double
(),
32
m_vector_of_vector_of_double
()
33
{}
34
35
inline
std::ostream&
36
TestClassVectors::streamOut
( std::ostream& os )
const
37
{
38
os <<
"m_vector_of_string( "
<<
m_vector_of_string
.size() <<
" ) :"
;
39
for
( std::vector< std::string >::const_iterator i =
m_vector_of_string
.begin();
40
i !=
m_vector_of_string
.end(); ++i ) {
41
os <<
" "
<< *i;
42
}
43
os << std::endl;
44
os <<
"m_vector_of_double( "
<<
m_vector_of_double
.size() <<
" ) :"
;
45
for
( std::vector< double >::const_iterator i =
m_vector_of_double
.begin();
46
i !=
m_vector_of_double
.end(); ++i ) {
47
os <<
" "
<< *i;
48
}
49
os << std::endl;
50
os <<
"m_vector_of_vector_of_double( "
<<
m_vector_of_vector_of_double
.size() <<
" ) :"
;
51
for
( std::vector< std::vector< double > >
::const_iterator
i =
m_vector_of_vector_of_double
.begin();
52
i !=
m_vector_of_vector_of_double
.end(); ++i ) {
53
os << std::endl <<
" ("
<< i->size() <<
") :"
;
54
for
( std::vector< double >::const_iterator j = i->begin();
55
j != i->end(); ++j ) {
56
os <<
" "
<< *j;
57
}
58
}
59
60
return
os;
61
}
62
63
inline
void
64
TestClassVectors::setNonZero
()
65
{
66
m_vector_of_string
.clear();
67
m_vector_of_string
.push_back(
"lcg"
);
68
m_vector_of_string
.push_back(
"app"
);
69
m_vector_of_string
.push_back(
"pool"
);
70
m_vector_of_double
.clear();
71
m_vector_of_double
.push_back( 1 );
72
m_vector_of_double
.push_back( 2 );
73
m_vector_of_vector_of_double
.clear();
74
m_vector_of_vector_of_double
.push_back(
m_vector_of_double
);
75
m_vector_of_double
.push_back( 3 );
76
}
77
78
inline
bool
79
TestClassVectors::operator==
(
const
TestClassVectors
& rhs )
const
80
{
81
if
(
m_vector_of_string
.size() != rhs.
m_vector_of_string
.size() )
return
false
;
82
if
(
m_vector_of_double
.size() != rhs.
m_vector_of_double
.size() )
return
false
;
83
if
(
m_vector_of_vector_of_double
.size() != rhs.
m_vector_of_vector_of_double
.size() )
return
false
;
84
85
std::vector< std::string >::const_iterator i_vector_of_string_rhs = rhs.
m_vector_of_string
.begin();
86
for
( std::vector< std::string >::const_iterator i =
m_vector_of_string
.begin();
87
i !=
m_vector_of_string
.end(); ++i, ++i_vector_of_string_rhs ) {
88
if
( *i != *i_vector_of_string_rhs )
return
false
;
89
}
90
91
std::vector< double >::const_iterator i_vector_of_double_rhs = rhs.
m_vector_of_double
.begin();
92
for
( std::vector< double >::const_iterator i =
m_vector_of_double
.begin();
93
i !=
m_vector_of_double
.end(); ++i, ++i_vector_of_double_rhs ) {
94
if
( *i != *i_vector_of_double_rhs )
return
false
;
95
}
96
97
std::vector< std::vector< double > >
::const_iterator
i_vector_of_vector_of_double_rhs = rhs.
m_vector_of_vector_of_double
.begin();
98
for
( std::vector< std::vector< double > >
::const_iterator
i =
m_vector_of_vector_of_double
.begin();
99
i !=
m_vector_of_vector_of_double
.end(); ++i, ++i_vector_of_vector_of_double_rhs ) {
100
if
( i->size() != i_vector_of_vector_of_double_rhs->size() )
return
false
;
101
102
std::vector< double >::const_iterator j_vector_of_vector_of_double_rhs = i_vector_of_vector_of_double_rhs->begin();
103
for
( std::vector< double >::const_iterator j = i->begin();
104
j != i->end(); ++j, ++j_vector_of_vector_of_double_rhs ) {
105
if
( *j != *j_vector_of_vector_of_double_rhs )
return
false
;
106
}
107
}
108
109
return
true
;
110
}
111
112
113
inline
bool
114
TestClassVectors::operator!=
(
const
TestClassVectors
& rhs )
const
115
{
116
return
( ( (*
this
) == rhs ) ?
false
:
true
);
117
}
118
119
120
#endif
const_iterator
TestClassVectors
Definition
TestClassVectors.h:12
TestClassVectors::m_vector_of_string
std::vector< std::string > m_vector_of_string
Definition
TestClassVectors.h:22
TestClassVectors::TestClassVectors
TestClassVectors()
Definition
TestClassVectors.h:29
TestClassVectors::operator==
bool operator==(const TestClassVectors &rhs) const
Definition
TestClassVectors.h:79
TestClassVectors::operator!=
bool operator!=(const TestClassVectors &rhs) const
Definition
TestClassVectors.h:114
TestClassVectors::m_vector_of_vector_of_double
std::vector< std::vector< double > > m_vector_of_vector_of_double
Definition
TestClassVectors.h:24
TestClassVectors::m_vector_of_double
std::vector< double > m_vector_of_double
Definition
TestClassVectors.h:23
TestClassVectors::streamOut
std::ostream & streamOut(std::ostream &os) const
Definition
TestClassVectors.h:36
TestClassVectors::setNonZero
void setNonZero()
Definition
TestClassVectors.h:64
TestClassVectors::~TestClassVectors
~TestClassVectors()
Definition
TestClassVectors.h:15
Generated on
for ATLAS Offline Software by
1.17.0